Skip to content

Commit a6fdc4c

Browse files
committed
adding torque check
1 parent 33c3db9 commit a6fdc4c

1 file changed

Lines changed: 3 additions & 1 deletion

File tree

odrive_ros2_control/src/odrive_hardware_interface.cpp

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -327,10 +327,12 @@ bool ODriveHardwareInterface::set_axis_command_mode(Axis axis) {
327327
RCLCPP_INFO(rclcpp::get_logger("ODriveHardwareInterface"), "Setting to velocity control");
328328
msg.Control_Mode = CONTROL_MODE_VELOCITY_CONTROL;
329329
msg.Input_Mode = INPUT_MODE_PASSTHROUGH;
330-
} else {
330+
} else if (axis.torque_input_enabled_) {
331331
RCLCPP_INFO(rclcpp::get_logger("ODriveHardwareInterface"), "Setting to torque control");
332332
msg.Control_Mode = CONTROL_MODE_TORQUE_CONTROL;
333333
msg.Input_Mode = INPUT_MODE_PASSTHROUGH;
334+
} else {
335+
RCLCPP_INFO(rclcpp::get_logger("ODriveHardwareInterface"), "No control mode specified");
334336
}
335337

336338
bool any_enabled = axis.pos_input_enabled_ || axis.vel_input_enabled_ || axis.torque_input_enabled_;

0 commit comments

Comments
 (0)