Lets say I have a robot, with a raspberry pi, or a jetson, running ROS. And I want to see the sensor readings, or something on RVIZ, on my laptop. Or maybe control the robot using a wired Xbox controller connected to my laptop... Is there anyway I can write a node on my laptop that can connect to the roscore of the robot (rpi/jetson) over the lan network, or a zigbee module or something?
Or do I have to create another instance of roscore on my laptop, and make them talk to each other through the zigbee module/lan? That would be very tedious... Please don't tell me that it's the only option.
EDIT: The part about connecting the robot and the computer using lan has been explained... I'd really appreciate it if somebody could now tell me how to connect it to the robot's roscore using RF modules
If the robot computer (e.g. the jetson or pi) and the laptop are on the same LAN, then you only need one roscore
running, say on the robot.
You need to set two environment variables, ROS_MASTER_URI
and ROS_IP
. ROS_MASTER_URI
should be set to http://ROBOT_IP:11311
on both computers, while ROS_IP
should be set to the IP address of the computer it is on. In other words, on the robot computer, ROS_IP
is equal to the IP address in ROS_MASTER_URI
, but on the laptop, it is equal to that laptop's IP address.
Once those environment variables are set, you can "talk" to the robot using ROS topics, just as if those ROS topics were on the same machine. There should be no change needed to your code.
See the official wiki Running ROS across Multiple Machines for more information.