@@ -42,22 +42,36 @@ namespace urcl
4242namespace control
4343{
4444
45+ /* !
46+ * \brief Discriminator for the motion primitive type sent over the trajectory interface.
47+ *
48+ * The base values (``MOVEJ``, ``MOVEL``, ``MOVEP``, ``MOVEC``, ``OPTIMOVEJ``, ``OPTIMOVEL``) use
49+ * their "natural" target type for the URScript command (joint configuration for ``movej`` /
50+ * ``optimovej``, Cartesian pose for ``movel`` / ``movep`` / ``movec`` / ``optimovel``). The
51+ * additional ``*_POSE`` and ``*_JOINT`` entries indicate that the *other* target kind was
52+ * requested, e.g. ``MOVEJ_POSE`` performs a ``movej`` towards a Cartesian pose, and
53+ * ``MOVEC_POSE_JOINT`` performs a ``movec`` whose via point is a Cartesian pose and whose target
54+ * is a joint configuration.
55+ *
56+ * These values must stay in sync with the ``MOTION_TYPE_*`` constants in
57+ * ``resources/external_control.urscript``.
58+ */
4559enum class MotionType : uint8_t
4660{
47- MOVEJ = 0 ,
48- MOVEL = 1 ,
49- MOVEP = 2 ,
50- MOVEC = 3 ,
51- OPTIMOVEJ = 4 ,
52- OPTIMOVEL = 5 ,
53- MOVEJ_POSE = 6 ,
54- MOVEL_JOINT = 7 ,
55- MOVEP_JOINT = 8 ,
56- MOVEC_JOINT = 9 ,
57- MOVEC_JOINT_POSE = 10 ,
58- MOVEC_POSE_JOINT = 11 ,
59- OPTIMOVEJ_POSE = 12 ,
60- OPTIMOVEL_JOINT = 13 ,
61+ MOVEJ = 0 , // !< ``movej`` towards a joint configuration.
62+ MOVEL = 1 , // !< ``movel`` towards a Cartesian pose.
63+ MOVEP = 2 , // !< ``movep`` towards a Cartesian pose.
64+ MOVEC = 3 , // !< ``movec`` with via and target as Cartesian poses.
65+ OPTIMOVEJ = 4 , // !< ``optimovej`` towards a joint configuration.
66+ OPTIMOVEL = 5 , // !< ``optimovel`` towards a Cartesian pose.
67+ MOVEJ_POSE = 6 , // !< ``movej`` towards a Cartesian pose.
68+ MOVEL_JOINT = 7 , // !< ``movel`` towards a joint configuration.
69+ MOVEP_JOINT = 8 , // !< ``movep`` towards a joint configuration.
70+ MOVEC_JOINT = 9 , // !< ``movec`` with via and target both as joint configurations.
71+ MOVEC_JOINT_POSE = 10 , // !< ``movec`` with a Cartesian via and a joint target.
72+ MOVEC_POSE_JOINT = 11 , // !< ``movec`` with a joint via and a Cartesian target.
73+ OPTIMOVEJ_POSE = 12 , // !< ``optimovej`` towards a Cartesian pose.
74+ OPTIMOVEL_JOINT = 13 , // !< ``optimovel`` towards a joint configuration.
6175 SPLINE = 51 ,
6276 UNKNOWN = 255
6377};
@@ -96,6 +110,14 @@ struct MoveJPrimitive : public MotionPrimitive
96110 this ->velocity = velocity;
97111 this ->blend_radius = blend_radius;
98112 }
113+ /* !
114+ * \brief Construct a MoveJ primitive from a \ref urcl::MotionTarget.
115+ *
116+ * If ``target`` holds a \ref urcl::Q, ``type`` is set to \ref MotionType::MOVEJ and
117+ * ``target_joint_configuration`` is populated. If ``target`` holds a \ref urcl::Pose, ``type``
118+ * is set to \ref MotionType::MOVEJ_POSE and ``target_pose`` is populated instead; the robot
119+ * will internally solve inverse kinematics to reach the pose with a ``movej``.
120+ */
99121 MoveJPrimitive (const urcl::MotionTarget& target, const double blend_radius = 0 ,
100122 const std::chrono::duration<double > duration = std::chrono::milliseconds(0 ),
101123 const double acceleration = 1.4 , const double velocity = 1.04 )
@@ -139,6 +161,15 @@ struct MoveLPrimitive : public MotionPrimitive
139161 this ->velocity = velocity;
140162 this ->blend_radius = blend_radius;
141163 }
164+ /* !
165+ * \brief Construct a MoveL primitive from a \ref urcl::MotionTarget.
166+ *
167+ * If ``target`` holds a \ref urcl::Pose, ``type`` is set to \ref MotionType::MOVEL. If it
168+ * holds a \ref urcl::Q, ``type`` is set to \ref MotionType::MOVEL_JOINT and the configuration
169+ * is stored in ``target_joint_configuration``. The robot will still execute a tool-space
170+ * linear motion, resolving the joint configuration to its forward kinematics pose on the
171+ * controller.
172+ */
142173 MoveLPrimitive (const urcl::MotionTarget& target, const double blend_radius = 0 ,
143174 const std::chrono::duration<double > duration = std::chrono::milliseconds(0 ),
144175 const double acceleration = 1.4 , const double velocity = 1.04 )
@@ -179,6 +210,12 @@ struct MovePPrimitive : public MotionPrimitive
179210 this ->velocity = velocity;
180211 this ->blend_radius = blend_radius;
181212 }
213+ /* !
214+ * \brief Construct a MoveP primitive from a \ref urcl::MotionTarget.
215+ *
216+ * Analogous to \ref MoveJPrimitive / \ref MoveLPrimitive: a \ref urcl::Pose selects
217+ * \ref MotionType::MOVEP, a \ref urcl::Q selects \ref MotionType::MOVEP_JOINT.
218+ */
182219 MovePPrimitive (const MotionTarget& target, const double blend_radius = 0 , const double acceleration = 1.4 ,
183220 const double velocity = 1.04 )
184221 {
@@ -220,6 +257,18 @@ struct MoveCPrimitive : public MotionPrimitive
220257 this ->mode = mode;
221258 }
222259
260+ /* !
261+ * \brief Construct a MoveC primitive from two \ref urcl::MotionTarget values.
262+ *
263+ * Every combination of \ref urcl::Pose and \ref urcl::Q for the via point and the target is
264+ * supported and mapped to the corresponding \ref MotionType (``MOVEC``,
265+ * ``MOVEC_JOINT``, ``MOVEC_POSE_JOINT``, or ``MOVEC_JOINT_POSE``). When a joint configuration
266+ * is used for either role, only the corresponding joint member is populated and the pose
267+ * member is set to a default-constructed \ref urcl::Pose.
268+ *
269+ * \throws urcl::UrException if either variant is ever extended with an alternative that is
270+ * not handled here.
271+ */
223272 MoveCPrimitive (const MotionTarget& via_point, const MotionTarget& target, const double blend_radius = 0 ,
224273 const double acceleration = 1.4 , const double velocity = 1.04 , const int32_t mode = 0 )
225274 {
@@ -326,6 +375,12 @@ struct OptimoveJPrimitive : public MotionPrimitive
326375 this ->velocity = velocity_fraction;
327376 }
328377
378+ /* !
379+ * \brief Construct an OptimoveJ primitive from a \ref urcl::MotionTarget.
380+ *
381+ * A \ref urcl::Q selects \ref MotionType::OPTIMOVEJ, a \ref urcl::Pose selects
382+ * \ref MotionType::OPTIMOVEJ_POSE.
383+ */
329384 OptimoveJPrimitive (const MotionTarget& target, const double blend_radius = 0 ,
330385 const double acceleration_fraction = 0.3 , const double velocity_fraction = 0.3 )
331386 {
@@ -366,6 +421,12 @@ struct OptimoveLPrimitive : public MotionPrimitive
366421 this ->acceleration = acceleration_fraction;
367422 this ->velocity = velocity_fraction;
368423 }
424+ /* !
425+ * \brief Construct an OptimoveL primitive from a \ref urcl::MotionTarget.
426+ *
427+ * A \ref urcl::Pose selects \ref MotionType::OPTIMOVEL, a \ref urcl::Q selects
428+ * \ref MotionType::OPTIMOVEL_JOINT.
429+ */
369430 OptimoveLPrimitive (const MotionTarget& target, const double blend_radius = 0 ,
370431 const double acceleration_fraction = 0.3 , const double velocity_fraction = 0.3 )
371432 {
0 commit comments