CAN
RemotiveTopology supports two ways of instantiating a CAN channel:
RemotiveBus is the default driver. You can change the default driver for all CAN channels in the instance settings.
- Linux and Windows (WSL): Use RemotiveBus. It's needed to connect to physical hardware and to use standard CAN tooling such as
candump. - Mac: RemotiveBus isn't available on macOS. The preferred way is to run RemotiveTopology in a Linux virtual machine so you can use RemotiveBus. UDP emulation is available as a fallback.
RemotiveBus
RemotiveBus provides SocketCAN access to Docker containers. It's available on Linux, including WSL on Windows. On macOS, run it in a Linux virtual machine. You need to install RemotiveBus before using it.
The driver is configured on two levels. driver.type: remotivebus selects RemotiveBus as the driver, while driver.config.type selects the RemotiveBus mode:
canconnects to an existing SocketCAN network interface on the host.vcanuses a virtual CAN interface.
Connecting to a CAN interface on the host
To connect to an existing CAN network interface, you specify:
type: canin the driver config.device: the interface name inside the container.host_device: the interface name on the host. This is optional and defaults to the value ofdevice.
channels:
DriverCan:
type: can
driver:
type: remotivebus
config:
type: can
device: drivercan
host_device: can5 # if a specific name is needed on the host
Virtual CAN
When running in a purely virtual environment, you specify:
type: vcanin the driver config.device: the interface name inside the container. If omitted, the lowercase channel name is used.host_device: the interface name on the host. This is optional. If omitted, the network isn't visible on the host.
channels:
DriverCan:
type: can
driver:
type: remotivebus
config:
type: vcan
device: drivercan
Emulation using UDP
Emulation using UDP is available on all platforms and doesn't require any additional setup. It sends the CAN frames using UDP multicast. Each frame is encoded as an Ethernet PDU, so the signals are encoded exactly as on a real CAN bus.
Specify the driver for each channel, or make UDP the default driver:
channels:
DriverCan:
type: can
driver:
type: udp
Naming devices
Linux limits network interface names to 15 characters. This applies to both device and host_device. If your channel name is too long, set a shorter name explicitly.
Recommendations:
- Avoid names such as
can0orcan1. These are the names Linux gives physical CAN devices by default, so they don't tell which bus a device is connected to. - Rename physical devices to match your target architecture, e.g.
sudo ip link set can0 name drivercan - Inside the container try to use a name similar to the channel. This makes it easier to understand in a virtual context.
RemotiveBus also supports plugins, for example to connect to hardware LIN.