Skip to content

Networking

Bijay Gaudel edited this page Aug 9, 2023 · 6 revisions

Networking

Network connection over a LAN

ToDo

Network connection for ROS

  • If you're connected to VOXL with Wi-Fi over a LAN, you should be able to ping to the VOXL's IP from your PC and vice versa (i.e. ping to your PC's IP from the VOXL)

  • setup ROS on the host PC and on the VOXL by updating my_ros_env.sh located in /home/root inside VOXL. your PC's static IP (defined on the router) should be used for the ROS_MASTER_IP, and ROS_IP for each platform would be its IP on the router. Then, roscore on the PC will make every rostopic available for all robots.

At this stage, if roscore is running in the host PC, rostopic list should show the available topics in the VOXL, and vice versa. It's a bi-directional connection. To test,

# in a terminal in the host pc
$ rostopic pub -r 10 /cmd_vel geometry_msgs/Twist  '{linear:  {x: 1.0, y: 2.0, z: 3.0}, angular: {x: 3.0,y: 2.0,z: 01.0}}'
# inside VOXL
voxl:~$ rostopic list
/cmd_vel
/rosout
/rosout_agg
voxl:~$ rostopic echo /cmd_vel 
linear: 
  x: 1.0
  y: 2.0
  z: 3.0
angular: 
  x: 3.0
  y: 2.0
  z: 1.0
---

the test should also work the other way around i.e. from VOXL to the host PC.

RB5 Platform

here is a temporary solution to stop MAC randomization in the RB5 drone Platform.

wait up for 5 seconds every time you power up the drone.

# inside the drone's bash terminal
rb5:/$ cd home/root/ && touch setup_staticIP.sh
rb5:/$ vi setup_staticIP.sh

add the following lines (modify if needed) and save the files. Use i key to insert the editing mode of the vim and to save the changes press Esc followed by :wq.

#!/bin/bash

DRONE_IP='172.16.0.33'
ROUTER_IP='172.16.0.1'

NETMASK='255.255.255.0'

INTERFACE='wlan0'

ifconfig $INTERFACE down
ifconfig $INTERFACE $DRONE_IP netmask $NETMASK up

ip route add default via $ROUTER_IP dev $INTERFACE

Then, run chmod +x setup_staticIP.sh.

Now, we put the bash commands into a service:

rb5:/$ cd /etc/systemd/system && touch setup_staticIP.service
rb5:/$ vi setup_staticIP.service

copy the following into the setup_staticIP.service and save.

[Unit]
After=dnsmasq.service

[Service]
Type=oneshot
ExecStartPre=/bin/sleep 5
ExecStart=/home/root/setup_staticIP.sh

[Install]
WantedBy=default.target

Finally, use systemctl start setup_staticIP to start the service and then systemctl enable setup_staticIP to configure the system to start the service at next reboot. Check up the status by systemctl status setup_staticIP.

Clone this wiki locally