39 #include <kdl/frames.hpp> 40 #include <kdl/chainfksolverpos_recursive.hpp> 41 #include <kdl/chainidsolver_recursive_newton_euler.hpp> 42 #include <kdl/chainiksolvervel_pinv.hpp> 44 #include <sensor_msgs/JointState.h> 45 #include <svenzva_msgs/SvenzvaJointAction.h> 46 #include <geometry_msgs/Twist.h> 65 svenzva_msgs::SvenzvaJointGoal
goal;
69 void js_cb(
const sensor_msgs::JointState::ConstPtr& msg){
78 if(msg->linear.x == 0 && msg->linear.y == 0 && msg->linear.z == 0)
81 for (
unsigned int i = 0; i <
mNumJnts; i++) {
90 KDL::Vector trans(msg->linear.x, msg->linear.y, -1 * msg->linear.z);
91 KDL::Vector rot(msg->angular.x, msg->angular.y, -1 * msg->angular.z);
101 svenzva_msgs::SvenzvaJointGoal goal_prime;
107 goal_prime.positions.push_back(
joint_states.position[i] + qdot_out(i));
119 int main(
int argc,
char** argv){
120 ros::init(argc, argv,
"revel_cartesian_vel_manager");
129 std::string full_path = path +
"/robots/svenzva_arm.urdf";
134 ROS_INFO(
"Loading model from %s", full_path.c_str());
138 if (!kdl_parser::treeFromFile(full_path, my_tree)){
139 ROS_ERROR(
"Failed to construct kdl tree");
142 my_tree.
getChain(
"base_link",
"link_6", chain);
145 ROS_INFO(
"Waiting for svenzva_joint_action server to start.");
KDL::JntArray jnt_qdd(mNumJnts)
KDL::JntArray jnt_q(mNumJnts)
bool waitForServer(const ros::Duration &timeout=ros::Duration(0, 0)) const
Subscriber subscribe(const std::string &topic, uint32_t queue_size, void(T::*fp)(M), T *obj, const TransportHints &transport_hints=TransportHints())
ROSCPP_DECL void init(int &argc, char **argv, const std::string &name, uint32_t options=0)
virtual int CartToJnt(const JntArray &q_in, const Twist &v_in, JntArray &qdot_out)
void js_cb(const sensor_msgs::JointState::ConstPtr &msg)
svenzva_msgs::SvenzvaJointGoal goal
KDL::JntArray jnt_qd(mNumJnts)
unsigned int getNrOfJoints() const
KDL_PARSER_PUBLIC bool treeFromFile(const std::string &file, KDL::Tree &tree)
void cart_vel_cb(const geometry_msgs::TwistConstPtr &msg)
ROSLIB_DECL std::string getPath(const std::string &package_name)
bool getChain(const std::string &chain_root, const std::string &chain_tip, Chain &chain) const
void sendGoal(const Goal &goal, SimpleDoneCallback done_cb=SimpleDoneCallback(), SimpleActiveCallback active_cb=SimpleActiveCallback(), SimpleFeedbackCallback feedback_cb=SimpleFeedbackCallback())
int main(int argc, char **argv)
ROSCPP_DECL void spinOnce()
sensor_msgs::JointState joint_states
KDL::JntArray jnt_taugc(mNumJnts)