joint_trajectory_handler.h
Go to the documentation of this file.
00001 /*
00002  * Software License Agreement (BSD License)
00003  *
00004  * Copyright (c) 2011, Southwest Research Institute
00005  * All rights reserved.
00006  *
00007  * Redistribution and use in source and binary forms, with or without
00008  * modification, are permitted provided that the following conditions are met:
00009  *
00010  *       * Redistributions of source code must retain the above copyright
00011  *       notice, this list of conditions and the following disclaimer.
00012  *       * Redistributions in binary form must reproduce the above copyright
00013  *       notice, this list of conditions and the following disclaimer in the
00014  *       documentation and/or other materials provided with the distribution.
00015  *       * Neither the name of the Southwest Research Institute, nor the names
00016  *       of its contributors may be used to endorse or promote products derived
00017  *       from this software without specific prior written permission.
00018  *
00019  * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
00020  * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
00021  * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
00022  * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
00023  * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
00024  * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
00025  * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
00026  * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
00027  * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
00028  * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
00029  * POSSIBILITY OF SUCH DAMAGE.
00030  */
00031 
00032 #ifndef JOINT_TRAJECTORY_HANDLER_H
00033 #define JOINT_TRAJECTORY_HANDLER_H
00034 
00035 #include "simple_message/smpl_msg_connection.h"
00036 #include "ros/ros.h"
00037 #include <boost/thread/thread.hpp>
00038 #include <sensor_msgs/JointState.h>
00039 #include <trajectory_msgs/JointTrajectory.h>
00040 
00041 namespace adept
00042 {
00043 namespace joint_trajectory_handler
00044 {
00045 
00046 namespace JointTrajectoryStates
00047 {
00048 enum JointTrajectoryState
00049 {
00050   IDLE = 0, STREAMING =1 //,STARTING, //, STOPPING
00051 };
00052 }
00053 typedef JointTrajectoryStates::JointTrajectoryState JointTrajectoryState;
00054 
00059 //* JointTrajectoryHandler
00065 class JointTrajectoryHandler
00066 {
00067 
00068 public:
00069 
00070   JointTrajectoryHandler();
00071 
00078   JointTrajectoryHandler(ros::NodeHandle &n, industrial::smpl_msg_connection::SmplMsgConnection* robotConnecton);
00079 
00080   ~JointTrajectoryHandler();
00081 
00082   void jointTrajectoryCB(const trajectory_msgs::JointTrajectoryConstPtr &msg);
00083   void trajectoryHandler();
00084 
00085 private:
00086 
00087   void trajectoryStop();
00088 
00089   industrial::smpl_msg_connection::SmplMsgConnection* robot_;
00090   ros::Subscriber sub_joint_tranectory_; //subscribe to "command"
00091   ros::NodeHandle node_;
00092 
00093   boost::thread* trajectoryHandler_;
00094   boost::mutex mutex_;int currentPoint;
00095   trajectory_msgs::JointTrajectory current_traj_;
00096   JointTrajectoryState state_;
00097 
00098   static const int NUM_OF_JOINTS_ = 6;
00099 };
00100 
00101 } //joint_trajectory_handler
00102 } //motoman
00103 
00104 #endif /* JOINT_TRAJECTORY_HANDLER_H */


adept_common
Author(s): root
autogenerated on Sun Oct 5 2014 22:05:33