1
0
Fork
You've already forked ros2_socketcan
0
ros2 package for interfacing with SocketCAN
  • C++ 76.5%
  • CMake 20.1%
  • omnetpp-msg 3.4%
2026年01月13日 16:45:13 +01:00
can_msgs init 2026年01月13日 16:43:27 +01:00
socketcan_driver init 2026年01月13日 16:43:27 +01:00
README.md Update README.md 2026年01月13日 16:45:13 +01:00

ros2_socketcan

ros2 package for SocketCAN drivers and network stack. Made by Gerard Rius for BCN eMotorsport FSAE prototypes.

Allows for receiving and sending CAN 2.0 messages in a non-blocking way.

Previous setup

Before launching the node you must create the CAN interface using:

$ ip link set <can_name> type can bitrate <bitrate>
$ ip link set <can_name> up

The <can_name> must be the same as the one given to the ros2 node. Usually, can0, can1, canN.... You may also need to start the respective drivers. For PEAK hardware, it is not needed. For kvaser hardware, run modprobe kvaser_usb or kvaser_pci.

This commands require permission, so those must be run using sudo. For testing the driver, you can also create a virtual bus using vcan. can-utils can be useful as well.

Packages

can_msgs

Contains messages used by the socketcan_driver node.

  • can_msgs::msg::CANInfo: Stats for the bus, such as bus usage, error frames, etc.
  • can_msgs::msg::Frame: A CAN frame.

socketcan_driver

C++ Node that interfaces with the socket Linux API.

Publishers

  • "/can_rx": Publishes a can_msgs::msg::Frame for each received message.

Subscribers

  • "/can_tx": Subscribes to a can_msgs::msg::Frame and sends the message to the bus.

Parameters

  • ("can_name", std::string): the name of the CAN interface. By default it's value is "can0".