Groot icon indicating copy to clipboard operation
Groot copied to clipboard

Add publisher/server and autoconnect args to BT Monitor

Open sea-bass opened this issue 2 years ago • 2 comments

This PR adds some extra options to Groot to configure the BT monitor to start with specific address and publisher/server ports, as well as automatically connect by "clicking" the Connect button in the code, if enabled.

Specifically, it lets us run Groot as follows:

ros2 run groot Groot --mode monitor --address 192.168.1.42 --publisher_port 1668 --server_port 1669 --autoconnect

The autoconnect option effectively does the following:

  • Increases the timeout for the ZMQ subscriber to 10 seconds
  • Triggers a click of the "Connect" button in code
  • The above resets the timeout to the default 1 second for users to manually connect/disconnect with the normal timeout

This addresses https://github.com/BehaviorTree/Groot/issues/133 and https://github.com/BehaviorTree/Groot/issues/166.

sea-bass avatar Sep 17 '22 14:09 sea-bass

The ports are already optional, could the server ip also be passed? That would be easy to monitor a robot on a dev pc.

Timple avatar Oct 06 '22 13:10 Timple

The ports are already optional, could the server ip also be passed? That would be easy to monitor a robot on a dev pc.

Done!

sea-bass avatar Oct 08 '22 15:10 sea-bass

The following error occurs during Groot compilation, how to solve it?

/home/qwert/BehaviorTree.CPP/Groot/bt_editor/sidepanel_monitor.cpp: In member function ‘void SidepanelMonitor::on_timer()’: /home/qwert/BehaviorTree.CPP/Groot/bt_editor/sidepanel_monitor.cpp:61:41: error: no matching function for call to ‘zmq::socket_t::recv(zmq::message_t&)’ while( zmq_subscriber.recv(msg) ) ^ In file included from /home/qw/BehaviorTree.CPP/Groot/bt_editor/sidepanel_monitor.h:5:0, from /home/qw/BehaviorTree.CPP/Groot/bt_editor/sidepanel_monitor.cpp:1: /usr/include/zmq.hpp:625:23: note: candidate: size_t zmq::socket_t::recv(void*, size_t, int) inline size_t recv (void *buf, size_t len_, int flags_ = 0) ^~~~ /usr/include/zmq.hpp:625:23: note: candidate expects 3 arguments, 1 provided /usr/include/zmq.hpp:635:21: note: candidate: bool zmq::socket_t::recv(zmq::message_t*, int) inline bool recv (message_t msg_, int flags_ = 0) ^~~~ /usr/include/zmq.hpp:635:21: note: no known conversion for argument 1 from ‘zmq::message_t’ to ‘zmq::message_t’ /home/qwert/BehaviorTree.CPP/Groot/bt_editor/sidepanel_monitor.cpp: In member function ‘bool SidepanelMonitor::getTreeFromServer()’: /home/qwert/BehaviorTree.CPP/Groot/bt_editor/sidepanel_monitor.cpp:149:39: error: ‘zmq::send_flags’ has not been declared zmq_client.send(request, zmq::send_flags::none); ^~~~~~~~~~ /home/qwert/BehaviorTree.CPP/Groot/bt_editor/sidepanel_monitor.cpp:151:60: error: ‘zmq::recv_flags’ has not been declared auto bytes_received = zmq_client.recv(reply, zmq::recv_flags::none); ^~~~~~~~~~ CMakeFiles/behavior_tree_editor.dir/build.make:382: recipe for target 'CMakeFiles/behavior_tree_editor.dir/bt_editor/sidepanel_monitor.cpp.o' failed make[2]: *** [CMakeFiles/behavior_tree_editor.dir/bt_editor/sidepanel_monitor.cpp.o] Error 1 CMakeFiles/Makefile2:109: recipe for target 'CMakeFiles/behavior_tree_editor.dir/all' failed make[1]: *** [CMakeFiles/behavior_tree_editor.dir/all] Error 2 Makefile:129: recipe for target 'all' failed make: *** [all] Error 2

kundezui avatar Mar 06 '23 09:03 kundezui