Rosject 1.1 Wall following - No topic /cmd_vel

Hello,

I’m working on the wall following portion of the Rosject at the end of Unit 3 “Understanding ROS Topics”.

In the Unit, we published to the topic /cmd_vel to turn the robot.

Typing ros2 topic list, /cmd_vel was visible in the output.

Now in the Rosject environment, I don’t see that topic or any other topic that would fulfill that function.

In Terminal 1:

source /opt/ros/noetic/setup.bash
source ~/simulation_ws/devel/setup.bash
roslaunch realrobotlab main.launch

Then in Terminal 2:

source ~/.bashrc_bridge
ros2 run ros1_bridge dynamic_bridge --bridge-all-topics

Then in Terminal 3:

ros2 topic list

Result:

/clock
/cv_camera/camera_info
/cv_camera/image_raw
/cv_camera/image_raw/compressed
/cv_camera/image_raw/compressedDepth
/gazebo/link_states
/gazebo/model_states
/imu
/joint_states
/odom
/overlord/camera/camera_info
/overlord/camera/image_raw
/overlord/camera/image_raw/compressed
/overlord/camera/image_raw/compressedDepth
/parameter_events
/rosout
/rosout_agg
/scan
/tf
/tf_static

I’ve inspected each one using

ros2 topic info /joint_states

But none of them have a message of type /geometry_msgs/msg/Twist as /cmd_vel does

Is something wrong with the environment, or do I need to look deeper into the topics nested under these topics?

There is nothing wrong with the environment. You just have to publish to that topic because when the robot is stopped, it doesn’t appear in ros2 topic list because it is not moving. As soon as you publish to /cmd_vel you’ll see it move

@EQdAzc in addition to the above, please also make sure the simulation is running.

Thanks both of you. It seems I need to improve my understanding of ros topics!
How could I have checked that the robot would listen to the topic /cmd_vel?

I disagree with with @roalgoal. There can and are topics which have no publishers and still are available. It is not possible to publish to a topic that is not available.

There is a /cmd_vel topic, but remember that the robot uses ROS1!! Rosbridge will take care of communication between ROS and ROS2 when the topics are sent -that is why roalgoal’s advice works! But it is not a topic waiting to be published to in order to show itself, it is a topic in the ROS1 dimension)-. It would be cool if in future updates ros2 topic list also prints the topics available through Rosbridge (with the specification that those are ROS1 topics).

I find the same as you when I do:
user:~$ cd ~/ros2_ws/
user:~/ros2_ws$ source install/setup.bash
user:~/ros2_ws$ ros2 topic list
/clock
/cv_camera/camera_info
/cv_camera/image_raw
/cv_camera/image_raw/compressed
/cv_camera/image_raw/compressedDepth
/gazebo/link_states
/gazebo/model_states
/imu
/joint_states
/odom
/overlord/camera/camera_info
/overlord/camera/image_raw
/overlord/camera/image_raw/compressed
/overlord/camera/image_raw/compressedDepth
/parameter_events
/rosout
/rosout_agg
/scan
/tf
/tf_static

In another shell instead I source from catkin_make and a good ol’ rostopic list gives me my precious /cmd_vel topic:

click
user:~/catkin_ws$ source devel/setup.bash
ROS_DISTRO was set to 'foxy' before. Please make sure that the environment does not mix paths from different distributions.
user:~/catkin_ws$ rostopic list
/clock
/cmd_vel
/cv_camera/camera_info
/cv_camera/image_raw
/cv_camera/image_raw/compressed
/cv_camera/image_raw/compressed/parameter_descriptions
/cv_camera/image_raw/compressed/parameter_updates
/cv_camera/image_raw/compressedDepth
/cv_camera/image_raw/compressedDepth/parameter_descriptions
/cv_camera/image_raw/compressedDepth/parameter_updates
/cv_camera/image_raw/theora
/cv_camera/image_raw/theora/parameter_descriptions
/cv_camera/image_raw/theora/parameter_updates
/cv_camera/parameter_descriptions
/cv_camera/parameter_updates
/gazebo/link_states
/gazebo/model_states
/gazebo/parameter_descriptions
/gazebo/parameter_updates
/gazebo/performance_metrics
/gazebo/set_link_state
/gazebo/set_model_state
/imu
/joint_states
/odom
/overlord/camera/camera_info
/overlord/camera/image_raw
/overlord/camera/image_raw/compressed
/overlord/camera/image_raw/compressed/parameter_descriptions
/overlord/camera/image_raw/compressed/parameter_updates
/overlord/camera/image_raw/compressedDepth
/overlord/camera/image_raw/compressedDepth/parameter_descriptions
/overlord/camera/image_raw/compressedDepth/parameter_updates
/overlord/camera/image_raw/theora
/overlord/camera/image_raw/theora/parameter_descriptions
/overlord/camera/image_raw/theora/parameter_updates
/overlord/camera/parameter_descriptions
/overlord/camera/parameter_updates
/rosout
/rosout_agg
/scan
/tf
/tf_static

I hope this helps.

You are right @GasPatxo, it is not possible to publish to a topic that is not available. cmd_vel is always available in ROS in this case.

I think the reason why the topic does not appear with introspection is that because the ros1_bridge has not established a connection with the topic in ROS since no messages have passed through, especially if the bridge is launched without --bridge-all-topics