[Solved] Nodes on Virtual Machine cannot send messages to ROSbot 2.0

Hi there,

I have recently obtained a ROSbot 2.0 to work with and I’ve completed the quick-start guide including the webgui part. This all worked.

I can also read out the laserscan data on my Virtual Machine with rviz by doing:
On ROSbot:

rosrun rplidar_ros rplidarNode

On VM:

rosrun tf static_transform_publisher 0 0 0.1 3.14 0 0 base_link laser_frame 100
rosrun rviz rviz

in RVIZ, change fixed frame to /base_link
Add > Laserscan with topic /scan and style ‘points’

This works, but what doesn’t work is sending /cmd_vel messages to the ROSbot from my VM.

rosrun teleop_twist_keyboard teleop_twist_keyboard.py

I can see the messages on my VM with

rostopic echo /cmd_vel

But I don’t see them on my ROSbot and the ROSbot does not drive.

Running the node on my ROSbot using ssh does make it drive around and I can also see those messages come in on the VM.

What is going on?

I really need to be able to drive the ROSbot from my laptop as the program which will be running is to heavy to run on the ROSbot.

Other info.
Oracle VM VirtualBox, Ubuntu 64-bit machine built from ‘ready to go virtual image’ from the Husarion fileserver.

Kind regards,
Patrick

For those running into this issue.

It seems that configuring the Oracle VirtualBox Virtual Machine to use ‘Network bridge adapter’ instead of default helps here.

Also, in the ~/.bashrc use of your VM use:

export ROS_MASTER_URI=http://X.X.X.X:11311
export ROS_IP=Y.Y.Y.Y
# export ROS_MASTER_URI=http://master:11311
# export ROS_IPV6=on

Where X.X.X.X is the machine your master is running on (in my case the ROSbot).
And Y.Y.Y.Y is the IP as can be found with ifconfig.

On the ROSbot (machine running master) use, in ~/.bashrc:

export ROS_MASTER_URI=http://X.X.X.X:11311
export ROS_IP=X.X.X.X
# export ROS_MASTER_URI=http://master:11311
# export ROS_IPV6=on

Where X.X.X.X is the IP of the master.