32
32
#define UR_CLIENT_LIBRARY_MOTION_PRIMITIVES_H_INCLUDED
33
33
34
34
#include < chrono>
35
+ #include < optional>
35
36
#include < ur_client_library/types.h>
36
37
37
38
namespace urcl
@@ -48,9 +49,19 @@ enum class MotionType : uint8_t
48
49
SPLINE = 51 ,
49
50
UNKNOWN = 255
50
51
};
52
+
53
+ /* !
54
+ * Spline types
55
+ */
56
+ enum class TrajectorySplineType : int32_t
57
+ {
58
+ SPLINE_CUBIC = 1 ,
59
+ SPLINE_QUINTIC = 2
60
+ };
61
+
51
62
struct MotionPrimitive
52
63
{
53
- MotionType type;
64
+ MotionType type = MotionType::UNKNOWN ;
54
65
std::chrono::duration<double > duration;
55
66
double acceleration;
56
67
double velocity;
@@ -90,6 +101,67 @@ struct MoveLPrimitive : public MotionPrimitive
90
101
91
102
urcl::Pose target_pose;
92
103
};
104
+
105
+ struct MovePPrimitive : public MotionPrimitive
106
+ {
107
+ MovePPrimitive (const urcl::Pose& target, const double blend_radius = 0 , const double acceleration = 1.4 ,
108
+ const double velocity = 1.04 )
109
+ {
110
+ type = MotionType::MOVEP;
111
+ target_pose = target;
112
+ this ->acceleration = acceleration;
113
+ this ->velocity = velocity;
114
+ this ->blend_radius = blend_radius;
115
+ }
116
+ urcl::Pose target_pose;
117
+ };
118
+
119
+ struct MoveCPrimitive : public MotionPrimitive
120
+ {
121
+ MoveCPrimitive (const urcl::Pose& via_point, const urcl::Pose& target, const double blend_radius = 0 ,
122
+ const double acceleration = 1.4 , const double velocity = 1.04 , const int32_t mode = 0 )
123
+ {
124
+ type = MotionType::MOVEC;
125
+ via_point_pose = via_point;
126
+ target_pose = target;
127
+ this ->acceleration = acceleration;
128
+ this ->velocity = velocity;
129
+ this ->blend_radius = blend_radius;
130
+ this ->mode = mode;
131
+ }
132
+ urcl::Pose via_point_pose;
133
+ urcl::Pose target_pose;
134
+ int32_t mode = 0 ;
135
+ };
136
+
137
+ struct SplinePrimitive : public MotionPrimitive
138
+ {
139
+ SplinePrimitive (const urcl::vector6d_t & target_positions, const vector6d_t & target_velocities,
140
+ const std::optional<vector6d_t >& target_accelerations,
141
+ const std::chrono::duration<double > duration = std::chrono::milliseconds(0 ))
142
+ {
143
+ type = MotionType::SPLINE;
144
+ this ->target_positions = target_positions;
145
+ this ->target_velocities = target_velocities;
146
+ this ->target_accelerations = target_accelerations;
147
+ this ->duration = duration;
148
+ }
149
+
150
+ control::TrajectorySplineType getSplineType () const
151
+ {
152
+ if (target_accelerations.has_value ())
153
+ {
154
+ return control::TrajectorySplineType::SPLINE_QUINTIC;
155
+ }
156
+ else
157
+ {
158
+ return control::TrajectorySplineType::SPLINE_CUBIC;
159
+ }
160
+ }
161
+ vector6d_t target_positions;
162
+ vector6d_t target_velocities;
163
+ std::optional<vector6d_t > target_accelerations;
164
+ };
93
165
} // namespace control
94
166
} // namespace urcl
95
- #endif // UR_CLIENT_LIBRARY_MOTION_PRIMITIVES_H_INCLUDED
167
+ #endif // UR_CLIENT_LIBRARY_MOTION_PRIMITIVES_H_INCLUDED
0 commit comments