@@ -227,6 +227,25 @@ class TrajectoryPointInterfaceTest : public ::testing::Test
227227 (double )spl.acc [0 ] / control::TrajectoryPointInterface::MULT_JOINTSTATE,
228228 (double )spl.vel [0 ] / control::TrajectoryPointInterface::MULT_JOINTSTATE);
229229 }
230+ else if (spl.motion_type == static_cast <int32_t >(control::MotionType::MOVEC))
231+ {
232+ return std::make_shared<control::MoveCPrimitive>(
233+ urcl::Pose{ ((double )spl.vel [0 ]) / control::TrajectoryPointInterface::MULT_JOINTSTATE,
234+ ((double )spl.vel [1 ]) / control::TrajectoryPointInterface::MULT_JOINTSTATE,
235+ ((double )spl.vel [2 ]) / control::TrajectoryPointInterface::MULT_JOINTSTATE,
236+ ((double )spl.vel [3 ]) / control::TrajectoryPointInterface::MULT_JOINTSTATE,
237+ ((double )spl.vel [4 ]) / control::TrajectoryPointInterface::MULT_JOINTSTATE,
238+ ((double )spl.vel [5 ]) / control::TrajectoryPointInterface::MULT_JOINTSTATE },
239+ urcl::Pose{ ((double )spl.pos [0 ]) / control::TrajectoryPointInterface::MULT_JOINTSTATE,
240+ ((double )spl.pos [1 ]) / control::TrajectoryPointInterface::MULT_JOINTSTATE,
241+ ((double )spl.pos [2 ]) / control::TrajectoryPointInterface::MULT_JOINTSTATE,
242+ ((double )spl.pos [3 ]) / control::TrajectoryPointInterface::MULT_JOINTSTATE,
243+ ((double )spl.pos [4 ]) / control::TrajectoryPointInterface::MULT_JOINTSTATE,
244+ ((double )spl.pos [5 ]) / control::TrajectoryPointInterface::MULT_JOINTSTATE },
245+ (double )spl.blend_radius_or_spline_type / control::TrajectoryPointInterface::MULT_TIME,
246+ (double )spl.acc [1 ] / control::TrajectoryPointInterface::MULT_JOINTSTATE,
247+ (double )spl.acc [0 ] / control::TrajectoryPointInterface::MULT_JOINTSTATE, (double )spl.acc [2 ]);
248+ }
230249 else
231250 {
232251 throw std::runtime_error (" Unknown motion type" );
@@ -550,6 +569,28 @@ TEST_F(TrajectoryPointInterfaceTest, send_movep)
550569 EXPECT_EQ (received_primitive->acceleration , acceleration);
551570}
552571
572+ TEST_F (TrajectoryPointInterfaceTest, send_movec)
573+ {
574+ urcl::Pose send_target = { 1.2 , 3.1 , 2.2 , -3.4 , -1.1 , -1.2 };
575+ urcl::Pose send_via = { 0.5 , 0.6 , 0.7 , 0.8 , 0.9 , 1.0 };
576+ double blend_radius = 0.5 ;
577+ double acceleration = 0.7 ;
578+ double velocity = 0.7 ;
579+ double mode = 1 ;
580+ auto primitive =
581+ std::make_shared<control::MoveCPrimitive>(send_via, send_target, blend_radius, acceleration, velocity, mode);
582+
583+ traj_point_interface_->writeMotionPrimitive (primitive);
584+ auto received_primitive = client_->getMotionPrimitive ();
585+ EXPECT_EQ (received_primitive->type , control::MotionType::MOVEC);
586+ EXPECT_EQ (std::static_pointer_cast<control::MoveCPrimitive>(received_primitive)->target_pose , send_target);
587+ EXPECT_EQ (std::static_pointer_cast<control::MoveCPrimitive>(received_primitive)->via_point_pose , send_via);
588+ EXPECT_EQ (received_primitive->blend_radius , blend_radius);
589+ EXPECT_EQ (received_primitive->acceleration , acceleration);
590+ EXPECT_EQ (received_primitive->acceleration , velocity);
591+ EXPECT_EQ (std::static_pointer_cast<control::MoveCPrimitive>(received_primitive)->mode , mode);
592+ }
593+
553594TEST_F (TrajectoryPointInterfaceTest, unsupported_motion_type_throws)
554595{
555596 auto primitive = std::make_shared<control::MotionPrimitive>();
0 commit comments