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

Fix jumps in motion control handle #213

Merged
merged 2 commits into from
Oct 18, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 12 additions & 2 deletions cartesian_controller_handles/src/motion_control_handle.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -89,6 +89,15 @@ controller_interface::return_type MotionControlHandle::update(const rclcpp::Time
controller_interface::return_type MotionControlHandle::update()
#endif
{
if (m_current_pose.header.frame_id != m_robot_base_link && m_current_pose.header.frame_id != "")
{
RCLCPP_ERROR(
get_node()->get_logger(),
"The reference frame \"%s\" selected in Rviz is not a fixed frame. Please select a "
"fixed frame.",
m_current_pose.header.frame_id.c_str());
return controller_interface::return_type::ERROR;
}
// Publish marker pose
m_current_pose.header.stamp = get_node()->now();
m_current_pose.header.frame_id = m_robot_base_link;
Expand Down Expand Up @@ -248,12 +257,13 @@ void MotionControlHandle::updateMotionControlCallback(
const visualization_msgs::msg::InteractiveMarkerFeedback::ConstSharedPtr & feedback)
{
// Move marker in RViz
m_server->setPose(feedback->marker_name, feedback->pose);
m_server->setPose(feedback->marker_name, feedback->pose, feedback->header);
m_server->applyChanges();

// Store for later broadcasting
m_current_pose.pose = feedback->pose;
m_current_pose.header.stamp = get_node()->now();
m_current_pose.header.frame_id = feedback->header.frame_id;
m_current_pose.header.stamp = feedback->header.stamp;
}

void MotionControlHandle::updateMarkerMenuCallback(
Expand Down
Loading