Go to the documentation of this file.00001
00002
00003
00004
00005
00006
00007
00008 #ifndef CARTWRENCH_H_
00009 #define CARTWRENCH_H_
00010
00011 #include <rtt/TaskContext.hpp>
00012 #include <rtt/Port.hpp>
00013 #include <rtt/Logger.hpp>
00014
00015 #include <kdl/frames.hpp>
00016 #include <kdl/jntarray.hpp>
00017 #include <kdl/jacobian.hpp>
00018
00019 #include <lwr_fri/typekit/Types.h>
00020 #include <sensor_msgs/typekit/Types.h>
00021 #include <geometry_msgs/typekit/Types.h>
00022 #include <lwr_impedance_controller/CartesianImpedance.h>
00023
00024 #include <Eigen/Dense>
00025 #include <Eigen/Eigenvalues>
00026 #include <unsupported/Eigen/MatrixFunctions>
00027
00028 typedef Eigen::Matrix<double, 7, 6> Matrix76d;
00029 typedef Eigen::Matrix<double, 7, 7> Matrix77d;
00030 typedef Eigen::Matrix<double, 6, 6> Matrix66d;
00031 typedef Eigen::Matrix<double, 7, 1> Vector7d;
00032 typedef Eigen::Matrix<double, 6, 1> Vector6d;
00033
00034
00035 namespace lwr {
00036
00037 using namespace RTT;
00038
00039 class CartWrench : public RTT::TaskContext {
00040 public:
00041 CartWrench(const std::string& name);
00042 virtual ~CartWrench();
00043
00044 virtual bool configureHook();
00045 virtual bool startHook();
00046
00047 virtual void updateHook();
00048 virtual void stopHook();
00049 virtual void cleanupHook();
00050 private:
00051
00052 OutputPort<std::vector<double> > port_jnt_trq_cmd;
00053 OutputPort<lwr_fri::FriJointImpedance> port_joint_impedance_command;
00054 OutputPort<std::vector<double> > port_joint_position_command;
00055
00056 OutputPort<geometry_msgs::Pose> port_desired_cartesian_position;
00057
00058 InputPort<KDL::Jacobian> port_jacobian;
00059 InputPort<geometry_msgs::Pose> port_cart_pos_msr;
00060 InputPort<geometry_msgs::Pose> port_cartesian_position_command;
00061 InputPort<geometry_msgs::Pose> port_tool_frame;
00062 InputPort<lwr_impedance_controller::CartesianImpedance> port_cartesian_impedance_command;
00063 InputPort<geometry_msgs::Wrench> port_cartesian_wrench_command;
00064 InputPort<double> port_command_period;
00065 InputPort<std::vector<double> > port_jnt_pos_msr;
00066 InputPort<std::vector<double> > port_nullspace_torque_command;
00067 InputPort<Matrix77d> port_mass_matrix;
00068
00069 double dt;
00070 std::vector<double> jnt_trq_cmd;
00071 std::vector<double> jnt_pos;
00072 std::vector<double> null_trq_cmd;
00073 lwr_fri::FriJointImpedance imp;
00074 KDL::Jacobian jacobian;
00075 KDL::Frame tool_frame;
00076 lwr_impedance_controller::CartesianImpedance cartesian_impedance_command;
00077 geometry_msgs::Wrench cartesian_wrench_command;
00078
00079 geometry_msgs::Pose cart_pos_msr, cart_pos_cmd;
00080 KDL::Frame cart_pos_ref;
00081 KDL::Frame cart_pos_old;
00082
00083 Eigen::GeneralizedSelfAdjointEigenSolver<Matrix66d> es;
00084
00085 };
00086
00087 }
00088
00089 #endif