SMACC
Loading...
Searching...
No Matches
cl_movegroup.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
9//#include <smacc/smacc_client.h>
10//#include <smacc/smacc_signal.h>
11#include <smacc/smacc.h>
12
13#include <moveit/move_group_interface/move_group_interface.h>
14#include <moveit/planning_scene_interface/planning_scene_interface.h>
15#include <geometry_msgs/Vector3.h>
16#include <geometry_msgs/Transform.h>
17
19{
20
21template <typename TSource, typename TOrthogonal>
22struct EvMoveGroupMotionExecutionSucceded : sc::event<EvMoveGroupMotionExecutionSucceded<TSource, TOrthogonal>>
23{
24};
25
26template <typename TSource, typename TOrthogonal>
27struct EvMoveGroupMotionExecutionFailed : sc::event<EvMoveGroupMotionExecutionFailed<TSource, TOrthogonal>>
28{
29};
30
31/*
32moveit_msgs/MoveItErrorCodes
33----------------------------
34int32 SUCCESS=1
35int32 FAILURE=99999
36int32 PLANNING_FAILED=-1
37int32 INVALID_MOTION_PLAN=-2
38int32 MOTION_PLAN_INVALIDATED_BY_ENVIRONMENT_CHANGE=-3
39int32 CONTROL_FAILED=-4
40int32 UNABLE_TO_AQUIRE_SENSOR_DATA=-5
41int32 TIMED_OUT=-6
42int32 PREEMPTED=-7
43int32 START_STATE_IN_COLLISION=-10
44int32 START_STATE_VIOLATES_PATH_CONSTRAINTS=-11
45int32 GOAL_IN_COLLISION=-12
46int32 GOAL_VIOLATES_PATH_CONSTRAINTS=-13
47int32 GOAL_CONSTRAINTS_VIOLATED=-14
48int32 INVALID_GROUP_NAME=-15
49int32 INVALID_GOAL_CONSTRAINTS=-16
50int32 INVALID_ROBOT_STATE=-17
51int32 INVALID_LINK_NAME=-18
52int32 INVALID_OBJECT_NAME=-19
53int32 FRAME_TRANSFORM_FAILURE=-21
54int32 COLLISION_CHECKING_UNAVAILABLE=-22
55int32 ROBOT_STATE_STALE=-23
56int32 SENSOR_INFO_STALE=-24
57int32 NO_IK_SOLUTION=-31
58int32 val
59*/
60
62{
63private:
64 std::function<void()> postEventMotionExecutionSucceded_;
65 std::function<void()> postEventMotionExecutionFailed_;
66
69
70public:
71 // this structure contains the default move_group configuration for any arm motion through move_group
72 // the client behavior will override these default values in a copy of this object so that their changes
73 // are not persinstent. In the other hand, if you change this client configuration, the parameters will be persistent.
74 moveit::planning_interface::MoveGroupInterface moveGroupClientInterface;
75
76 moveit::planning_interface::PlanningSceneInterface planningSceneInterface;
77
78 ClMoveGroup(std::string groupName);
79
80 virtual ~ClMoveGroup();
81
84
85 template <typename TOrthogonal, typename TSourceObject>
87 {
89 this->onSucceded_();
90 this->postEvent<EvMoveGroupMotionExecutionSucceded<TSourceObject, TOrthogonal>>();
91 };
92
94 this->onFailed_();
95 this->postEvent<EvMoveGroupMotionExecutionFailed<TSourceObject, TOrthogonal>>();
96 };
97 }
98
99 template <typename TCallback, typename T>
100 boost::signals2::connection onMotionExecutionSuccedded(TCallback callback, T *object)
101 {
102 return this->getStateMachine()->createSignalConnection(onSucceded_, callback, object);
103 }
104
105 template <typename TCallback, typename T>
106 boost::signals2::connection onMotionExecutionFailed(TCallback callback, T *object)
107 {
108 return this->getStateMachine()->createSignalConnection(onFailed_, callback, object);
109 }
110};
111} // namespace cl_move_group_interface
moveit::planning_interface::PlanningSceneInterface planningSceneInterface
Definition: cl_movegroup.h:76
std::function< void()> postEventMotionExecutionSucceded_
Definition: cl_movegroup.h:64
smacc::SmaccSignal< void()> onFailed_
Definition: cl_movegroup.h:68
boost::signals2::connection onMotionExecutionFailed(TCallback callback, T *object)
Definition: cl_movegroup.h:106
boost::signals2::connection onMotionExecutionSuccedded(TCallback callback, T *object)
Definition: cl_movegroup.h:100
moveit::planning_interface::MoveGroupInterface moveGroupClientInterface
Definition: cl_movegroup.h:74
std::function< void()> postEventMotionExecutionFailed_
Definition: cl_movegroup.h:65
smacc::SmaccSignal< void()> onSucceded_
Definition: cl_movegroup.h:67
ISmaccStateMachine * getStateMachine()
boost::signals2::connection createSignalConnection(TSmaccSignal &signal, TMemberFunctionPrototype callback, TSmaccObjectType *object)