ros:ros-ddboat-log
no way to compare when less than two revisions
Differences
This shows you the differences between two versions of the page.
— | ros:ros-ddboat-log [2023/03/31 12:12] (current) – created - external edit 127.0.0.1 | ||
---|---|---|---|
Line 1: | Line 1: | ||
+ | Back to [[ros: | ||
+ | Here we will see how to publish a topic on a robot and to subscribe to it on a control laptop. | ||
+ | |||
+ | Considering that the IP address of the robot is 172.20.25.204 (DDBoat n°4) and that the IP address of the control laptop is 172.20.26.81, | ||
+ | |||
+ | On the robot terminal, we set the following environment variables: | ||
+ | <code bash> | ||
+ | export ROS_IP=172.20.25.203 | ||
+ | export ROS_HOSTNAME=172.20.25.203 | ||
+ | export ROS_MASTER_URI=http:// | ||
+ | </ | ||
+ | |||
+ | On the laptop, we set the same variables : | ||
+ | <code bash> | ||
+ | export ROS_IP=172.20.26.81 | ||
+ | export ROS_HOSTNAME=172.20.26.81 | ||
+ | export ROS_MASTER_URI=http:// | ||
+ | </ | ||
+ | |||
+ | We can now make a test by publishing a float every seconds of the robot : | ||
+ | <code bash> | ||
+ | rostopic pub -r 1 my_topic std_msgs/ | ||
+ | </ | ||
+ | |||
+ | We can now echo the topic on the LapTop : | ||
+ | <code bash> | ||
+ | rostopic echo /my_topic | ||
+ | </ | ||
+ | and we should get : | ||
+ | <code bash> | ||
+ | data: 1.0 | ||
+ | --- | ||
+ | data: 1.0 | ||
+ | --- | ||
+ | </ | ||
+ | |||
+ |
ros/ros-ddboat-log.txt · Last modified: 2023/03/31 12:12 by 127.0.0.1