robot_env_evaluator 1.0.1
|
The main functionality class, which provides functionalities for evaluating robot environment information. More...
#include <robot_env_evaluator.hpp>
Public Member Functions | |
RobotEnvEvaluator (const pinocchio::Model &model, const std::string &ee_name, const std::vector< std::string > &joint_names, const pinocchio::GeometryModel &collision_model, const pinocchio::GeometryModel &visual_model=pinocchio::GeometryModel()) | |
Construct a new Robot Env Evaluator object. | |
~RobotEnvEvaluator ()=default | |
Destroy the Robot Env Evaluator object. | |
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. | |
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 | jacobian (const Eigen::VectorXd &q, Eigen::MatrixXd &J, const int joint_index=-1) |
The jacobian function for a specific joint, specified by the index. | |
void | jacobianByFrameName (const Eigen::VectorXd &q, Eigen::MatrixXd &J, const std::string &frame_name) |
Get the jacobian of specific frame, specified by the name. | |
void | computeDistances (const Eigen::VectorXd &q, const std::vector< obstacleInput > &obstacles, std::vector< distanceResult > &distances) |
The distance computation function between the robot and obstacles. | |
Public Attributes | |
bool | calculate_self_collision_ = false |
Whether to calculate self-collision in distance computation. | |
bool | projector_dist_to_control_enable_ = false |
Whether to calculate the projector from distance to control space. | |
bool | projector_dist_to_control_with_zero_orientation_ = false |
Whether to use the full Jacobian and set the orientation to zero when calculating the projector. | |
double | robust_pinv_lambda_ = 0.001 |
The lambda value for the robust pseudo-inverse projector. | |
Protected Member Functions | |
void | jacobianFrame (const Eigen::VectorXd &q, const double frame_index, Eigen::MatrixXd &J) |
Get the Jacobian of specific frame. | |
void | computeModelData (const Eigen::VectorXd &q) |
Compute the model data from the joint configuration. | |
Protected Attributes | |
Eigen::VectorXd | buffered_q_ |
The buffered joint configuration. This is used to avoid unnecessary computation. | |
pinocchio::Model | model_ |
The robot model. | |
pinocchio::Data | data_ |
The robot data, initialized from the model. | |
pinocchio::GeometryModel | collision_model_ |
The collision model. | |
pinocchio::GeometryModel | visual_model_ |
The visual model. | |
int | ee_index_ |
The internal index for end-effector.frame. | |
std::vector< double > | joint_indices_ |
The joint indices for the robot model. | |
pinocchio::GeometryModel | geom_model_ |
The geometry model for collision computation. | |
pinocchio::GeometryData | geom_data_ |
The geometry data for collision computation. | |
The main functionality class, which provides functionalities for evaluating robot environment information.
This class provides methods for forward kinematics, jacobian computation, and distance computation between the robot and obstacles in the environment. It uses the Pinocchio library for kinematics, the pinocchio's submodule coal for collision detection.
The initialization:
The functionalities include:
Definition at line 82 of file robot_env_evaluator.hpp.
robot_env_evaluator::RobotEnvEvaluator::RobotEnvEvaluator | ( | const pinocchio::Model & | model, |
const std::string & | ee_name, | ||
const std::vector< std::string > & | joint_names, | ||
const pinocchio::GeometryModel & | collision_model, | ||
const pinocchio::GeometryModel & | visual_model = pinocchio::GeometryModel() |
||
) |
Construct a new Robot Env Evaluator object.
[in] | model | The robot model |
[in] | ee_name | The end-effector name |
[in] | joint_names | The joint names |
[in] | collision_model | The collision model |
[in] | visual_model | The visual model |
These models are supposed to be loaded from URDF files, and then activate (also deactivate) the collision pairs. Also editing model is acceptable, therefore this class allows a flexible way to input them.
Definition at line 28 of file robot_env_evaluator.cpp.
void robot_env_evaluator::RobotEnvEvaluator::computeDistances | ( | const Eigen::VectorXd & | q, |
const std::vector< obstacleInput > & | obstacles, | ||
std::vector< distanceResult > & | distances | ||
) |
The distance computation function between the robot and obstacles.
[in] | q | The joint configuration |
[in] | obstacles | The obstacles in the world, including the shape and pose |
[out] | distances | The distances output between the robot and obstacles |
Definition at line 123 of file robot_env_evaluator.cpp.
|
protected |
Compute the model data from the joint configuration.
[in] | q | The joint configuration |
This function is used to check if the joint configuration is changed, if yes, the computation will be done.
Definition at line 226 of file robot_env_evaluator.cpp.
void robot_env_evaluator::RobotEnvEvaluator::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.
[in] | q | The joint configuration |
[out] | T | The transformation matrix of the joint |
[in] | joint_index | The joint index |
As pinocchio convention, the index 0 is the base joint, and the index 1 is the first joint, therefore 1 to length of [joint_names] in input is the real joint index. Default is -1, which means the end-effector.
Definition at line 56 of file robot_env_evaluator.cpp.
void robot_env_evaluator::RobotEnvEvaluator::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.
[in] | q | The joint configuration |
[out] | T | The transformation matrix of the joint |
[in] | frame_name | The frame name, could be joint or link |
The name will the defined by the robot URDF file.
Definition at line 73 of file robot_env_evaluator.cpp.
void robot_env_evaluator::RobotEnvEvaluator::jacobian | ( | const Eigen::VectorXd & | q, |
Eigen::MatrixXd & | J, | ||
const int | joint_index = -1 |
||
) |
The jacobian function for a specific joint, specified by the index.
[in] | q | The joint configuration |
[out] | J | The jacobian matrix of the joint |
[in] | joint_index | The joint index |
As pinocchio convention, the index 0 is the base joint, and the index 1 is the first joint, therefore 1 to length of [joint_names] in input is the real joint index. Default is -1, which means the end-effector.
Definition at line 86 of file robot_env_evaluator.cpp.
void robot_env_evaluator::RobotEnvEvaluator::jacobianByFrameName | ( | const Eigen::VectorXd & | q, |
Eigen::MatrixXd & | J, | ||
const std::string & | frame_name | ||
) |
Get the jacobian of specific frame, specified by the name.
[in] | q | The joint configuration |
[out] | J | The jacobian matrix of the joint |
[in] | frame_name | The frame name, could be joint or link |
Definition at line 102 of file robot_env_evaluator.cpp.
|
protected |
Get the Jacobian of specific frame.
[in] | q | The joint configuration |
[in] | frame_index | The frame index |
[out] | J | The output jacobian matrix |
Warning, direct use of this function is not recommended because it does not apply any safety check on the frame index. Use jacobianByFrameName() instead.
Definition at line 115 of file robot_env_evaluator.cpp.
|
protected |
The buffered joint configuration. This is used to avoid unnecessary computation.
Definition at line 204 of file robot_env_evaluator.hpp.
bool robot_env_evaluator::RobotEnvEvaluator::calculate_self_collision_ = false |
Whether to calculate self-collision in distance computation.
Definition at line 173 of file robot_env_evaluator.hpp.
|
protected |
The collision model.
Definition at line 208 of file robot_env_evaluator.hpp.
|
protected |
The robot data, initialized from the model.
Definition at line 207 of file robot_env_evaluator.hpp.
|
protected |
The internal index for end-effector.frame.
Definition at line 210 of file robot_env_evaluator.hpp.
|
protected |
The geometry data for collision computation.
Definition at line 214 of file robot_env_evaluator.hpp.
|
protected |
The geometry model for collision computation.
Definition at line 213 of file robot_env_evaluator.hpp.
|
protected |
The joint indices for the robot model.
Definition at line 211 of file robot_env_evaluator.hpp.
|
protected |
The robot model.
Definition at line 206 of file robot_env_evaluator.hpp.
bool robot_env_evaluator::RobotEnvEvaluator::projector_dist_to_control_enable_ = false |
Whether to calculate the projector from distance to control space.
Definition at line 174 of file robot_env_evaluator.hpp.
bool robot_env_evaluator::RobotEnvEvaluator::projector_dist_to_control_with_zero_orientation_ = false |
Whether to use the full Jacobian and set the orientation to zero when calculating the projector.
Definition at line 175 of file robot_env_evaluator.hpp.
double robot_env_evaluator::RobotEnvEvaluator::robust_pinv_lambda_ = 0.001 |
The lambda value for the robust pseudo-inverse projector.
Definition at line 176 of file robot_env_evaluator.hpp.
|
protected |
The visual model.
Definition at line 209 of file robot_env_evaluator.hpp.