This packages serves as a standalone ROS2 node to control the ODrive via CAN.
For information about installation, prerequisites and getting started, check out the ODrive ROS CAN Package Guide.
node_id
: The node_id of the device this node will attach tointerface
: the network interface name for the can bus
-
/control_message
: Input setpoints for the ODrive.The ODrive will interpret the values of input_pos, input_vel and input_torque depending on the control mode.
For example: In velocity control mode (2) input_pos is ignored, and input_torque is used as a feedforward term.
Note: When changing
input_mode
orcontrol_mode
, it is advised to set the ODrive to IDLE before doing so. Changing these values during CLOSED_LOOP_CONTROL is not advised.
-
/odrive_status
: Provides ODrive/system level status updates.For this topic to work, the ODrive must be configured with the following cyclic messages enabled:
error_msg_rate_ms
temperature_msg_rate_ms
bus_voltage_msg_rate_ms
The ROS node will wait until one of each of these CAN messages has arrived before it emits a message on the
odrive_status
topic. Therefore, the largest period set here will dictate the period of the ROS2 message as well. -
/controller_status
: Provides Controller level status updates.For this topic to work, the ODrive must be configured with the following cyclic messages enabled:
heartbeat_msg_rate_ms
encoder_msg_rate_ms
iq_msg_rate_ms
torques_msg_rate_ms
The ROS node will wait until one of each of these CAN messages has arrived before it emits a message on the
controller_status
topic. Therefore, the largest period set here will dictate the period of the ROS2 message as well.
-
/request_axis_state
: Sets the axes requested state.This service requires regular heartbeat messages from the ODrive to determine the procedure result and will block until the procedure completes, with a minimum call time of 1 second.
All of the Message/Service fields are directly related to their corresponding CAN message. For more detailed information about each type, and how to interpet the data, please refer to the ODrive CAN protocol documentation.
Enum types and their corresponding integer values are listed in the ODrive API reference:
If you have the odrive
Python package installed (not mandatory for this ROS node), you translate enums like this:
from odrive.enums import AxisState
print(AxisState.CLOSED_LOOP_CONTROL) # 8
print(AxisState(8).name) # CLOSED_LOOP_CONTROL