CAN Bus
L6/O6 dexterous hands communicate over the CAN bus. The interface_type parameter in the constructor selects the CAN adapter type.
Constructor Parameters
from realhand import L6
hand = L6(
side="left", # "left" or "right"
interface_name="can0", # Interface name
interface_type="socketcan", # Adapter type
)
| Parameter | Description |
|---|---|
side | Left hand "left" or right hand "right" |
interface_name | Interface name, depending on OS and adapter |
interface_type | CAN adapter type, defaults to "socketcan" |
Linux (SocketCAN)
Linux uses SocketCAN by default, so you do not need to specify interface_type.
hand = L6(side="left", interface_name="can0")
Configure the CAN interface:
sudo ip link set can0 type can bitrate 1000000
sudo ip link set can0 up
To connect multiple CAN interfaces: Linux names interfaces in creation order, so depending on the order in which CAN adapters are connected to the control board, they will be named can0, can1, can2, and so on. You can bring up multiple CAN interfaces by running the following commands in sequence:
sudo ip link set can0 type can bitrate 1000000 && sudo ip link set can0 up && \
sudo ip link set can1 type can bitrate 1000000 && sudo ip link set can1 up && \
sudo ip link set can2 type can bitrate 1000000 && sudo ip link set can2 up
# ...
Windows (PCAN)
Use a PCAN adapter on Windows:
hand = L6(side="left", interface_name="PCAN_USBBUS1", interface_type="pcan")
For other adapter types, see the python-can documentation.