1 # ROS Bridge with SoT {#tutorial_ros_bridge}
3 The core of the stack of tasks mechanism is independent from ROS: an execution is hence realized in a closed environment
4 (the entities are only defined in the python environment and are only accessible via python commands).
5 However, some bridges with ROS exist: for the display, but also to send and receive some pieces of data.
8 \section tutorial_ros_bridge_sig_to_topic Signal to ROS topic
10 Two entities allow you to exchange data from the ROS environment to the stack of tasks one,
11 and convert ros topics in sot signals, namely `rosPublish` and `rosSubscribe`.
13 Here is a example of publication of matrix homogeneous from the sot environment to the ROS environment:
16 ros.rosPublish.add('matrixHomoStamped', robot.frames['rightGripper'].name +'_position', 'right_gripper')
17 ros.rosPublish.displaySignals()
18 --- <rosPublish> signal list:
19 |-- <Sig:N12dynamicgraph10RosPublishE(rosPublish)::input(MatrixHomo)::romeo_rightHand_position (Type Cst) AUTOPLUGGED
20 `-- <Sig:N12dynamicgraph10RosPublishE(rosPublish)::input(int)::trigger (Type Fun)
22 The robot right hand position is publised in a ROS topic:
28 This creates an input signal for the ros.rosPublish entity (`romeo_rightHand_position`), as well as the rostopic
29 element `/right_gripper`.
31 Please note that this alone does **NOT** publish anything. In order to publish something, it is hence necessary to plug a signal to the one created in rosPublish.
34 plug(robot.frames['rightGripper'].position, ros.rosPublish.signal(robot.frames['rightGripper'].name +'_position'))
37 Now you are publishing:
39 rostopic echo -n 1 /right_gripper
45 frame_id: /dynamic_graph/world
59 \section tutorial_ros_bridge_topic_to_sig ROS tf to signal
61 Importing a tf requires to convert first the tf into a matrix homogeneous in order to import it in the stack of tasks.
62 The child_frame HAS TO be the odom frame, which is the base for the SoT environment.
63 Hence, in order to use the position of an object in the stack of tasks, you can add
64 this to the launch file:
66 <node name="object" pkg="dynamic_graph_bridge" type="tf_publisher">
67 <param name="frame" type="string" value="object" />
68 <param name="child_frame" type="string" value="odom" />
69 <param name="topic" type="string" value="object" />