robot_env_evaluator 1.0.1
Loading...
Searching...
No Matches
robot_env_evaluator.hpp
Go to the documentation of this file.
1
20#ifndef ROBOT_ENV_EVALUATOR_ROBOT_ENV_EVALUATOR_HPP
21#define ROBOT_ENV_EVALUATOR_ROBOT_ENV_EVALUATOR_HPP
22
23#include <pinocchio/multibody/model.hpp>
24#include <pinocchio/multibody/data.hpp>
25#include <pinocchio/multibody/geometry.hpp>
26
27#include <vector>
28#include <string>
29#include <variant>
30
31namespace robot_env_evaluator
32{
39 using Obstacle = std::variant<coal::Sphere>;
40
45 Obstacle obstacle;
46 Eigen::Matrix4d obstacle_pose;
47 };
48
53 int id;
54 double distance;
55 Eigen::Vector3d normal_vector;
56 Eigen::Vector3d nearest_point_on_robot;
57 Eigen::Vector3d nearest_point_on_object;
58 std::string contacted_robot_link;
59 Eigen::VectorXd projector_jointspace_to_dist;
60 Eigen::VectorXd projector_dist_to_jointspace;
61 };
62
83 public:
97 RobotEnvEvaluator(const pinocchio::Model& model,
98 const std::string& ee_name,
99 const std::vector<std::string>& joint_names,
100 const pinocchio::GeometryModel& collision_model,
101 const pinocchio::GeometryModel& visual_model = pinocchio::GeometryModel());
102
108
119 void forwardKinematics(const Eigen::VectorXd& q,
120 Eigen::Matrix4d& T,
121 const int joint_index = -1);
122
132 void forwardKinematicsByFrameName(const Eigen::VectorXd& q,
133 Eigen::Matrix4d& T,
134 const std::string& frame_name);
135
146 void jacobian(const Eigen::VectorXd& q,
147 Eigen::MatrixXd& J,
148 const int joint_index = -1);
149
157 void jacobianByFrameName(const Eigen::VectorXd& q,
158 Eigen::MatrixXd& J,
159 const std::string& frame_name);
160
168 void computeDistances(const Eigen::VectorXd& q,
169 const std::vector<obstacleInput>& obstacles,
170 std::vector<distanceResult>& distances);
171
172 // configurations
176 double robust_pinv_lambda_ = 0.001;
177
178 protected:
189 void jacobianFrame(const Eigen::VectorXd& q,
190 const double frame_index,
191 Eigen::MatrixXd& J);
192
201 void computeModelData(const Eigen::VectorXd& q);
202
203 // buffers
204 Eigen::VectorXd buffered_q_;
205
206 pinocchio::Model model_;
207 pinocchio::Data data_;
208 pinocchio::GeometryModel collision_model_;
209 pinocchio::GeometryModel visual_model_;
211 std::vector<double> joint_indices_;
212
213 pinocchio::GeometryModel geom_model_;
214 pinocchio::GeometryData geom_data_;
215 };
216} // namespace robot_env_evaluator
217
218#endif // ROBOT_ENV_EVALUATOR_ROBOT_ENV_EVALUATOR_HPP
The main functionality class, which provides functionalities for evaluating robot environment informa...
void forwardKinematics(const Eigen::VectorXd &q, Eigen::Matrix4d &T, const int joint_index=-1)
The forward kinematics function for a specific joint, specified by the index.
pinocchio::Data data_
The robot data, initialized from the model.
void jacobianFrame(const Eigen::VectorXd &q, const double frame_index, Eigen::MatrixXd &J)
Get the Jacobian of specific frame.
bool calculate_self_collision_
Whether to calculate self-collision in distance computation.
Eigen::VectorXd buffered_q_
The buffered joint configuration. This is used to avoid unnecessary computation.
void forwardKinematicsByFrameName(const Eigen::VectorXd &q, Eigen::Matrix4d &T, const std::string &frame_name)
The forward kinematics function for a specific frame, specified by the name.
void computeModelData(const Eigen::VectorXd &q)
Compute the model data from the joint configuration.
double robust_pinv_lambda_
The lambda value for the robust pseudo-inverse projector.
pinocchio::GeometryModel visual_model_
The visual model.
bool projector_dist_to_control_with_zero_orientation_
Whether to use the full Jacobian and set the orientation to zero when calculating the projector.
bool projector_dist_to_control_enable_
Whether to calculate the projector from distance to control space.
~RobotEnvEvaluator()=default
Destroy the Robot Env Evaluator object.
void jacobianByFrameName(const Eigen::VectorXd &q, Eigen::MatrixXd &J, const std::string &frame_name)
Get the jacobian of specific frame, specified by the name.
pinocchio::GeometryData geom_data_
The geometry data for collision computation.
int ee_index_
The internal index for end-effector.frame.
std::vector< double > joint_indices_
The joint indices for the robot model.
void computeDistances(const Eigen::VectorXd &q, const std::vector< obstacleInput > &obstacles, std::vector< distanceResult > &distances)
The distance computation function between the robot and obstacles.
pinocchio::GeometryModel collision_model_
The collision model.
void jacobian(const Eigen::VectorXd &q, Eigen::MatrixXd &J, const int joint_index=-1)
The jacobian function for a specific joint, specified by the index.
pinocchio::GeometryModel geom_model_
The geometry model for collision computation.
pinocchio::Model model_
The robot model.
std::variant< coal::Sphere > Obstacle
The Obstacle class, a variant of different coal primitive shapes.
Store the distance result between objects.
Store the obstacle and its pose in the world frame.