Skip to content

Commit 3aaf9c3

Browse files
authored
Merge pull request #63 from MGBla/fix_move_to_home_bug
Quick fix for move-to-home bug
2 parents c35b6cd + ff5332b commit 3aaf9c3

File tree

1 file changed

+5
-4
lines changed

1 file changed

+5
-4
lines changed

ur_robot_driver/src/hardware_interface.cpp

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -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

Comments
 (0)