@@ -66,29 +66,15 @@ bool urcl::InstructionExecutor::executeMotion(
6666
6767 for (const auto & primitive : motion_sequence)
6868 {
69- switch (primitive-> type )
69+ try
7070 {
71- case control::MotionType::MOVEJ:
72- {
73- auto movej_primitive = std::static_pointer_cast<control::MoveJPrimitive>(primitive);
74- driver_->writeTrajectoryPoint (movej_primitive->target_joint_configuration , primitive->acceleration ,
75- primitive->velocity , false , primitive->duration .count (), primitive->blend_radius );
76- break ;
77- }
78- case control::MotionType::MOVEL:
79- {
80- auto movel_primitive = std::static_pointer_cast<control::MoveLPrimitive>(primitive);
81- urcl::vector6d_t pose_vec = { movel_primitive->target_pose .x , movel_primitive->target_pose .y ,
82- movel_primitive->target_pose .z , movel_primitive->target_pose .rx ,
83- movel_primitive->target_pose .ry , movel_primitive->target_pose .rz };
84- driver_->writeTrajectoryPoint (pose_vec, primitive->acceleration , primitive->velocity , true ,
85- primitive->duration .count (), primitive->blend_radius );
86- break ;
87- }
88- default :
89- URCL_LOG_ERROR (" Unsupported motion type" );
90- // The hardware will complain about missing trajectory points and return a failure for
91- // trajectory execution. Hence, we need to step into the running loop below.
71+ driver_->writeMotionPrimitive (primitive);
72+ }
73+ catch (const UnsupportedMotionType&)
74+ {
75+ URCL_LOG_ERROR (" Unsupported motion type" );
76+ // The hardware will complain about missing trajectory points and return a failure for
77+ // trajectory execution. Hence, we need to step into the running loop below.
9278 }
9379 }
9480 trajectory_running_ = true ;
@@ -120,6 +106,12 @@ bool urcl::InstructionExecutor::moveL(const urcl::Pose& target, const double acc
120106 target, blend_radius, std::chrono::milliseconds (static_cast <int >(time * 1000 )), acceleration, velocity) });
121107}
122108
109+ bool urcl::InstructionExecutor::moveP (const urcl::Pose& target, const double acceleration, const double velocity,
110+ const double blend_radius)
111+ {
112+ return executeMotion ({ std::make_shared<control::MovePPrimitive>(target, blend_radius, acceleration, velocity) });
113+ }
114+
123115bool urcl::InstructionExecutor::cancelMotion ()
124116{
125117 cancel_requested_ = true ;
0 commit comments