Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update robot state if time since last command exceeds timeout #3251

Open
wants to merge 2 commits into
base: main
Choose a base branch
from

Conversation

KazuyaOguma18
Copy link

Description

When starting both move_group and moveit_servo simultaneously, controlling the arm with move_group first and then performing jog operations with moveit_servo resulted in the jog operations being executed from the arm's initial pose, without considering the results of the previous control.

To address this issue, the robot's state is now updated synchronously, halting other processes if no control commands are received for a duration exceeding the incoming_command_timeout, which indicates that no jog operations are being executed.

Checklist

  • Required by CI: Code is auto formatted using clang-format
  • Extend the tutorials / documentation reference
  • Document API changes relevant to the user in the MIGRATION.md notes
  • Create tests, which fail without this PR reference
  • Include a screenshot if changing a GUI
  • While waiting for someone to review your request, please help review another open pull request to support the maintainers

Copy link
Contributor

@sea-bass sea-bass left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you for this!

I'm wondering, how is this logic different from what is already in e.g.

const bool command_stale = (node_->now() - latest_joint_jog_.header.stamp) >=
rclcpp::Duration::from_seconds(servo_params_.incoming_command_timeout);
if (!command_stale)
{
JointJogCommand command{ latest_joint_jog_.joint_names, latest_joint_jog_.velocities };
next_joint_state = servo_->getNextJointState(robot_state, command);
}
else
{
auto result = servo_->smoothHalt(last_commanded_state_);
new_joint_jog_msg_ = !result.first;
if (new_joint_jog_msg_)
{
next_joint_state = result.second;
RCLCPP_DEBUG_STREAM(node_->get_logger(), "Joint jog command timed out. Halting to a stop.");
}
}
?

Would you be able to instead fix the existing logic instead of adding new lines of code?

@KazuyaOguma18
Copy link
Author

@sea-bass
Thank you for reviewing!

Would you be able to instead fix the existing logic instead of adding new lines of code?

Yes, I can. Is it correct to write the added code when command_stale in jog, twist and pose fuction is true?

@sea-bass
Copy link
Contributor

Yes, I can. Is it correct to write the added code when command_stale in jog, twist and pose fuction is true?

Exactly! It would also be appreciated if you could write a unit test for this logic, to verify the fixes.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants