Setup:
Adding Files to Bash
Adding pppd ros2 config
sudo nano /etc/ppp/peers/ros2 (called with: sudo pppd call ros2)
/dev/ttyUSB0 57600
noauth
crtscts
lock
local
persist
maxfail 0
passive
10.0.0.1:10.0.0.2 # For the first endpoint, reverse the IPs for the second endpoint
Adding Serial Rules
sudo nano /etc/udev/rules.d/99-serial.rules
SUBSYSTEM=="tty", ATTRS{idVendor}=="0403", ATTRS{idProduct}=="6015", MODE="0666", GROUP="dialout"
reload udev rules:
sudo udevadm control --reload-rules
sudo udevadm trigger
sudo reboot
ROS2 Config in bash
Host Machine:
bash:
export ROS_LOCALHOST_ONLY=0
export ROS_DOMAIN_ID=42
export RMW_IMPLEMENTATION=rmw_fastrtps_cpp
sudo systemctl restart network-manager
sudo pppd call ros2
ROS_IP=10.0.0.1 ros2 topic pub /talker std_msgs/msg/String "{data: 'Hello world'}"
Reciving Machine:
bash:
export ROS_LOCALHOST_ONLY=0
export ROS_DOMAIN_ID=42
export RMW_IMPLEMENTATION=rmw_fastrtps_cpp
sudo systemctl restart network-manager
sudo pppd call ros2
ROS_IP=10.0.0.1 ros2 topic echo /talker
Using rmw_fastrtps_cpp
sudo apt update
sudo apt install ros-galactic-rmw-fastrtps-cpp ros-galactic-rmw-fastrtps-dynamic-cpp
Testing Steps:
- Send Ros2 Messages over comms
- Setup publisher and subscriber for Twist messages
- Integrate sent messages with CAN
- Control motor through Xbox Remote