ROS on Multiple Computer_Connecting Jetson Nano with PC over LAN - Dieptranivsr/DroneIVSR GitHub Wiki
Communicate to Jetson Nano over LAN from Laptop/PC Desktop
Know IP address's of your Laptop/PC Desktop
$ ifconfig
or
$ hostname -I
So finally:
- Master PC IP: 192.168.68.38
- Slave PC IP/ Jetson Nano: 192.168.68.66
Configuring the .bashrc file
We need to say our computer who is the master computer running ROS and what is there's IP in the network. Since Computers running ROS don’t know there IP address.
MASTER SIDE
Firstly, in Master PC, open terminal and type:
$ gedit .bashrc
go to the bottom of your .bashrc file and paste then save it
export ROS_MASTER_URI=http://localhost:11311/
export ROS_HOSTNAME=192.168.68.38
export ROS_IP=192.168.68.38
In the first line, we specify the address of the master along with the port to operate.
export ROS_MASTER_URI=http://localhost:11311/
SLAVE SIDE
export ROS_MASTER_URI=http://192.168.68.38:11311/
export ROS_HOSTNAME=192.168.68.66
export ROS_IP=192.168.68.66
You can see the change we here specified ROS_MASTER_URI as http://192.168.68.38:11311/ here 192.168.68.66 is IP address of our master PC. We tell the IP address of master PC to our Pi. Rest of the line specifies IP address of the own just it.
Finally, you have to source your .bashrc file
$ source .bashrc
In above steps please specify correct IP address of your devices
Testing the communication
Now we just have to test if they are communicating with each other. We can do different thing to check it like running a publisher in Master PC and subscribing the topic in our Jetson Nano.
We will use turtle sim node to test the communication
Firstly in your master PC run roscore
$ roslaunch mavros px4.launch fcu_url:=/dev/ttyTHS1:921600
$ roslaunch realsense2_camera rs_camera.launch depth_width:=640 depth_height:=480 depth_fps:=15
$ roslaunch esdf_planner exp_esdf_planner.launch
Now we can see the map under construction on Jetson Nano. In the Laptop/ PC Desktop terminal, you run command line below
$ rviz file.rviz