Allows a user to control the force or stiffness applied by joints. More...
#include <ee_cart_imped_control.hpp>
Classes | |
class | EECartImpedData |
Class for storing a trajectory and associated information. More... | |
Public Member Functions | |
bool | init (pr2_mechanism_model::RobotState *robot, ros::NodeHandle &n) |
Controller initialization in non-realtime. | |
void | starting () |
Controller startup in realtime. | |
void | stopping () |
Controller stopping in realtime. | |
void | update () |
Controller update loop in realtime. | |
Private Types | |
typedef std::vector < ee_cart_imped_msgs::StiffPoint > | EECartImpedTraj |
Private Member Functions | |
void | commandCB (const ee_cart_imped_msgs::EECartImpedGoalConstPtr &msg) |
Callback when a new goal is received. | |
double | linearlyInterpolate (double time, double startTime, double endTime, double startValue, double endValue) |
Linearly interpolates between trajectory points. | |
ee_cart_imped_msgs::StiffPoint | sampleInterpolation () |
Samples the interpolation and returns the point the joints should currently be trying to achieve. | |
Private Attributes | |
pr2_mechanism_model::Chain | chain_ |
The chain of links and joints in PR2 language for reference and commanding. | |
boost::scoped_ptr < realtime_tools::RealtimePublisher < ee_cart_imped_msgs::EECartImpedFeedback > > | controller_state_publisher_ |
State publisher, published every 10 updates. | |
realtime_tools::RealtimeBox < boost::shared_ptr< const EECartImpedData > > | desired_poses_box_ |
Desired positions. | |
KDL::Wrench | F_ |
Cartesian effort. | |
KDL::Wrench | Fdes_ |
Desired Cartesian force. | |
KDL::Jacobian | J_ |
Jacobian. | |
boost::scoped_ptr < KDL::ChainJntToJacSolver > | jnt_to_jac_solver_ |
KDL Solver performing the joint angles to Jacobian calculation. | |
boost::scoped_ptr < KDL::ChainFkSolverPos > | jnt_to_pose_solver_ |
KDL Solver performing the joint angles to Cartesian pose calculation. | |
KDL::Twist | Kd_ |
Derivative gains. | |
KDL::Chain | kdl_chain_ |
The chain of links and joints in KDL language. | |
KDL::Twist | Kp_ |
Proportional gains. | |
double | last_goal_starting_time_ |
The time at which the goal we saw on the last iteration was started. | |
ee_cart_imped_msgs::StiffPoint | last_point_ |
The actual position of the robot when we achieved the last point on the trajectory. | |
ros::Time | last_time_ |
Time of the last servo cycle. | |
ros::NodeHandle | node_ |
KDL::JntArray | q_ |
Joint positions. | |
KDL::JntArrayVel | qdot_ |
Joint velocities. | |
pr2_mechanism_model::Chain | read_only_chain_ |
The chain of links and joints in PR2 language for reference only. | |
pr2_mechanism_model::RobotState * | robot_state_ |
The current robot state. | |
ros::Subscriber | subscriber_ |
KDL::JntArray | tau_ |
Joint torques. | |
KDL::JntArray | tau_act_ |
int | updates_ |
The number of updates to the joint position. | |
KDL::Frame | x_ |
Tip pose. | |
KDL::Frame | xd_ |
Tip desired pose. | |
KDL::Twist | xdot_ |
Cartesian velocity. | |
KDL::Twist | xerr_ |
Cartesian error. |
Allows a user to control the force or stiffness applied by joints.
This class contains the realtime controller for controlling joints by stiffness or force. To use this controller, you should use the action wrapper, EECartImpedAction.
Definition at line 41 of file ee_cart_imped_control.hpp.
typedef std::vector<ee_cart_imped_msgs::StiffPoint> ee_cart_imped_control_ns::EECartImpedControlClass::EECartImpedTraj [private] |
Definition at line 106 of file ee_cart_imped_control.hpp.
void EECartImpedControlClass::commandCB | ( | const ee_cart_imped_msgs::EECartImpedGoalConstPtr & | msg | ) | [private] |
Callback when a new goal is received.
Cancels the currently active goal (if there is one), restarts the controller and asks it to execute the new goal.
msg | the new goal |
Definition at line 169 of file ee_cart_imped_control.cpp.
bool EECartImpedControlClass::init | ( | pr2_mechanism_model::RobotState * | robot, |
ros::NodeHandle & | n | ||
) | [virtual] |
Controller initialization in non-realtime.
Initializes the controller on first startup. Prepares the kinematics, pre-allocates the variables, subscribes to command and advertises state.
robot | The current robot state |
n | A node handle for subscribing and advertising topics |
Implements pr2_controller_interface::Controller.
Definition at line 212 of file ee_cart_imped_control.cpp.
double EECartImpedControlClass::linearlyInterpolate | ( | double | time, |
double | startTime, | ||
double | endTime, | ||
double | startValue, | ||
double | endValue | ||
) | [private] |
Linearly interpolates between trajectory points.
Linearly interpolates between startValue and endValue over the time period startTime to endTime of the current goal.
time | [seconds] that this goal has been running |
startTime | time that the goal began running |
endTime | time that the goal should finish running |
startValue | the values at the beginning of the interpolation (i.e. the values at startTime) |
endValue | the values at the end of the interpolation (i.e. the values at endTime) |
Definition at line 13 of file ee_cart_imped_control.cpp.
Samples the interpolation and returns the point the joints should currently be trying to achieve.
Samples the interpolation, using EECartImpedControlClass::linearlyInterpolate, between the current trajectory point and the next trajectory point. Interpolation is done for position and orientation, but not for wrench or stiffness as generally it is desired that wrench or stiffness be constant over a specific trajectory segment.
Definition at line 24 of file ee_cart_imped_control.cpp.
void EECartImpedControlClass::starting | ( | ) | [virtual] |
Controller startup in realtime.
Resets the controller to prepare for a new goal. Sets the desired position and orientation to be the current position and orientation and sets the joints to have maximum stiffness so that they hold their current position.
Hold current position trajectory
Reimplemented from pr2_controller_interface::Controller.
Definition at line 291 of file ee_cart_imped_control.cpp.
void EECartImpedControlClass::stopping | ( | ) | [virtual] |
Controller stopping in realtime.
Calls EECartImpedControlClass::starting() to lock the joints into their current position.
Reimplemented from pr2_controller_interface::Controller.
Definition at line 502 of file ee_cart_imped_control.cpp.
void EECartImpedControlClass::update | ( | void | ) | [virtual] |
Controller update loop in realtime.
A PD controller for achieving the trajectory. Uses EECartImpedControlClass::sampleInterpolation to find the point that should be achieved on the current timestep. Converts this point (which is in Cartesian coordinates) to joint angles and uses a PD update (in the case of stiffness) to send to the joints the correct force.
Implements pr2_controller_interface::Controller.
Definition at line 343 of file ee_cart_imped_control.cpp.
The chain of links and joints in PR2 language for reference and commanding.
Definition at line 50 of file ee_cart_imped_control.hpp.
boost::scoped_ptr< realtime_tools::RealtimePublisher< ee_cart_imped_msgs::EECartImpedFeedback> > ee_cart_imped_control_ns::EECartImpedControlClass::controller_state_publisher_ [private] |
State publisher, published every 10 updates.
Definition at line 201 of file ee_cart_imped_control.hpp.
realtime_tools::RealtimeBox< boost::shared_ptr<const EECartImpedData> > ee_cart_imped_control_ns::EECartImpedControlClass::desired_poses_box_ [private] |
Desired positions.
Definition at line 127 of file ee_cart_imped_control.hpp.
Cartesian effort.
Definition at line 94 of file ee_cart_imped_control.hpp.
Desired Cartesian force.
Definition at line 97 of file ee_cart_imped_control.hpp.
Definition at line 100 of file ee_cart_imped_control.hpp.
boost::scoped_ptr<KDL::ChainJntToJacSolver> ee_cart_imped_control_ns::EECartImpedControlClass::jnt_to_jac_solver_ [private] |
KDL Solver performing the joint angles to Jacobian calculation.
Definition at line 63 of file ee_cart_imped_control.hpp.
boost::scoped_ptr<KDL::ChainFkSolverPos> ee_cart_imped_control_ns::EECartImpedControlClass::jnt_to_pose_solver_ [private] |
KDL Solver performing the joint angles to Cartesian pose calculation.
Definition at line 60 of file ee_cart_imped_control.hpp.
Derivative gains.
Definition at line 140 of file ee_cart_imped_control.hpp.
The chain of links and joints in KDL language.
Definition at line 56 of file ee_cart_imped_control.hpp.
Proportional gains.
Definition at line 137 of file ee_cart_imped_control.hpp.
The time at which the goal we saw on the last iteration was started.
Definition at line 104 of file ee_cart_imped_control.hpp.
ee_cart_imped_msgs::StiffPoint ee_cart_imped_control_ns::EECartImpedControlClass::last_point_ [private] |
The actual position of the robot when we achieved the last point on the trajectory.
Definition at line 131 of file ee_cart_imped_control.hpp.
Time of the last servo cycle.
Definition at line 145 of file ee_cart_imped_control.hpp.
Definition at line 176 of file ee_cart_imped_control.hpp.
KDL::JntArray ee_cart_imped_control_ns::EECartImpedControlClass::q_ [private] |
Joint positions.
Definition at line 71 of file ee_cart_imped_control.hpp.
Joint velocities.
Definition at line 74 of file ee_cart_imped_control.hpp.
pr2_mechanism_model::Chain ee_cart_imped_control_ns::EECartImpedControlClass::read_only_chain_ [private] |
The chain of links and joints in PR2 language for reference only.
Definition at line 53 of file ee_cart_imped_control.hpp.
pr2_mechanism_model::RobotState* ee_cart_imped_control_ns::EECartImpedControlClass::robot_state_ [private] |
The current robot state.
Definition at line 47 of file ee_cart_imped_control.hpp.
Definition at line 177 of file ee_cart_imped_control.hpp.
KDL::JntArray ee_cart_imped_control_ns::EECartImpedControlClass::tau_ [private] |
Joint torques.
Definition at line 77 of file ee_cart_imped_control.hpp.
KDL::JntArray ee_cart_imped_control_ns::EECartImpedControlClass::tau_act_ [private] |
Definition at line 77 of file ee_cart_imped_control.hpp.
The number of updates to the joint position.
Definition at line 205 of file ee_cart_imped_control.hpp.
Tip pose.
Definition at line 81 of file ee_cart_imped_control.hpp.
Tip desired pose.
Definition at line 84 of file ee_cart_imped_control.hpp.
Cartesian velocity.
Definition at line 91 of file ee_cart_imped_control.hpp.
Cartesian error.
Definition at line 88 of file ee_cart_imped_control.hpp.