-
Notifications
You must be signed in to change notification settings - Fork 2
Network

Please make sure you have followed the Installation page on Setup .bashrc for multimachine, connected ethernet to the router, and have roscore running on the main computer.
Here we use the Raspberry Pi as a node/interface between the SPI-linked CANBUS via the MCP2515 hat with ROS over ethernet. Other types of connections for converting ROS messages to CANBUS interfaces can also be used instead.
Once the can0 connection is setup via SPI, reboot and use the following to check the status of the connection:
ip -det link show can0
ip -details -statistics link show can0
we need to reduce the tx queue length to make sure the most recent data is being broadcasted onto the CAN network from ROS First, we need to shut down can0
sudo ip link set can0 down
Then we can edit the interface's properties
sudo ip link set can0 up type can bitrate 1000000
sudo ip link set can0 txqueuelen 1000
sudo ip link set can0 txqueuelen 1
To make the change effective, restart the systemd-networkd
sudo systemctl enable systemd-networkd
sudo systemctl start systemd-networkd
sudo systemctl restart systemd-networkd
Now running ip -details -statistics link show can0, we should see the txqueuelen reduced to 1
Here are some useful commands to monitor your CANBUS
dmesg | grep -i spi
dmesg | grep -i can
rosrun socketcan_interface socketcan_dump can0
canbusload can0@1000000
python3 -m can.viewer -c "can0" -i "socketcan"
candump can0 -xct z -n 10
WIP