joint_trajectory_streamer.h
Go to the documentation of this file.
1 /*
2  * Software License Agreement (BSD License)
3  *
4  * Copyright (c) 2013, Southwest Research Institute
5  * All rights reserved.
6  *
7  * Redistribution and use in source and binary forms, with or without
8  * modification, are permitted provided that the following conditions are met:
9  *
10  * * Redistributions of source code must retain the above copyright
11  * notice, this list of conditions and the following disclaimer.
12  * * Redistributions in binary form must reproduce the above copyright
13  * notice, this list of conditions and the following disclaimer in the
14  * documentation and/or other materials provided with the distribution.
15  * * Neither the name of the Southwest Research Institute, nor the names
16  * of its contributors may be used to endorse or promote products derived
17  * from this software without specific prior written permission.
18  *
19  * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
20  * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
21  * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
22  * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
23  * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
24  * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
25  * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
26  * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
27  * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
28  * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
29  * POSSIBILITY OF SUCH DAMAGE.
30  */
31 
32 #ifndef MOTOMAN_DRIVER_JOINT_TRAJECTORY_STREAMER_H
33 #define MOTOMAN_DRIVER_JOINT_TRAJECTORY_STREAMER_H
34 
35 #include <map>
36 #include <string>
37 #include <vector>
42 #include "std_srvs/Trigger.h"
43 
44 namespace motoman
45 {
46 namespace joint_trajectory_streamer
47 {
48 
53 
59 //* JointTrajectoryStreamer
66 {
67 public:
68  // since this class overrides some base-class methods,
69  // these statements help find the base-class versions
71  using JointTrajectoryInterface::is_valid;
72 
78  explicit MotomanJointTrajectoryStreamer(int robot_id = -1) : JointTrajectoryStreamer(1),
79  robot_id_(robot_id) {}
80 
82 
95  virtual bool init(SmplMsgConnection* connection, const std::vector<std::string> &joint_names,
96  const std::map<std::string, double> &velocity_limits = std::map<std::string, double>());
97 
110  virtual bool init(SmplMsgConnection* connection, const std::map<int, RobotGroup> &robot_groups,
111  const std::map<std::string, double> &velocity_limits = std::map<std::string, double>());
112 
122  virtual bool create_message(int seq, const trajectory_msgs::JointTrajectoryPoint &pt, SimpleMessage* msg);
123 
124  virtual bool create_message(int seq, const motoman_msgs::DynamicJointsGroup &pt, SimpleMessage* msg);
125 
126  virtual bool create_message_ex(int seq, const motoman_msgs::DynamicJointPoint &point, SimpleMessage* msg);
127 
128  virtual bool send_to_robot(const std::vector<SimpleMessage>& messages);
129 
130  virtual void streamingThread();
131 
132 protected:
135 
136  std::map<int, MotomanMotionCtrl> motion_ctrl_map_;
137 
138  void trajectoryStop();
139  bool is_valid(const trajectory_msgs::JointTrajectory &traj);
140  bool is_valid(const motoman_msgs::DynamicJointTrajectory &traj);
141 
142  static bool VectorToJointData(const std::vector<double> &vec,
144 
150 
156 
162  bool disableRobotCB(std_srvs::Trigger::Request &req,
163  std_srvs::Trigger::Response &res);
164 
170  bool enableRobotCB(std_srvs::Trigger::Request &req,
171  std_srvs::Trigger::Response &res);
172 };
173 
174 } // namespace joint_trajectory_streamer
175 } // namespace motoman
176 
177 #endif // MOTOMAN_DRIVER_JOINT_TRAJECTORY_STREAMER_H
virtual bool send_to_robot(const std::vector< SimpleMessage > &messages)
Send trajectory to robot, using this node&#39;s robot-connection. Specific method must be implemented in ...
ros::ServiceServer disabler_
Service used to disable the robot controller. When disabled, all incoming goals are ignored...
virtual bool create_message(int seq, const trajectory_msgs::JointTrajectoryPoint &pt, SimpleMessage *msg)
Create SimpleMessage for sending to the robot.
Wrapper class around Motoman-specific motion control commands.
Definition: motion_ctrl.h:51
static bool VectorToJointData(const std::vector< double > &vec, industrial::joint_data::JointData &joints)
Message handler that streams joint trajectories to the robot controller. Contains FS100-specific moti...
bool disableRobotCB(std_srvs::Trigger::Request &req, std_srvs::Trigger::Response &res)
Disable the robot. Response is true if the state was flipped or false if the state has not changed...
bool enableRobotCB(std_srvs::Trigger::Request &req, std_srvs::Trigger::Response &res)
Enable the robot. Response is true if the state was flipped or false if the state has not changed...
virtual bool create_message_ex(int seq, const motoman_msgs::DynamicJointPoint &point, SimpleMessage *msg)
virtual bool init(SmplMsgConnection *connection, const std::vector< std::string > &joint_names, const std::map< std::string, double > &velocity_limits=std::map< std::string, double >())
ros::ServiceServer enabler_
Service used to enable the robot controller. When disabled, all incoming goals are ignored...
virtual bool init(SmplMsgConnection *connection, const std::vector< std::string > &joint_names, const std::map< std::string, double > &velocity_limits=std::map< std::string, double >())
Class initializer.


motoman_driver
Author(s): Jeremy Zoss (Southwest Research Institute), Ted Miller (MotoROS) (Yaskawa Motoman), Eric Marcil (MotoROS) (Yaskawa Motoman)
autogenerated on Sat May 8 2021 02:27:43