Go to the documentation of this file. 1 #ifndef AIKIDO_CONTROL_ROS_ROSJOINTMODECOMMANDCLIENT_HPP_
2 #define AIKIDO_CONTROL_ROS_ROSJOINTMODECOMMANDCLIENT_HPP_
8 #include <actionlib/client/action_client.h>
9 #include <pr_control_msgs/JointGroupCommandAction.h>
10 #include <pr_control_msgs/JointModeCommandAction.h>
11 #include <ros/callback_queue.h>
15 #include <hardware_interface/joint_mode_interface.h>
21 static inline int intFromMode(hardware_interface::JointCommandModes mode)
25 case hardware_interface::JointCommandModes::BEGIN:
27 case hardware_interface::JointCommandModes::MODE_POSITION:
29 case hardware_interface::JointCommandModes::MODE_VELOCITY:
31 case hardware_interface::JointCommandModes::MODE_EFFORT:
33 case hardware_interface::JointCommandModes::NOMODE:
35 case hardware_interface::JointCommandModes::EMERGENCY_STOP:
37 case hardware_interface::JointCommandModes::SWITCHING:
40 ROS_WARN_STREAM(
"Setting error mode to'" << 6 <<
"'.");
58 const ::ros::NodeHandle& node,
59 const std::string& serverName,
60 const std::vector<std::string> jointNames,
61 const std::chrono::milliseconds connectionTimeout
62 = std::chrono::milliseconds{1000},
63 const std::chrono::milliseconds connectionPollingPeriod
64 = std::chrono::milliseconds{20});
73 const std::vector<hardware_interface::JointCommandModes>& goal);
86 = actionlib::ActionClient<pr_control_msgs::JointModeCommandAction>;
87 using GoalHandle = JointModeCommandActionClient::GoalHandle;
112 #endif // ifndef AIKIDO_CONTROL_ROS_ROSJOINTMODECOMMANDCLIENT_HPP_
std::unique_ptr< std::promise< int > > mPromise
Definition: RosJointModeCommandClient.hpp:102
std::future< int > execute(const std::vector< hardware_interface::JointCommandModes > &goal)
Send command to ROS server for execution.
std::vector< std::string > mJointNames
Definition: RosJointModeCommandClient.hpp:96
virtual ~RosJointModeCommandClient()
Format of serialized trajectory in YAML.
Definition: algorithm.hpp:4
JointModeCommandActionClient::GoalHandle mGoalHandle
Definition: RosJointModeCommandClient.hpp:94
static int intFromMode(hardware_interface::JointCommandModes mode)
Definition: RosJointModeCommandClient.hpp:21
std::chrono::milliseconds mConnectionTimeout
Definition: RosJointModeCommandClient.hpp:98
bool mInProgress
Definition: RosJointModeCommandClient.hpp:101
::ros::CallbackQueue mCallbackQueue
Definition: RosJointModeCommandClient.hpp:92
RosJointModeCommandClient(const ::ros::NodeHandle &node, const std::string &serverName, const std::vector< std::string > jointNames, const std::chrono::milliseconds connectionTimeout=std::chrono::milliseconds{1000}, const std::chrono::milliseconds connectionPollingPeriod=std::chrono::milliseconds{20})
Constructor.
JointModeCommandActionClient mClient
Definition: RosJointModeCommandClient.hpp:93
actionlib::ActionClient< pr_control_msgs::JointModeCommandAction > JointModeCommandActionClient
Definition: RosJointModeCommandClient.hpp:86
JointModeCommandActionClient::GoalHandle GoalHandle
Definition: RosJointModeCommandClient.hpp:87
void transitionCallback(GoalHandle handle)
const ::ros::NodeHandle mNode
Definition: RosJointModeCommandClient.hpp:91
This class uses actionlib to command an action of the type pr_control_msgs/JointModeCommandAction.
Definition: RosJointModeCommandClient.hpp:48
std::chrono::milliseconds mConnectionPollingPeriod
Definition: RosJointModeCommandClient.hpp:99
void cancel()
Cancel current command.
std::mutex mMutex
Manages access to mInProgress, mPromise.
Definition: RosJointModeCommandClient.hpp:105