37 #ifndef PR2_CONTROLLERS_JT_CARTESIAN_CONTROLLER_H 38 #define PR2_CONTROLLERS_JT_CARTESIAN_CONTROLLER_H 41 #include <Eigen/Geometry> 48 #include <kdl/chainfksolver.hpp> 49 #include <kdl/chainfksolverpos_recursive.hpp> 50 #include <kdl/chain.hpp> 51 #include <kdl/chainjnttojacsolver.hpp> 52 #include <kdl/frames.hpp> 58 #include <geometry_msgs/PoseStamped.h> 59 #include <geometry_msgs/TwistStamped.h> 60 #include <robot_mechanism_controllers/JTCartesianControllerState.h> 68 typedef Eigen::Matrix<double, Joints, 1>
JointVec;
69 typedef Eigen::Matrix<double, 6, Joints>
Jacobian;
80 void fk(
const JointVec &q, Eigen::Affine3d &x)
87 void jac(
const JointVec &q, Jacobian &J)
111 typedef robot_mechanism_controllers::JTCartesianControllerState
StateMsg;
138 boost::scoped_ptr<Kin<Joints> >
kin_;
139 Eigen::Matrix<double,6,1>
Kp, Kd;
159 void setGains(
const std_msgs::Float64MultiArray::ConstPtr &msg)
161 if (msg->data.size() >= 6)
162 for (
size_t i = 0; i < 6; ++i)
163 Kp[i] = msg->data[i];
164 if (msg->data.size() == 12)
165 for (
size_t i = 0; i < 6; ++i)
166 Kd[i] = msg->data[6+i];
168 ROS_INFO(
"New gains: %.1lf, %.1lf, %.1lf %.1lf, %.1lf, %.1lf",
169 Kp[0], Kp[1], Kp[2], Kp[3], Kp[4], Kp[5]);
174 if (msg->data.size() == 0) {
175 use_posture_ =
false;
178 else if ((
int)msg->data.size() != q_posture_.size()) {
179 ROS_ERROR(
"Posture message had the wrong size: %d", (
int)msg->data.size());
185 for (
int j = 0; j < Joints; ++j)
186 q_posture_[j] = msg->data[j];
190 void commandPose(
const geometry_msgs::PoseStamped::ConstPtr &command)
192 geometry_msgs::PoseStamped in_root;
199 ROS_ERROR(
"Failed to transform: %s", ex.what());
KDL::ChainFkSolverPos_recursive fk_solver_
virtual int JntToCart(const JntArray &q_in, Frame &p_out, int segmentNr=-1)
EIGEN_MAKE_ALIGNED_OPERATOR_NEW
void fk(const JointVec &q, Eigen::Affine3d &x)
void poseMsgToEigen(const geometry_msgs::Pose &m, Eigen::Affine3d &e)
double vel_saturation_trans_
realtime_tools::RealtimePublisher< geometry_msgs::PoseStamped > pub_x_desi_
void commandPosture(const std_msgs::Float64MultiArray::ConstPtr &msg)
double jacobian_inverse_damping_
pr2_mechanism_model::Chain chain_
realtime_tools::RealtimePublisher< StateMsg > pub_state_
double pose_command_filter_
Eigen::Matrix< double, 6, 1 > Kp
void update(const std::string &key, const XmlRpc::XmlRpcValue &v)
EIGEN_MAKE_ALIGNED_OPERATOR_NEW Eigen::Matrix< double, 6, Eigen::Dynamic > data
void setGains(const std_msgs::Float64MultiArray::ConstPtr &msg)
tf::TransformListener tf_
Eigen::Affine3d last_pose_
void jac(const JointVec &q, Jacobian &J)
Eigen::Matrix< double, 6, Joints > Jacobian
virtual int JntToJac(const JntArray &q_in, Jacobian &jac, int segmentNR=-1)
ros::Subscriber sub_gains_
Eigen::Matrix< double, 6, 1 > CartVec
Kin(const KDL::Chain &kdl_chain)
Eigen::Matrix< double, Joints, 1 > JointVec
ros::Subscriber sub_posture_
Eigen::Matrix< double, 6, Joints > Jacobian
ros::Subscriber sub_pose_
void transformKDLToEigen(const KDL::Frame &k, Eigen::Affine3d &e)
robot_mechanism_controllers::JTCartesianControllerState StateMsg
pr2_mechanism_model::RobotState * robot_state_
boost::scoped_ptr< Kin< Joints > > kin_
if((endptr==val_str)||(endptr< (val_str+strlen(val_str))))
KDL::ChainJntToJacSolver jac_solver_
Eigen::Affine3d x_desi_filtered_
void commandPose(const geometry_msgs::PoseStamped::ConstPtr &command)
Eigen::Matrix< double, Joints, 1 > JointVec