Skip to content
Open
Show file tree
Hide file tree
Changes from 2 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
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@

#include <memory>
#include <string>
#include <utility>
#include <vector>

#include "rclcpp/logging.hpp"
Expand Down Expand Up @@ -117,6 +118,45 @@ class KinematicsInterface
const Eigen::VectorXd & joint_pos, const std::string & link_name,
Eigen::Matrix<double, Eigen::Dynamic, 6> & jacobian_inverse) = 0;

/**
* \brief Convert Cartesian pose to the closest joint state using inverse kinematics.
*/
virtual bool convert_cartesian_pose_to_closest_joint_state(
const Eigen::Isometry3d & /*pose*/, const std::vector<double> & /*current_joint_state*/,
std::vector<double> & /*joint_state*/)
{
return false;
}

/**
* \brief Convert Cartesian pose to joint state within specified ranges using inverse kinematics.
*/
virtual bool convert_cartesian_pose_to_joint_state_within_range(
const Eigen::Isometry3d & /*pose*/,
const std::vector<std::pair<double, double>> & /*joint_ranges*/,
std::vector<double> & /*joint_state*/)
{
return false;
}

/**
* \brief Convert Cartesian pose to all possible joint states using inverse kinematics.
*/
virtual bool convert_cartesian_pose_to_possible_joint_states(
const Eigen::Isometry3d & /*pose*/, std::vector<std::vector<double>> & /*joint_states*/)
{
return false;
}

/**
* \brief Convert joint state to Cartesian pose using forward kinematics.
*/
virtual bool convert_joint_state_to_cartesian_pose(

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Isn't this the same as calculate_link_transform? I don't think that this is compatible with the current API if we don't pass the link_name.

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

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

Yes that is true thanks for pointing. I have removed it.

const std::vector<double> & /*joint_state*/, Eigen::Isometry3d & /*pose*/)
{
return false;
}

/**
* \brief Calculates the difference between two Cartesian frames
* \param[in] x_a first Cartesian frame (x, y, z, qx, qy, qz, qw)
Expand All @@ -128,7 +168,7 @@ class KinematicsInterface
* \note This method is independent of robot kinematics and the model loaded to the plugin
*/
virtual bool calculate_frame_difference(
Eigen::Matrix<double, 7, 1> & x_a, Eigen::Matrix<double, 7, 1> & x_b, double dt,
const Eigen::Matrix<double, 7, 1> & x_a, const Eigen::Matrix<double, 7, 1> & x_b, double dt,
Eigen::Matrix<double, 6, 1> & delta_x) = 0;

bool convert_cartesian_deltas_to_joint_deltas(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@ class KinematicsInterfaceKDL : public kinematics_interface::KinematicsInterface
Eigen::Matrix<double, Eigen::Dynamic, 6> & jacobian_inverse) override;

bool calculate_frame_difference(
Eigen::Matrix<double, 7, 1> & x_a, Eigen::Matrix<double, 7, 1> & x_b, double dt,
const Eigen::Matrix<double, 7, 1> & x_a, const Eigen::Matrix<double, 7, 1> & x_b, double dt,
Eigen::Matrix<double, 6, 1> & delta_x) override;

private:
Expand Down
2 changes: 1 addition & 1 deletion kinematics_interface_kdl/src/kinematics_interface_kdl.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -242,7 +242,7 @@ bool KinematicsInterfaceKDL::calculate_link_transform(
}

bool KinematicsInterfaceKDL::calculate_frame_difference(
Eigen::Matrix<double, 7, 1> & x_a, Eigen::Matrix<double, 7, 1> & x_b, double dt,
const Eigen::Matrix<double, 7, 1> & x_a, const Eigen::Matrix<double, 7, 1> & x_b, double dt,
Eigen::Matrix<double, 6, 1> & delta_x)
{
// verify inputs
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@ class KinematicsInterfacePinocchio : public kinematics_interface::KinematicsInte
Eigen::Matrix<double, Eigen::Dynamic, 6> & jacobian_inverse) override;

bool calculate_frame_difference(
Eigen::Matrix<double, 7, 1> & x_a, Eigen::Matrix<double, 7, 1> & x_b, double dt,
const Eigen::Matrix<double, 7, 1> & x_a, const Eigen::Matrix<double, 7, 1> & x_b, double dt,
Eigen::Matrix<double, 6, 1> & delta_x) override;

private:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -382,7 +382,7 @@ bool KinematicsInterfacePinocchio::calculate_link_transform(
}

bool KinematicsInterfacePinocchio::calculate_frame_difference(
Eigen::Matrix<double, 7, 1> & x_a, Eigen::Matrix<double, 7, 1> & x_b, double dt,
const Eigen::Matrix<double, 7, 1> & x_a, const Eigen::Matrix<double, 7, 1> & x_b, double dt,
Eigen::Matrix<double, 6, 1> & delta_x)
{
// verify inputs
Expand Down
Loading