SMACC
Loading...
Searching...
No Matches
cb_move_end_effector_trajectory.h
Go to the documentation of this file.
1/*****************************************************************************************************************
2 * ReelRobotix Inc. - Software License Agreement Copyright (c) 2018-2020
3 * Authors: Pablo Inigo Blasco, Brett Aldrich
4 *
5 ******************************************************************************************************************/
6
7#pragma once
8
11#include <visualization_msgs/MarkerArray.h>
12#include <tf/transform_datatypes.h>
13
15{
16 template <typename AsyncCB, typename Orthogonal>
17 struct EvJointDiscontinuity : sc::event<EvJointDiscontinuity<AsyncCB, Orthogonal>>
18 {
19 moveit_msgs::RobotTrajectory trajectory;
20 };
21
22 template <typename AsyncCB, typename Orthogonal>
23 struct EvIncorrectInitialPosition : sc::event<EvIncorrectInitialPosition<AsyncCB, Orthogonal>>
24 {
25 moveit_msgs::RobotTrajectory trajectory;
26 };
27
29 {
30 SUCCESS,
33 };
34
37 {
38 public:
39 // std::string tip_link_;
40 boost::optional<std::string> group_;
41
42 boost::optional<std::string> tipLink_;
43
45
46 CbMoveEndEffectorTrajectory(std::string tipLink = "");
47
48 CbMoveEndEffectorTrajectory(const std::vector<geometry_msgs::PoseStamped> &endEffectorTrajectory, std::string tipLink = "");
49
50 template <typename TOrthogonal, typename TSourceObject>
52 {
53 smacc::SmaccAsyncClientBehavior::onOrthogonalAllocation<TOrthogonal, TSourceObject>();
54
55 postJointDiscontinuityEvent = [this](auto traj) {
57 ev->trajectory = traj;
58 this->postEvent(ev);
59 };
60
61 postIncorrectInitialStateEvent = [this](auto traj)
62 {
64 ev->trajectory = traj;
65 this->postEvent(ev);
66 };
67
69 {
70 ROS_INFO_STREAM("[" << this->getName() << "] motion execution failed");
72 this->postEvent<EvMoveGroupMotionExecutionFailed<TSourceObject,TOrthogonal>>();
73 };
74 }
75
76 virtual void onEntry() override;
77
78 virtual void onExit() override;
79
80 virtual void update() override;
81
82 protected:
83 ComputeJointTrajectoryErrorCode computeJointSpaceTrajectory(moveit_msgs::RobotTrajectory &computedJointTrajectory);
84
85 void executeJointSpaceTrajectory(const moveit_msgs::RobotTrajectory &computedJointTrajectory);
86
87 virtual void generateTrajectory();
88
89 virtual void createMarkers();
90
91 std::vector<geometry_msgs::PoseStamped> endEffectorTrajectory_;
92
94
95 visualization_msgs::MarkerArray beahiorMarkers_;
96
97 void getCurrentEndEffectorPose(std::string globalFrame, tf::StampedTransform& currentEndEffectorTransform);
98
99 private:
100 void initializeROS();
101
102 ros::Publisher markersPub_;
103
104 std::atomic<bool> markersInitialized_;
105
106 ros::ServiceClient iksrv_;
107
108 std::mutex m_mutex_;
109
110 std::function<void(moveit_msgs::RobotTrajectory &)> postJointDiscontinuityEvent;
111 std::function<void(moveit_msgs::RobotTrajectory &)> postIncorrectInitialStateEvent;
112
113 std::function<void()> postMotionExecutionFailureEvents;
114
115 bool autocleanmarkers = false;
116 };
117} // namespace cl_move_group_interface
std::function< void(moveit_msgs::RobotTrajectory &)> postJointDiscontinuityEvent
void executeJointSpaceTrajectory(const moveit_msgs::RobotTrajectory &computedJointTrajectory)
ComputeJointTrajectoryErrorCode computeJointSpaceTrajectory(moveit_msgs::RobotTrajectory &computedJointTrajectory)
void getCurrentEndEffectorPose(std::string globalFrame, tf::StampedTransform &currentEndEffectorTransform)
std::function< void(moveit_msgs::RobotTrajectory &)> postIncorrectInitialStateEvent
std::vector< geometry_msgs::PoseStamped > endEffectorTrajectory_