ROS Resources: Documentation | Support | Discussion Forum | Index | Service Status | ros @ Robotics Stack Exchange
Ask Your Question

Revision history [back]

I run three nodes on the robot: roscore, the servo driver package, and the low level control package. On my laptop, I run roscore and teleop_twist_keyboard.

This is the root cause of your issue. In general, ROS allows only for one roscore to be running (there are approaches to having multiple masters, but let's put those aside for now). The roscore then coordinates all topics and how the different nodes communicate (i.e. it sets up the transports for the messages etc). Note that the roscore is not a "node".

Have a look at the Networking wiki page. You should (at least) have ROS_MASTER_URI properly set on the machine where the roscore is NOT running. I suggest you start the roscore on your robot. Having set either ROS_IP or ROS_HOSTNAME (never both!) might be required too. Note that you have to export those environment variables in every terminal!

my Ubuntu laptop is on ROS Melodic, while the car is ROS Noetic.

This might be the cause of several problems, but not of what you are experiencing here. This is clearly an issue with in improperly configured network. I would, in general, advise against mixing distros, but for exchanging simple and stable messages you should usually be fine. Sending only a Twist message should work (but I haven't tested that...)

When I do rostopic list on the laptop, it shows it sees the /cmd_vel topic

rostopic list will display any available topic. I.e. any topic on the system (here: your laptop) that any node subscribes or publishes to. even if there is nothing on the other end. So seeing the cmd_vel topic on your laptop basically only tells you that your teleop_keyboard node is publishing to it. use rostopic info to get more information about a topic, such as which node publishes or subscribed to it...