@@ -459,7 +459,7 @@ controller_interface::return_type JointTrajectoryController::update(
459459 // If effort interface only, add desired effort as feed forward
460460 // If velocity interface, ignore desired effort
461461 size_t index_cmd_joint = map_cmd_to_joints_[i];
462- tmp_command_ [index_cmd_joint] =
462+ closed_loop_pid_command_ [index_cmd_joint] =
463463 (command_next_.velocities [index_cmd_joint] * ff_velocity_scale_[i]) +
464464 (has_effort_command_interface_ ? command_next_.effort [index_cmd_joint] : 0.0 ) +
465465 pids_[i]->compute_command (
@@ -475,30 +475,19 @@ controller_interface::return_type JointTrajectoryController::update(
475475 }
476476 if (has_velocity_command_interface_)
477477 {
478- if (use_closed_loop_pid_adapter_)
479- {
480- assign_interface_from_point (joint_command_interface_[1 ], tmp_command_);
481- }
482- else
483- {
484- assign_interface_from_point (joint_command_interface_[1 ], command_next_.velocities );
485- }
478+ assign_interface_from_point (
479+ joint_command_interface_[1 ],
480+ use_closed_loop_pid_adapter_ ? closed_loop_pid_command_ : command_next_.velocities );
486481 }
487482 if (has_acceleration_command_interface_)
488483 {
489484 assign_interface_from_point (joint_command_interface_[2 ], command_next_.accelerations );
490485 }
491486 if (has_effort_command_interface_)
492487 {
493- if (use_closed_loop_pid_adapter_)
494- {
495- assign_interface_from_point (joint_command_interface_[3 ], tmp_command_);
496- }
497- else
498- {
499- // If position and effort command interfaces, only pass desired effort
500- assign_interface_from_point (joint_command_interface_[3 ], state_desired_.effort );
501- }
488+ assign_interface_from_point (
489+ joint_command_interface_[3 ],
490+ use_closed_loop_pid_adapter_ ? closed_loop_pid_command_ : state_desired_.effort );
502491 }
503492
504493 // store the previous command and time used in open-loop control mode
@@ -941,7 +930,7 @@ controller_interface::CallbackReturn JointTrajectoryController::on_configure(
941930 (has_velocity_command_interface_ && params_.command_interfaces .size () == 1 ) ||
942931 (has_effort_command_interface_ && params_.command_interfaces .size () == 1 );
943932
944- tmp_command_ .resize (dof_, 0.0 );
933+ closed_loop_pid_command_ .resize (dof_, 0.0 );
945934
946935 if (use_closed_loop_pid_adapter_)
947936 {
0 commit comments