cartesian_twist_controller.h
Go to the documentation of this file.
1 /*
2  * Copyright (c) 2008, Willow Garage, Inc.
3  * All rights reserved.
4  *
5  * Redistribution and use in source and binary forms, with or without
6  * modification, are permitted provided that the following conditions are met:
7  *
8  * * Redistributions of source code must retain the above copyright
9  * notice, this list of conditions and the following disclaimer.
10  * * Redistributions in binary form must reproduce the above copyright
11  * notice, this list of conditions and the following disclaimer in the
12  * documentation and/or other materials provided with the distribution.
13  * * Neither the name of the Willow Garage, Inc. nor the names of its
14  * contributors may be used to endorse or promote products derived from
15  * this software without specific prior written permission.
16  *
17  * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
18  * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
19  * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
20  * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
21  * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
22  * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
23  * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
24  * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
25  * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
26  * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
27  * POSSIBILITY OF SUCH DAMAGE.
28  */
29 
58 #ifndef CARTESIAN_TWIST_CONTROLLER_H
59 #define CARTESIAN_TWIST_CONTROLLER_H
60 
61 #include <vector>
62 #include <boost/scoped_ptr.hpp>
63 #include <boost/thread/condition.hpp>
64 
65 #include <ros/node_handle.h>
66 #include <geometry_msgs/Twist.h>
67 
68 #include <control_toolbox/pid.h>
69 #include <kdl/chainfksolver.hpp>
70 #include <kdl/chain.hpp>
71 #include <kdl/chainjnttojacsolver.hpp>
72 #include <kdl/frames.hpp>
76 #include <tf/transform_datatypes.h>
77 
78 
79 namespace controller {
80 
82 {
83 public:
86 
88 
89  void starting();
90  void update();
91 
92  // input of the controller
93  KDL::Twist twist_desi_, twist_meas_;
94 
95 private:
98  void command(const geometry_msgs::TwistConstPtr& twist_msg);
99  double ff_trans_, ff_rot_;
101 
102  // pid controllers
103  std::vector<control_toolbox::Pid> fb_pid_controller_;
104 
105  // robot description
108 
109  // kdl stuff for kinematics
110  KDL::Chain kdl_chain_;
111  boost::scoped_ptr<KDL::ChainFkSolverVel> jnt_to_twist_solver_;
112  boost::scoped_ptr<KDL::ChainJntToJacSolver> jac_solver_;
113  KDL::JntArrayVel jnt_posvel_;
114  KDL::JntArray jnt_eff_;
115  KDL::Jacobian jacobian_;
116  KDL::Wrench wrench_out_;
117 
118  geometry_msgs::Twist twist_msg_;
119 };
120 
121 } // namespace
122 
123 
124 #endif
realtime_publisher.h
node_handle.h
controller::CartesianTwistController::twist_desi_
KDL::Twist twist_desi_
Definition: cartesian_twist_controller.h:93
controller::CartesianTwistController::kdl_chain_
KDL::Chain kdl_chain_
Definition: cartesian_twist_controller.h:110
pr2_mechanism_model::Chain
controller::CartesianTwistController::jacobian_
KDL::Jacobian jacobian_
Definition: cartesian_twist_controller.h:115
controller::CartesianTwistController::starting
void starting()
Definition: cartesian_twist_controller.cpp:119
controller::CartesianTwistController::twist_msg_
geometry_msgs::Twist twist_msg_
Definition: cartesian_twist_controller.h:118
controller::CartesianTwistController::jnt_posvel_
KDL::JntArrayVel jnt_posvel_
Definition: cartesian_twist_controller.h:113
controller::CartesianTwistController::last_time_
ros::Time last_time_
Definition: cartesian_twist_controller.h:100
controller::CartesianTwistController::jac_solver_
boost::scoped_ptr< KDL::ChainJntToJacSolver > jac_solver_
Definition: cartesian_twist_controller.h:112
controller::CartesianTwistController
Definition: cartesian_twist_controller.h:81
controller::CartesianTwistController::wrench_out_
KDL::Wrench wrench_out_
Definition: cartesian_twist_controller.h:116
controller.h
controller
pr2_mechanism_model::RobotState
controller::CartesianTwistController::ff_trans_
double ff_trans_
Definition: cartesian_twist_controller.h:99
controller::CartesianTwistController::sub_command_
ros::Subscriber sub_command_
Definition: cartesian_twist_controller.h:97
controller::CartesianTwistController::node_
ros::NodeHandle node_
Definition: cartesian_twist_controller.h:96
controller::CartesianTwistController::chain_
pr2_mechanism_model::Chain chain_
Definition: cartesian_twist_controller.h:107
controller::CartesianTwistController::init
bool init(pr2_mechanism_model::RobotState *robot, ros::NodeHandle &n)
Definition: cartesian_twist_controller.cpp:59
pr2_controller_interface::Controller
controller::CartesianTwistController::fb_pid_controller_
std::vector< control_toolbox::Pid > fb_pid_controller_
Definition: cartesian_twist_controller.h:103
transform_datatypes.h
ros::Time
chain.h
controller::CartesianTwistController::robot_state_
pr2_mechanism_model::RobotState * robot_state_
Definition: cartesian_twist_controller.h:106
controller::CartesianTwistController::~CartesianTwistController
~CartesianTwistController()
Definition: cartesian_twist_controller.cpp:53
controller::CartesianTwistController::jnt_eff_
KDL::JntArray jnt_eff_
Definition: cartesian_twist_controller.h:114
controller::CartesianTwistController::command
void command(const geometry_msgs::TwistConstPtr &twist_msg)
Definition: cartesian_twist_controller.cpp:176
pid.h
controller::CartesianTwistController::twist_meas_
KDL::Twist twist_meas_
Definition: cartesian_twist_controller.h:93
controller::CartesianTwistController::ff_rot_
double ff_rot_
Definition: cartesian_twist_controller.h:99
controller::CartesianTwistController::update
void update()
Definition: cartesian_twist_controller.cpp:134
controller::CartesianTwistController::CartesianTwistController
CartesianTwistController()
Definition: cartesian_twist_controller.cpp:46
controller::CartesianTwistController::jnt_to_twist_solver_
boost::scoped_ptr< KDL::ChainFkSolverVel > jnt_to_twist_solver_
Definition: cartesian_twist_controller.h:111
ros::NodeHandle
ros::Subscriber


robot_mechanism_controllers
Author(s): John Hsu, Melonee Wise, Stuart Glaser
autogenerated on Sat Nov 12 2022 03:33:22