-
Notifications
You must be signed in to change notification settings - Fork 1
Add trajectory pausable behaviour #7
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
base: main
Are you sure you want to change the base?
Conversation
372f2b8
to
c1d00f0
Compare
c1d00f0
to
c535c9b
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
First pass
goal.goal_time_tolerance = rclcpp::Duration::from_seconds(time_tolerance); | ||
|
||
// Send goal with feedback callback | ||
typename rclcpp_action::Client<FollowJointTrajectory>::SendGoalOptions options; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why is this typename
? That shouldn't be needed.
} | ||
catch (const rclcpp_action::exceptions::UnknownGoalHandleError& e) | ||
{ | ||
RCLCPP_WARN(rclcpp::get_logger("ExecuteAndTrackJointTrajectory"), "Failed to cancel goal: %s", e.what()); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This should probably be an error if we can't pause the joint trajectory?
const std::shared_ptr<const FollowJointTrajectory::Feedback> feedback) | ||
{ | ||
last_feedback_time_ = feedback->desired.time_from_start.sec + feedback->desired.time_from_start.nanosec * 1e-9; | ||
setOutput<double>("time_from_start", last_feedback_time_); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Do we have to set time_from_start
every time the feedback is processed or only when the trajectory is paused?
for (; start_index < full_trajectory_.points.size(); ++start_index) | ||
{ | ||
double t = full_trajectory_.points[start_index].time_from_start.sec + | ||
full_trajectory_.points[start_index].time_from_start.nanosec * 1e-9; | ||
if (t >= last_feedback_time_) | ||
break; | ||
} | ||
if (start_index >= full_trajectory_.points.size()) | ||
return new_traj; | ||
|
||
double offset = full_trajectory_.points[start_index].time_from_start.sec + | ||
full_trajectory_.points[start_index].time_from_start.nanosec * 1e-9; | ||
for (size_t i = start_index; i < full_trajectory_.points.size(); ++i) | ||
{ | ||
auto pt = full_trajectory_.points[i]; | ||
double orig = pt.time_from_start.sec + pt.time_from_start.nanosec * 1e-9; | ||
double adjusted = orig - offset; | ||
pt.time_from_start.sec = static_cast<uint32_t>(adjusted); | ||
pt.time_from_start.nanosec = static_cast<uint32_t>((adjusted - pt.time_from_start.sec) * 1e9); | ||
new_traj.points.push_back(pt); | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Some additional here would make this could easier to grok.
Can we get this month old PR merged in? |
Use this objective to test in lab_sim:
And call
ros2 service call /pause_trajectory std_srvs/srv/Trigger
during playback (see video)screencap-2025-05-05_07.12.04.mp4