-
Notifications
You must be signed in to change notification settings - Fork 367
Documentation for model-based controllers #1651
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: master
Are you sure you want to change the base?
Conversation
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.
Thank you very much for your proposal. But this is not at all related to ros2_control(lers), right? IMHO this does not fit to control.ros.org.
But it would be great to add such a control low to a generic ros2_controller implementation. Do you want to work in this direction? I'm not sure if your solver is better than pinocchio for example, convince us ;)
Hi @christophfroehlich, thank you very much for your feedback. With this PR, our goal is to invite other members of the ROS2 community to write model-based control laws, for which one should access the specific robot's dynamics model. You're right in mentioning Pinocchio: it is an example of a dynamics library to compute the dynamic matrices (inertia, coriolis, etc.), similar to KDL. However, both KDL and Pinocchio work on URDF descriptions, for which the Since all these classes are exported as plugins, one can choose the specific solver (KDL, Pinocchio, etc.) via configuration, and develop robot-agnostic controllers regardless of the particular implementation.
The solver's goal is not competing with Pinocchio: indeed, in the future we might use Pinocchio too, as I said above. // Initialize inverse dynamics solver class loader
inverse_dynamics_solver_loader_ = std::make_unique<InverseDynamicsSolverLoader>("inverse_dynamics_solver", "inverse_dynamics_solver::InverseDynamicsSolver");
// Load inverse dynamics solver plugin
inverse_dynamics_solver_ = inverse_dynamics_solver_loader_->createUniqueInstance("kdl_inverse_dynamics_solver/InverseDynamicsSolverKDL"); // or...
inverse_dynamics_solver_ = inverse_dynamics_solver_loader_->createUniqueInstance("ur10_inverse_dynamics_solver/InverseDynamicsSolverUR10"); // or...
inverse_dynamics_solver_ = inverse_dynamics_solver_loader_->createUniqueInstance("franka_inria_inverse_dynamics_solver/InverseDynamicsSolverFrankaINRIA"); // or...
inverse_dynamics_solver_ = inverse_dynamics_solver_loader_->createUniqueInstance("pinocchio_inverse_dynamics_solver/InverseDynamicsSolverPinocchio"); // ... or other plugins
// Initialize Inverse Dynamics Solver
inverse_dynamics_solver_->initialize(node_->get_node_parameters_interface(), "ns", robot_description_); // Initialize model with robot description and write the related control laws as suggested in this PR, i.e. Eigen::MatrixXd B = inverse_dynamics_solver_->getInertiaMatrix(position); // and other terms...
// Use B and other terms in the control law instead of being dependent on a specific (e.g. Pinocchio-based) implementation like pinocchio::Model model; // Create model here...
pinocchio::Data data;
pinocchio::crba(model, data, position);
data.M.triangularView<Eigen::StrictlyLower>() = data.M.transpose().triangularView<Eigen::StrictlyLower>();
Eigen::MatrixXd B = data.M;
// Use B and other terms in the control law In summary, based on your considerations:
Right, we are not proposing new controllers, but we are providing the right tool to write new model-based controllers in the future.
Yes, we are planning on working on new model-based controllers, using the solver we have developed, but we believe this PR might be an entry point for other users in the same direction ;) I hope this clarifies our proposal, please let me know what you think :) |
I still don't think this is the right place to put this. I have the feeling that announcing your solver should be posted in a discourse post instead. What do the other @ros-controls/ros2-maintainers think? It could fit better into a new page similar to the wheeled robot kinematics here. But still, this lacks any connection to ros2_controllers, at least a code snippet how to parse the robot description to parameterize the solver etc would be needed. |
@christophfroehlich sounds fair :) I can provide the necessary config parameters (in YAML) and code snippets to instantiate/working with the solver in C++ controllers, to facilitate the implementation of future model-based controllers. |
@v8p1197 I agree with @christophfroehlich I also don't feel this is where this should be reflected. Moreover, looking at the commits from the original repo : https://github.com/unisa-acg/inverse-dynamics-solver/commits/main/, it is not a mature project and it is not even a month old and we don't know who will maintain it and its future plans. I don't think it is the right moment or platform to endorse this approach or propose that the community start using it. |
This PR updates
ros2_controller
's documentation to open the possibility of creating model-based controllers, e.g. gravity compensantion PD controllers or inverse dynamics controllers.To access the robot dynamics model, the inverse dynamics solver is proposed (here the release repository).
The solver will be soon released via
rosdep
forhumble
(here the updatedrosdistro
index).