joint_trajectory_action.h
Go to the documentation of this file.
1 /*
2  * Software License Agreement (BSD License)
3  *
4  * Copyright (c) 2012, 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 JOINT_TRAJTORY_ACTION_H
33 #define JOINT_TRAJTORY_ACTION_H
34 
35 #include <ros/ros.h>
37 
38 #include <trajectory_msgs/JointTrajectory.h>
39 #include <control_msgs/FollowJointTrajectoryAction.h>
40 #include <control_msgs/FollowJointTrajectoryFeedback.h>
41 #include <industrial_msgs/RobotStatus.h>
42 
44 {
45 namespace joint_trajectory_action
46 {
47 
49 {
50 
51 public:
57 
63 
67  void run() { ros::spin(); }
68 
69 private:
70 
72 
76  std::string name_;
77 
82 
87 
92 
98 
104 
110 
115 
120 
126 
134  trajectory_msgs::JointTrajectory current_traj_;
135 
140  static const double DEFAULT_GOAL_THRESHOLD_;// = 0.01;
141 
150 
156  std::vector<std::string> joint_names_;
157 
161  control_msgs::FollowJointTrajectoryFeedbackConstPtr last_trajectory_state_;
162 
166  industrial_msgs::RobotStatusConstPtr last_robot_status_;
167 
173 
177  static const double WATCHDOG_PERIOD_;// = 1.0;
178 
185  void watchdog(const ros::TimerEvent &e);
186 
194 
210  void controllerStateCB(const control_msgs::FollowJointTrajectoryFeedbackConstPtr &msg);
211 
219  void robotStatusCB(const industrial_msgs::RobotStatusConstPtr &msg);
220 
227  void abortGoal();
228 
239  bool withinGoalConstraints(const control_msgs::FollowJointTrajectoryFeedbackConstPtr &msg,
240  const trajectory_msgs::JointTrajectory & traj);
241 };
242 
243 } //joint_trajectory_action
244 } //industrial_robot_client
245 
246 #endif /* JOINT_TRAJTORY_ACTION_H */
industrial_robot_client::joint_trajectory_action::JointTrajectoryAction::JointTractoryActionServer
actionlib::ActionServer< control_msgs::FollowJointTrajectoryAction > JointTractoryActionServer
Definition: joint_trajectory_action.h:71
industrial_robot_client::joint_trajectory_action::JointTrajectoryAction::sub_trajectory_state_
ros::Subscriber sub_trajectory_state_
Subscribes to trajectory feedback (typically published by the robot driver).
Definition: joint_trajectory_action.h:97
industrial_robot_client::joint_trajectory_action::JointTrajectoryAction::withinGoalConstraints
bool withinGoalConstraints(const control_msgs::FollowJointTrajectoryFeedbackConstPtr &msg, const trajectory_msgs::JointTrajectory &traj)
Controller status callback (executed when robot status message received)
Definition: joint_trajectory_action.cpp:287
industrial_robot_client::joint_trajectory_action::JointTrajectoryAction::controllerStateCB
void controllerStateCB(const control_msgs::FollowJointTrajectoryFeedbackConstPtr &msg)
Controller state callback (executed when feedback message received)
Definition: joint_trajectory_action.cpp:203
ros::Publisher
actionlib::ServerGoalHandle
actionlib::ActionServer< control_msgs::FollowJointTrajectoryAction >
industrial_robot_client::joint_trajectory_action::JointTrajectoryAction::~JointTrajectoryAction
~JointTrajectoryAction()
Destructor.
Definition: joint_trajectory_action.cpp:70
ros.h
industrial_robot_client::joint_trajectory_action::JointTrajectoryAction::node_
ros::NodeHandle node_
Internal ROS node handle.
Definition: joint_trajectory_action.h:81
industrial_robot_client::joint_trajectory_action::JointTrajectoryAction::last_trajectory_state_
control_msgs::FollowJointTrajectoryFeedbackConstPtr last_trajectory_state_
Cache of the last subscribed feedback message.
Definition: joint_trajectory_action.h:161
industrial_robot_client::joint_trajectory_action::JointTrajectoryAction::goalCB
void goalCB(JointTractoryActionServer::GoalHandle gh)
Action server goal callback method.
Definition: joint_trajectory_action.cpp:110
industrial_robot_client::joint_trajectory_action::JointTrajectoryAction::pub_trajectory_command_
ros::Publisher pub_trajectory_command_
Publishes desired trajectory (typically to the robot driver)
Definition: joint_trajectory_action.h:91
industrial_robot_client::joint_trajectory_action::JointTrajectoryAction::goal_threshold_
double goal_threshold_
The goal joint threshold used for determining if a robot is near it final destination....
Definition: joint_trajectory_action.h:149
industrial_robot_client::joint_trajectory_action::JointTrajectoryAction::sub_robot_status_
ros::Subscriber sub_robot_status_
Subscribes to the robot status (typically published by the robot driver).
Definition: joint_trajectory_action.h:103
industrial_robot_client::joint_trajectory_action::JointTrajectoryAction::JointTrajectoryAction
JointTrajectoryAction()
Constructor.
Definition: joint_trajectory_action.cpp:45
industrial_robot_client::joint_trajectory_action::JointTrajectoryAction::watchdog_timer_
ros::Timer watchdog_timer_
Watchdog time used to fail the action request if the robot driver is not responding.
Definition: joint_trajectory_action.h:109
industrial_robot_client::joint_trajectory_action::JointTrajectoryAction::watchdog
void watchdog(const ros::TimerEvent &e)
Watch dog callback, used to detect robot driver failures.
Definition: joint_trajectory_action.cpp:80
industrial_robot_client::joint_trajectory_action::JointTrajectoryAction::last_robot_status_
industrial_msgs::RobotStatusConstPtr last_robot_status_
Cache of the last subscribed status message.
Definition: joint_trajectory_action.h:166
industrial_robot_client::joint_trajectory_action::JointTrajectoryAction::time_to_check_
ros::Time time_to_check_
Time at which to start checking for completion of current goal, if one is active.
Definition: joint_trajectory_action.h:172
industrial_robot_client::joint_trajectory_action::JointTrajectoryAction::run
void run()
Begin processing messages and publishing topics.
Definition: joint_trajectory_action.h:67
industrial_robot_client::joint_trajectory_action::JointTrajectoryAction::abortGoal
void abortGoal()
Aborts the current action goal and sends a stop command (empty message) to the robot driver.
Definition: joint_trajectory_action.cpp:276
industrial_robot_client::joint_trajectory_action::JointTrajectoryAction::has_moved_once_
bool has_moved_once_
Indicates that the robot has been in a moving state at least once since starting the current active t...
Definition: joint_trajectory_action.h:125
ros::TimerEvent
industrial_robot_client::joint_trajectory_action::JointTrajectoryAction::cancelCB
void cancelCB(JointTractoryActionServer::GoalHandle gh)
Action server cancel callback method.
Definition: joint_trajectory_action.cpp:183
industrial_robot_client::joint_trajectory_action::JointTrajectoryAction::action_server_
JointTractoryActionServer action_server_
Internal action server.
Definition: joint_trajectory_action.h:86
action_server.h
ros::Time
industrial_robot_client
Definition: joint_relay_handler.h:46
industrial_robot_client::joint_trajectory_action::JointTrajectoryAction::DEFAULT_GOAL_THRESHOLD_
static const double DEFAULT_GOAL_THRESHOLD_
The default goal joint threshold see(goal_threshold). Unit are joint specific (i.e....
Definition: joint_trajectory_action.h:140
industrial_robot_client::joint_trajectory_action::JointTrajectoryAction::name_
std::string name_
Name of this class, for logging namespacing.
Definition: joint_trajectory_action.h:76
industrial_robot_client::joint_trajectory_action::JointTrajectoryAction::current_traj_
trajectory_msgs::JointTrajectory current_traj_
Cache of the current active trajectory.
Definition: joint_trajectory_action.h:134
industrial_robot_client::joint_trajectory_action::JointTrajectoryAction::joint_names_
std::vector< std::string > joint_names_
The joint names associated with the robot the action is interfacing with. The joint names must be the...
Definition: joint_trajectory_action.h:156
ros::spin
ROSCPP_DECL void spin()
industrial_robot_client::joint_trajectory_action::JointTrajectoryAction::has_active_goal_
bool has_active_goal_
Indicates action has an active goal.
Definition: joint_trajectory_action.h:119
industrial_robot_client::joint_trajectory_action::JointTrajectoryAction::WATCHDOG_PERIOD_
static const double WATCHDOG_PERIOD_
The watchdog period (seconds)
Definition: joint_trajectory_action.h:177
industrial_robot_client::joint_trajectory_action::JointTrajectoryAction::controller_alive_
bool controller_alive_
Controller was alive during the last watchdog interval.
Definition: joint_trajectory_action.h:114
industrial_robot_client::joint_trajectory_action::JointTrajectoryAction::active_goal_
JointTractoryActionServer::GoalHandle active_goal_
Cache of the current active goal.
Definition: joint_trajectory_action.h:130
industrial_robot_client::joint_trajectory_action::JointTrajectoryAction::robotStatusCB
void robotStatusCB(const industrial_msgs::RobotStatusConstPtr &msg)
Controller status callback (executed when robot status message received)
Definition: joint_trajectory_action.cpp:74
ros::Timer
ros::NodeHandle
ros::Subscriber
industrial_robot_client::joint_trajectory_action::JointTrajectoryAction
Definition: joint_trajectory_action.h:48


industrial_robot_client
Author(s): Jeremy Zoss
autogenerated on Wed Mar 2 2022 00:24:59