Avoid moving to zero position on hardware activate#78
Conversation
Yadunund
left a comment
There was a problem hiding this comment.
This is a more elegant solution without relying on changes to upstream libraries. Thanks for PR!
|
It's also arguably the correct way to fix this :) |
|
This requires the service start_egm_joint to be active before launching the controllers? If yes, maybe getting the initial joints from rws using the update function would be preferable? (to avoid using start_egm_joint before the launch) |
|
Hi @ardimou, yes - this requires EGM to be active when starting the hardware interface. Looking at the code block before the new addition, hardware activation should fail if EGM is not connected in a given number of retries: size_t counter = 0;
RCLCPP_INFO(LOGGER, "Connecting to robot...");
while (rclcpp::ok() && ++counter < NUM_CONNECTION_TRIES)
{
// Wait for a message on any of the configured EGM channels.
if (egm_manager_->waitForMessage(500))
{
RCLCPP_INFO(LOGGER, "Connected to robot");
break;
}
RCLCPP_INFO(LOGGER, "Not connected to robot...");
if (counter == NUM_CONNECTION_TRIES)
{
RCLCPP_ERROR(LOGGER, "Failed to connect to robot");
return CallbackReturn::ERROR;
}
rclcpp::sleep_for(500ms);
}However, it never gets to the So if the above bug wasn't present (the fix is easy so I guess it won't be much longer), the robot hardware would fail to activate without EGM active. Which I think makes sense, since "active" hardware should be ready to read state and write commands (which requires EGM). In addition, the
Finally, a couple of suggestions to get around your issue:
The above is just what I think makes sense - I'm happy to discuss alternatives though. |
Hello, this PR addresses the issue of robot moving to zero position on hardware interface activation, as described in #44.
To resolve it, this PR assigns the current state read from EGM to the joint commands in the
on_activatecallback (see diff).I am aware that a PR addressing this is already open (#45), but the proposed solution:
This was tested in RobotStudio, using the IRB1200_5_90.rspag project and RobotWare 6.16.