|
| 1 | +/* |
| 2 | + * Copyright (C) 2023 Istituto Italiano di Tecnologia (IIT) |
| 3 | + * |
| 4 | + * This software may be modified and distributed under the terms of the |
| 5 | + * MIT license. See the accompanying LICENSE file for details. |
| 6 | + */ |
| 7 | + |
| 8 | +#ifndef DIFFERENTIAL_INVERSE_KINEMATICS_H |
| 9 | +#define DIFFERENTIAL_INVERSE_KINEMATICS_H |
| 10 | + |
| 11 | +#include <Eigen/Dense> |
| 12 | +#include <optional> |
| 13 | + |
| 14 | +/** |
| 15 | + * Abstract class representing the differential inverse kinematics of a kinematic chain. |
| 16 | + */ |
| 17 | +class DifferentialInverseKinematics |
| 18 | +{ |
| 19 | +public: |
| 20 | + virtual ~DifferentialInverseKinematics() = default; |
| 21 | + |
| 22 | + /** |
| 23 | + * Evaluate the reference joints velocities that drive the robot end-effector towards the desired transform. |
| 24 | + * @return The reference velocities that realize the inverse kinematics in radian/s. |
| 25 | + * @warning This method should be called only after setting the current robot state via DifferentialInverseKinematics::set_robot_state() |
| 26 | + * and the desired end-effector transform via DifferentialInverseKinematics::set_desired_ee_transform(). |
| 27 | + */ |
| 28 | + virtual std::optional<Eigen::VectorXd> eval_reference_velocities() = 0; |
| 29 | + |
| 30 | + /** |
| 31 | + * Set the current robot state. |
| 32 | + * @param joints The current joint configuration \f$ q \f$. |
| 33 | + * @param transform The current end-effector transformation. |
| 34 | + * @param jacobian The current end-effector Jacobian. |
| 35 | + */ |
| 36 | + virtual void set_robot_state( |
| 37 | + const Eigen::Ref<const Eigen::VectorXd> &joints, |
| 38 | + const Eigen::Ref<const Eigen::VectorXd> &joints_vel, |
| 39 | + const Eigen::Transform<double, 3, Eigen::Affine> &transform, |
| 40 | + const Eigen::Ref<const Eigen::MatrixXd> &jacobian) = 0; |
| 41 | + |
| 42 | + /** |
| 43 | + * Set the desired root to end-effector transform. |
| 44 | + * @param transform The desired end-effector transformation. |
| 45 | + */ |
| 46 | + virtual void set_desired_ee_transform(const Eigen::Transform<double, 3, Eigen::Affine> &transform) = 0; |
| 47 | + |
| 48 | + /** |
| 49 | + * Set the joints limits. |
| 50 | + * @param lower_limits The joint lower limits \f$q_{L}\f$. |
| 51 | + * @param upper_limits The joint upper limits \f$q_{U}\f$. |
| 52 | + * @param gains The joint limits gains \f$K_l\f$. |
| 53 | + */ |
| 54 | + virtual void set_joint_limits( |
| 55 | + const Eigen::Ref<const Eigen::VectorXd> &lower_limits, |
| 56 | + const Eigen::Ref<const Eigen::VectorXd> &upper_limits, |
| 57 | + const Eigen::Ref<const Eigen::VectorXd> &gains) = 0; |
| 58 | +}; |
| 59 | + |
| 60 | +#endif /* DIFFERENTIAL_INVERSE_KINEMATICS_H */ |
0 commit comments