00001 /* 00002 * follow_joint_trajectory_client.h 00003 * 00004 * Created on: 06.11.2011 00005 * Author: martin 00006 */ 00007 00008 #ifndef FOLLOW_JOINT_TRAJECTORY_CLIENT_H_ 00009 #define FOLLOW_JOINT_TRAJECTORY_CLIENT_H_ 00010 00011 #include <ros/ros.h> 00012 #include <control_msgs/JointTrajectoryAction.h> 00013 #include <actionlib/client/simple_action_client.h> 00014 #include <sensor_msgs/JointState.h> 00015 #include <trajectory_msgs/JointTrajectory.h> 00016 00017 namespace katana_tutorials 00018 { 00019 00020 typedef actionlib::SimpleActionClient<control_msgs::JointTrajectoryAction> TrajClient; 00021 00022 class Pr2JointTrajectoryClient 00023 { 00024 public: 00025 Pr2JointTrajectoryClient(); 00026 virtual ~Pr2JointTrajectoryClient(); 00027 00028 void startTrajectory(control_msgs::JointTrajectoryGoal goal); 00029 control_msgs::JointTrajectoryGoal makeArmUpTrajectory(); 00030 actionlib::SimpleClientGoalState getState(); 00031 00032 private: 00033 ros::NodeHandle nh_; 00034 TrajClient traj_client_; 00035 ros::Subscriber joint_state_sub_; 00036 std::vector<std::string> joint_names_; 00037 bool got_joint_state_; 00038 std::vector<double> current_joint_state_; 00039 ros::AsyncSpinner spinner_; 00040 00041 void jointStateCB(const sensor_msgs::JointState::ConstPtr &msg); 00042 }; 00043 00044 } /* namespace katana_tutorials */ 00045 #endif /* FOLLOW_JOINT_TRAJECTORY_CLIENT_H_ */