Skip to content

Commit e64f764

Browse files
authored
Merge pull request #1 from helix-robotics-ag/seb/add_ext_pos_mode
Swap Position to ExtendedPosition mode
2 parents d84511d + b0e7696 commit e64f764

File tree

1 file changed

+8
-8
lines changed

1 file changed

+8
-8
lines changed

dynamixel_hardware/src/dynamixel_hardware.cpp

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -102,7 +102,7 @@ CallbackReturn DynamixelHardware::on_init(const hardware_interface::HardwareInfo
102102
}
103103

104104
enable_torque(false);
105-
set_control_mode(ControlMode::Position, true);
105+
set_control_mode(ControlMode::ExtendedPosition, true);
106106
set_joint_params();
107107
enable_torque(true);
108108

@@ -305,7 +305,7 @@ return_type DynamixelHardware::write(const rclcpp::Time & /* time */, const rclc
305305
// Position control
306306
if (std::any_of(
307307
joints_.cbegin(), joints_.cend(), [](auto j) { return j.command.position != j.prev_command.position; })) {
308-
set_control_mode(ControlMode::Position);
308+
set_control_mode(ControlMode::ExtendedPosition);
309309
if(mode_changed_)
310310
{
311311
set_joint_params();
@@ -327,7 +327,7 @@ return_type DynamixelHardware::write(const rclcpp::Time & /* time */, const rclc
327327
set_joint_velocities();
328328
return return_type::OK;
329329
break;
330-
case ControlMode::Position:
330+
case ControlMode::ExtendedPosition:
331331
set_joint_positions();
332332
return return_type::OK;
333333
break;
@@ -396,23 +396,23 @@ return_type DynamixelHardware::set_control_mode(const ControlMode & mode, const
396396
return return_type::OK;
397397
}
398398

399-
if (mode == ControlMode::Position && (force_set || control_mode_ != ControlMode::Position)) {
399+
if (mode == ControlMode::ExtendedPosition && (force_set || control_mode_ != ControlMode::ExtendedPosition)) {
400400
bool torque_enabled = torque_enabled_;
401401
if (torque_enabled) {
402402
enable_torque(false);
403403
}
404404

405405
for (uint i = 0; i < joint_ids_.size(); ++i) {
406-
if (!dynamixel_workbench_.setPositionControlMode(joint_ids_[i], &log)) {
406+
if (!dynamixel_workbench_.setExtendedPositionControlMode(joint_ids_[i], &log)) {
407407
RCLCPP_FATAL(rclcpp::get_logger(kDynamixelHardware), "%s", log);
408408
return return_type::ERROR;
409409
}
410410
}
411411
RCLCPP_INFO(rclcpp::get_logger(kDynamixelHardware), "Position control");
412-
if(control_mode_ != ControlMode::Position)
412+
if(control_mode_ != ControlMode::ExtendedPosition)
413413
{
414414
mode_changed_ = true;
415-
control_mode_ = ControlMode::Position;
415+
control_mode_ = ControlMode::ExtendedPosition;
416416
}
417417

418418
if (torque_enabled) {
@@ -421,7 +421,7 @@ return_type DynamixelHardware::set_control_mode(const ControlMode & mode, const
421421
return return_type::OK;
422422
}
423423

424-
if (control_mode_ != ControlMode::Velocity && control_mode_ != ControlMode::Position) {
424+
if (control_mode_ != ControlMode::Velocity && control_mode_ != ControlMode::ExtendedPosition) {
425425
RCLCPP_FATAL(
426426
rclcpp::get_logger(kDynamixelHardware), "Only position/velocity control are implemented");
427427
return return_type::ERROR;

0 commit comments

Comments
 (0)