fsrobo_r_joint_trajectory_action.h
Go to the documentation of this file.
1 /*********************************************************************
2 * FSRobo-R Package BSDL
3 * ---------
4 * Copyright (C) 2019 FUJISOFT. All rights reserved.
5 *
6 * Redistribution and use in source and binary forms, with or without modification,
7 * are permitted provided that the following conditions are met:
8 * 1. Redistributions of source code must retain the above copyright notice,
9 * this list of conditions and the following disclaimer.
10 * 2. Redistributions in binary form must reproduce the above copyright notice,
11 * this list of conditions and the following disclaimer in the documentation and/or
12 * other materials provided with the distribution.
13 * 3. Neither the name of the copyright holder nor the names of its contributors
14 * may be used to endorse or promote products derived from this software without
15 * specific prior written permission.
16 *
17 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
18 * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
19 * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
20 * IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT,
21 * INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
22 * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
23 * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
24 * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
25 * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
26 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
27 *********************************************************************/
28 
29 #ifndef FSROBO_R_DRIVER_JOINT_TRAJTORY_ACTION_H
30 #define FSROBO_R_DRIVER_JOINT_TRAJTORY_ACTION_H
31 
32 #include <ros/ros.h>
34 
35 #include <trajectory_msgs/JointTrajectory.h>
36 #include <control_msgs/FollowJointTrajectoryAction.h>
37 #include <control_msgs/FollowJointTrajectoryFeedback.h>
38 #include <industrial_msgs/RobotStatus.h>
39 #include <std_srvs/Empty.h>
40 
41 namespace fsrobo_r_driver
42 {
43 namespace joint_trajectory_action
44 {
45 
47 {
48 
49 public:
55 
61 
65  void run() { ros::spin(); }
66 
67 private:
68 
70 
75 
79  JointTractoryActionServer action_server_;
80 
85 
91 
97 
102 
108 
113 
118 
124 
132  trajectory_msgs::JointTrajectory current_traj_;
133 
138  static const double DEFAULT_GOAL_THRESHOLD_;// = 0.01;
139 
148 
154  std::vector<std::string> joint_names_;
155 
159  control_msgs::FollowJointTrajectoryFeedbackConstPtr last_trajectory_state_;
160 
164  industrial_msgs::RobotStatusConstPtr last_robot_status_;
165 
171 
175  static const double WATCHDOG_PERIOD_;// = 1.0;
176 
183  void watchdog(const ros::TimerEvent &e);
184 
192 
208  void controllerStateCB(const control_msgs::FollowJointTrajectoryFeedbackConstPtr &msg);
209 
217  void robotStatusCB(const industrial_msgs::RobotStatusConstPtr &msg);
218 
227  bool cancelMotionCB(std_srvs::EmptyRequest &req, std_srvs::EmptyResponse &res);
228 
235  void abortGoal();
236 
247  bool withinGoalConstraints(const control_msgs::FollowJointTrajectoryFeedbackConstPtr &msg,
248  const trajectory_msgs::JointTrajectory & traj);
249 };
250 
251 }
252 }
253 
254 #endif // FSROBO_R_DRIVER_JOINT_TRAJTORY_ACTION_H
ros::Publisher pub_trajectory_command_
Publishes desired trajectory (typically to the robot driver)
bool withinGoalConstraints(const control_msgs::FollowJointTrajectoryFeedbackConstPtr &msg, const trajectory_msgs::JointTrajectory &traj)
Controller status callback (executed when robot status message received)
actionlib::ActionServer< control_msgs::FollowJointTrajectoryAction > JointTractoryActionServer
bool has_moved_once_
Indicates that the robot has been in a moving state at least once since starting the current active t...
industrial_msgs::RobotStatusConstPtr last_robot_status_
Cache of the last subscribed status message.
bool controller_alive_
Controller was alive during the last watchdog interval.
bool cancelMotionCB(std_srvs::EmptyRequest &req, std_srvs::EmptyResponse &res)
Cancel motion callback (executed when cancel_motion service is called)
ROSCPP_DECL void spin(Spinner &spinner)
void abortGoal()
Aborts the current action goal and sends a stop command (empty message) to the robot driver...
void goalCB(JointTractoryActionServer::GoalHandle gh)
Action server goal callback method.
control_msgs::FollowJointTrajectoryFeedbackConstPtr last_trajectory_state_
Cache of the last subscribed feedback message.
void robotStatusCB(const industrial_msgs::RobotStatusConstPtr &msg)
Controller status callback (executed when robot status message received)
double goal_threshold_
The goal joint threshold used for determining if a robot is near it final destination. A single value is used for all joints.
ros::Subscriber sub_robot_status_
Subscribes to the robot status (typically published by the robot driver).
void controllerStateCB(const control_msgs::FollowJointTrajectoryFeedbackConstPtr &msg)
Controller state callback (executed when feedback message received)
std::vector< std::string > joint_names_
The joint names associated with the robot the action is interfacing with. The joint names must be the...
trajectory_msgs::JointTrajectory current_traj_
Cache of the current active trajectory.
ros::Time time_to_check_
Time at which to start checking for completion of current goal, if one is active. ...
ros::Timer watchdog_timer_
Watchdog time used to fail the action request if the robot driver is not responding.
void watchdog(const ros::TimerEvent &e)
Watch dog callback, used to detect robot driver failures.
void cancelCB(JointTractoryActionServer::GoalHandle gh)
Action server cancel callback method.
static const double DEFAULT_GOAL_THRESHOLD_
The default goal joint threshold see(goal_threshold). Unit are joint specific (i.e. radians or meters).
JointTractoryActionServer::GoalHandle active_goal_
Cache of the current active goal.
ros::Subscriber sub_trajectory_state_
Subscribes to trajectory feedback (typically published by the robot driver).


fsrobo_r_driver
Author(s): F-ROSROBO
autogenerated on Sun Feb 9 2020 03:58:29