fs100_joint_trajectory_streamer.h
Go to the documentation of this file.
00001 /*
00002  * Software License Agreement (BSD License)
00003  *
00004  * Copyright (c) 2013, 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 FS100_JOINT_TRAJECTORY_STREAMER_H
00033 #define FS100_JOINT_TRAJECTORY_STREAMER_H
00034 
00035 #include "fs100/fs100_motion_ctrl.h"
00036 #include "fs100/industrial_robot_client/joint_trajectory_streamer.h"
00037 #include "simple_message/joint_data.h"
00038 #include "simple_message/simple_message.h"
00039 
00040 namespace motoman
00041 {
00042 namespace fs100_joint_trajectory_streamer
00043 {
00044 
00045 using motoman::fs100_motion_ctrl::FS100_MotionCtrl;
00046 using industrial_robot_client::joint_trajectory_streamer::JointTrajectoryStreamer;
00047 using industrial::simple_message::SimpleMessage;
00048 using industrial::smpl_msg_connection::SmplMsgConnection;
00049 
00055 //* JointTrajectoryStreamer
00061 class FS100_JointTrajectoryStreamer : public JointTrajectoryStreamer
00062 {
00063 
00064 public:
00065 
00066   // since this class overrides some base-class methods,
00067   // these statements help find the base-class versions
00068   using JointTrajectoryStreamer::init;
00069   using JointTrajectoryInterface::is_valid;
00070 
00076   FS100_JointTrajectoryStreamer(int robot_id=-1) : JointTrajectoryStreamer(1),
00077                                                   robot_id_(robot_id) {}
00078 
00079   ~FS100_JointTrajectoryStreamer();
00080 
00093   virtual bool init(SmplMsgConnection* connection, const std::vector<std::string> &joint_names,
00094                     const std::map<std::string, double> &velocity_limits = std::map<std::string, double>());
00095 
00105   virtual bool create_message(int seq, const trajectory_msgs::JointTrajectoryPoint &pt, SimpleMessage* msg);
00106 
00107   virtual bool send_to_robot(const std::vector<SimpleMessage>& messages);
00108 
00109   virtual void streamingThread();
00110 
00111 protected:
00112   static const double pos_stale_time_ = 1.0;  // max time since last "current position" update, for validation (sec)
00113   static const double start_pos_tol_  = 1e-4; // max difference btwn start & current position, for validation (rad)
00114 
00115   int robot_id_;
00116   FS100_MotionCtrl motion_ctrl_;
00117 
00118   void trajectoryStop();
00119   bool is_valid(const trajectory_msgs::JointTrajectory &traj);
00120 
00121   static bool VectorToJointData(const std::vector<double> &vec,
00122                                 industrial::joint_data::JointData &joints);
00123 };
00124 
00125 } //fs100_joint_trajectory_streamer
00126 } //motoman
00127 
00128 #endif /* FS100_JOINT_TRAJECTORY_STREAMER_H */
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Defines


fs100
Author(s): Jeremy Zoss (Southwest Research Institute)
autogenerated on Mon May 27 2013 19:43:14