@@ -89,6 +89,8 @@ int main(int argc, char* argv[])
8989
9090 std::make_shared<urcl::control::MoveLPrimitive>(urcl::Pose (-0.203 , 0.263 , 0.559 , 0.68 , -1.083 , -2.076 ), 0.1 ,
9191 std::chrono::seconds (2 )),
92+ std::make_shared<urcl::control::MoveLPrimitive>(urcl::Q{ -1.57 , -1.6 , 1.6 , -0.7 , 0.7 , 0.2 }, 0.1 ,
93+ std::chrono::seconds (2 )),
9294 std::make_shared<urcl::control::MovePPrimitive>(urcl::Pose{ -0.203 , 0.463 , 0.559 , 0.68 , -1.083 , -2.076 }, 0.1 , 0.4 ,
9395 0.4 ),
9496 std::make_shared<urcl::control::OptimoveJPrimitive>(urcl::vector6d_t { -1.57 , -1.57 , 1.6 , -0.5 , 0.4 , 0.3 }, 0.1 , 0.4 ,
@@ -100,17 +102,52 @@ int main(int argc, char* argv[])
100102
101103 double goal_time_sec = 2.0 ;
102104
103- // acceleration / velocity parametrization
104- instruction_executor->moveJ ({ -1.57 , -1.57 , 0 , 0 , 0 , 0 }, 2.0 , 2.0 );
105- // goal time parametrization -- acceleration and velocity will be ignored
105+ // acceleration / velocity parametrization brace-init style will be interpreted as joint
106+ // positions
107+ instruction_executor->moveJ ({ -1.742 , -1.726 , -2.214 , -0.773 , 1.572 , -0.171 }, 2.0 , 2.0 );
108+
109+ // Passing a pose to moveJ will make it internally solve inverse kinematics.
110+ instruction_executor->moveJ (urcl::Pose{ -0.206 , -0.6437 , 0.202 , 0.0 , 3.140 , 0.0 }, 2.0 , 2.0 );
111+
112+ // To provide a q_near hint for the IK solver a joint configuration near the target can be added to a pose.
113+ urcl::Pose target_pose{ -0.206 , -0.6437 , 0.202 , 0.0 , 3.140 , 0.0 };
114+ target_pose.setQNear (urcl::Q{ -1.7 , -4 , 1.5 , -1 , 1.5 , 0 });
115+ instruction_executor->moveJ (target_pose, 2.0 , 2.0 );
116+
117+ // q_near can also be set directly upon pose construction
118+ instruction_executor->moveJ (
119+ urcl::Pose{ -0.206 , -0.6437 , 0.202 , 0.0 , 3.140 , 0.0 , urcl::Q{ -1.7 , -4 , 1.5 , -1 , 1.5 , 0 } }, 2.0 , 2.0 );
120+
121+ // goal time parametrization -- acceleration and velocity will be scaled to meed the goal time.
106122 instruction_executor->moveJ ({ -1.57 , -1.6 , 1.6 , -0.7 , 0.7 , 0.2 }, 0.1 , 0.1 , goal_time_sec);
107- // acceleration / velocity parametrization
108- instruction_executor->moveL ({ -0.203 , 0.263 , 0.559 , 0.68 , -1.083 , -2.076 }, 1.5 , 1.5 );
109- // goal time parametrization -- acceleration and velocity will be ignored
110- instruction_executor->moveL ({ -0.203 , 0.463 , 0.559 , 0.68 , -1.083 , -2.076 }, 0.1 , 0.1 , goal_time_sec);
111123
112- instruction_executor->moveP ({ -0.203 , 0.463 , 0.759 , 0.68 , -1.083 , -2.076 }, 1.5 , 1.5 );
124+ // moveL calls with brace-init style is interpreted as a pose
125+ instruction_executor->moveL ({ -0.0203 , 0.363 , 0.559 , 0.68 , -1.083 , -2.076 }, 1.5 , 1.5 );
126+ // A pose can also be explicitly passed to moveL
127+ instruction_executor->moveL (urcl::Pose{ -0.0203 , 0.363 , 0.559 , 0.68 , -1.083 , -2.076 }, 1.5 , 1.5 );
128+ // moveL can also accept a joint position target, if explicitly wrapped into a urcl::Q object
129+ instruction_executor->moveL (urcl::Q{ -1.572 , -1.686 , 1.707 , -0.833 , 0.782 , 0.479 }, 1.5 , 1.5 , goal_time_sec);
130+
131+ // moveJ can also accept a Cartesian pose, when given explicitly
132+ instruction_executor->moveJ (urcl::Pose{ -0.0203 , 0.363 , 0.559 , 0.68 , -1.083 , -2.076 }, 0.1 , 0.1 , goal_time_sec);
133+
134+ // moveP can also be called with brace-init (interpreted as pose) or explicitly using a Pose or Q
135+ instruction_executor->moveP ({ -0.2 , 0.363 , 0.559 , 0.68 , -1.083 , -2.076 }, 0.2 , 0.2 );
136+ instruction_executor->moveP (urcl::Pose{ -0.0203 , 0.303 , 0.559 , 0.68 , -1.083 , -2.076 }, 0.2 , 0.2 );
137+ instruction_executor->moveP (urcl::Q{ -1.57 , -1.83 , 1.707 , -0.833 , 0.782 , 0.479 }, 0.2 , 0.2 );
138+
139+ // For moveC via and target can be a Pose or Q. When brace-init style lists are given, values are
140+ // interpreted as Pose.
141+ instruction_executor->moveC (urcl::Pose{ -0.1 , 0.463 , 0.559 , 0.68 , -1.083 , -2.076 },
142+ urcl::Pose{ -0.3203 , 0.303 , 0.559 , 0.68 , -1.083 , -2.076 });
143+ instruction_executor->moveC (urcl::Pose{ -0.1 , 0.463 , 0.559 , 0.68 , -1.083 , -2.076 },
144+ urcl::Q{ -1.57 , -1.83 , 1.707 , -0.833 , 0.782 , 0.479 });
145+
146+ // For optimove functions, the same target rules as for moveJ and moveL apply.
147+ instruction_executor->optimoveJ ({ -1.57 , -1.6 , 1.6 , -0.7 , 0.7 , 0.2 }, 1.0 , 1.0 );
148+ instruction_executor->optimoveL (urcl::Pose{ -0.0203 , 0.363 , 0.559 , 0.68 , -1.083 , -2.076 }, 1.0 , 1.0 );
149+ instruction_executor->optimoveL (urcl::Q{ -1.572 , -1.686 , 1.707 , -0.833 , 0.782 , 0.479 }, 1.0 , 1.0 );
150+ instruction_executor->optimoveJ (urcl::Pose{ -0.0203 , 0.363 , 0.559 , 0.68 , -1.083 , -2.076 }, 1.0 , 1.0 );
113151
114- g_my_robot->getUrDriver ()->stopControl ();
115152 return 0 ;
116- }
153+ }
0 commit comments