@@ -45,6 +45,7 @@ hardware_interface::return_type URPositionHardwareInterface::configure(const Har
4545 urcl_ft_sensor_measurements_ = { { 0.0 , 0.0 , 0.0 , 0.0 , 0.0 , 0.0 } };
4646 urcl_tcp_pose_ = { { 0.0 , 0.0 , 0.0 , 0.0 , 0.0 , 0.0 } };
4747 urcl_position_commands_ = { { 0.0 , 0.0 , 0.0 , 0.0 , 0.0 , 0.0 } };
48+ urcl_position_commands_old_ = { { 0.0 , 0.0 , 0.0 , 0.0 , 0.0 , 0.0 } };
4849 urcl_velocity_commands_ = { { 0.0 , 0.0 , 0.0 , 0.0 , 0.0 , 0.0 } };
4950 runtime_state_ = static_cast <uint32_t >(rtde::RUNTIME_STATE::STOPPED);
5051 pausing_state_ = PausingState::RUNNING;
@@ -448,6 +449,8 @@ return_type URPositionHardwareInterface::write()
448449 if (position_interface_in_use_)
449450 {
450451 ur_driver_->writeJointCommand (urcl_position_commands_, urcl::comm::ControlMode::MODE_SERVOJ);
452+ // remember old values
453+ urcl_position_commands_old_ = urcl_position_commands_;
451454 }
452455 else
453456 {
@@ -456,9 +459,6 @@ return_type URPositionHardwareInterface::write()
456459
457460 packet_read_ = false ;
458461
459- // remember old values
460- urcl_position_commands_old_ = urcl_position_commands_;
461-
462462 return return_type::OK;
463463 }
464464 else
@@ -472,7 +472,8 @@ void URPositionHardwareInterface::handleRobotProgramState(bool program_running)
472472{
473473 if (!robot_program_running_ && program_running)
474474 {
475- // TODO how to set controller reset flag
475+ urcl_position_commands_old_ = urcl_position_commands_;
476+ position_interface_in_use_ = false ;
476477 }
477478 robot_program_running_ = program_running;
478479}
0 commit comments