3232#define UR_CLIENT_LIBRARY_MOTION_PRIMITIVES_H_INCLUDED
3333
3434#include < chrono>
35+ #include < optional>
3536#include < ur_client_library/types.h>
3637
3738namespace urcl
@@ -48,9 +49,19 @@ enum class MotionType : uint8_t
4849 SPLINE = 51 ,
4950 UNKNOWN = 255
5051};
52+
53+ /* !
54+ * Spline types
55+ */
56+ enum class TrajectorySplineType : int32_t
57+ {
58+ SPLINE_CUBIC = 1 ,
59+ SPLINE_QUINTIC = 2
60+ };
61+
5162struct MotionPrimitive
5263{
53- MotionType type;
64+ MotionType type = MotionType::UNKNOWN ;
5465 std::chrono::duration<double > duration;
5566 double acceleration;
5667 double velocity;
@@ -90,6 +101,67 @@ struct MoveLPrimitive : public MotionPrimitive
90101
91102 urcl::Pose target_pose;
92103};
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+ };
93165} // namespace control
94166} // namespace urcl
95- #endif // UR_CLIENT_LIBRARY_MOTION_PRIMITIVES_H_INCLUDED
167+ #endif // UR_CLIENT_LIBRARY_MOTION_PRIMITIVES_H_INCLUDED
0 commit comments