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

[Reference Only/Draft] joint_trajectory_controller convert trajectories to effort values #36

Closed
wants to merge 6 commits into from

Conversation

ddengster
Copy link
Contributor

@ddengster ddengster commented Apr 22, 2020

Used in conjunction with ros-simulation/gazebo_ros_pkgs#1083

The code changes in this PR was intended to work with a 'coffeebot' simulation in gazebo. It has lots of hacks, and is only meant to be an incomplete guide to porting to ROS2.

Things of note will be put in reviews.

Update: Also used with moveit2 training moveit/moveit2#187 with change 9a493a5

}
}

double period = lifecycle_node_->get_parameter("period").as_double();
Copy link
Contributor Author

Choose a reason for hiding this comment

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

This hack is supplied upstream from gazebo_ros_controls; ideally we should use something else.

double p = lifecycle_node_->get_parameter("gains." + joint_names_[j] + ".p").get_value<double>();
double d = lifecycle_node_->get_parameter("gains." + joint_names_[j] + ".d").get_value<double>();
double i = lifecycle_node_->get_parameter("gains." + joint_names_[j] + ".i").get_value<double>();
double iclamp = lifecycle_node_->get_parameter("gains." + joint_names_[j] + ".i_clamp").get_value<double>();
Copy link
Contributor Author

Choose a reason for hiding this comment

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

pid parameters are retrieved from the node.

f = pids_[index]->computeCommand(state_error.positions[index], state_error.velocities[index], rclcpp::Duration::from_seconds(period));

const double command = (state_desired.velocities[index] * velocity_ff_[index]) + f;
registered_joint_cmd_handles_[index]->set_cmd(command);
Copy link
Contributor Author

Choose a reason for hiding this comment

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

It took a significant amount of effort tracing down effort_controllers::JointTrajectoryController. But it boiled down to this code. I use control_toolbox::pid to convert the errors to effort values.

@bmagyar
Copy link
Member

bmagyar commented Apr 29, 2020

This PR can now be rebased (I've squashed the jtc PR, here you can do an interactive rebase and drop everything up to removed declareSegmentTolerances function

v-lopez pushed a commit to pal-robotics-forks/ros2_controllers that referenced this pull request Jun 10, 2020
@BasVolkers
Copy link

BasVolkers commented Dec 1, 2020

Hi, what is the status of this pull request?

I'm looking for a ROS2 replacement for effort_controllers/JointTrajectoryController, and I'm getting the feeling this pull request may contain what I'm looking for.

@destogl
Copy link
Member

destogl commented Jan 13, 2021

Because of API change, this is obsolete. It should be replaced by #140

@destogl destogl closed this Jan 13, 2021
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.

4 participants