Show EOL distros: 

ros_canopen: can_msgs | canopen_402 | canopen_chain_node | canopen_master | canopen_motor_node | socketcan_bridge | socketcan_interface

Package Summary

This package contains a generic CAN interface description with helpers for filtering and driver implementation. Further a socketcan implementation based on boost::asio is included.

ros_canopen: can_msgs | canopen_402 | canopen_chain_node | canopen_master | canopen_motor_node | socketcan_bridge | socketcan_interface

Package Summary

This package contains a generic CAN interface description with helpers for filtering and driver implementation. Further a socketcan implementation based on boost::asio is included.

ros_canopen: can_msgs | canopen_402 | canopen_chain_node | canopen_master | canopen_motor_node | socketcan_bridge | socketcan_interface

Package Summary

Generic CAN interface description with helpers for filtering and driver implementation. Further a socketcan implementation based on boost::asio is included.

ros_canopen: can_msgs | canopen_402 | canopen_chain_node | canopen_master | canopen_motor_node | socketcan_bridge | socketcan_interface

Package Summary

Generic CAN interface description with helpers for filtering and driver implementation. Further a socketcan implementation based on boost::asio is included.

ros_canopen: can_msgs | canopen_402 | canopen_chain_node | canopen_master | canopen_motor_node | socketcan_bridge | socketcan_interface

Package Summary

Generic CAN interface description with helpers for filtering and driver implementation. Further a socketcan implementation based on boost::asio is included.

ros_canopen: can_msgs | canopen_402 | canopen_chain_node | canopen_master | canopen_motor_node | socketcan_bridge | socketcan_interface

Package Summary

Generic CAN interface description with helpers for filtering and driver implementation. Further a socketcan implementation based on boost::asio is included.

Overview

This packages provides a generic CAN interface class and a SocketCAN-based driver implementation.

The interface is divided into three parts:

  • StateInterface: Listener interface for the state of the driver

  • CommInterface: Listener interface for receiving messages and send functionality

  • DriverInterface: inherits from both and adds management interfaces

The listeners are based on FastDelegate std::function (since melodic) and use RAII-pointers.

The SocketCAN driver interface is based on Boost.Asio and provides concurrent access to SocketCAN interfaces. It is the default CAN implementation used throughout ros_canopen and requires Linux kerner 2.6.25 or newer.

Plug-in system

The SocketCAN driver is exposed as "can::SocketCANInterface" with base class can::DriverInterface via class_loader. In addition the plugin library is announced to pluginlib.

Tested Drivers and Devices

The SocketCAN driver interface should work with all SocketCAN network interfaces. The linux mainline kernel already includes some device drivers, other devices are supported by vendor-provided implementations.

The following devices were tested with socketcan_interface:

Vendor

Device

Driver

Status

Comments

PEAK-System Technik GmbH

PEAK-USB

Kernel peak_usb

Works

PEAK-cPCI

Kernel peak_pci

Not working

IRQ problems

Vendor (NETDEV!)

Works

esd electronic system design gmbh

CAN-USB/2

Kernel esd_usb2

Works

Ixxat (HMS Networks)

USB-to-CAN V2 compact

Vendor

Works

optional requirement: libelf-dev

PICAN2 (SK Pang Electronics)

PICAN2

Kernel mcp2515

Works

Preparation

Load driver

Set-up udev rules or type manually:

sudo modprobe peak_usb # kernel driver, since 3.11

sudo modprobe peak_pci # kernel driver

sudo modprobe pcan # PEAK vendor driver

sudo modprobe esd_usb2 # kernel driver

Initialize NIC

Bring-up CAN NIC (Linux kernel drivers):

sudo ip link set can0 up type can bitrate 500000 # adjust bitrate as needed

Further options are availabe, please consult SocketCAN Readme, section 6.5. For automatic set-up, the network can be configured in /etc/network/interfaces, e.g.:

allow-hotplug can0
iface can0 can static
    bitrate 500000
#    up ip link set $IFACE txqueuelen 20 # uncomment if more than 4 nodes are used

Tools and Debugging

socketcan_dump

Simple test program provided with the package, just prints the received messages:

rosrun socketcan_interface socketcan_dump can0

ip -details -statistics link show can0

(not available for all drivers)

can-utils

Feature-rich tool suite for SocketCAN, install with:

sudo apt-get install can-utils
  • candump
  • cansend
  • canbusload

Wiki: socketcan_interface (last edited 2020-10-28 19:30:11 by ConnorAnderson)