@@ -58,8 +58,7 @@ void handleRobotProgramState(bool program_running)
5858
5959void trajDoneCallback (const urcl::control::TrajectoryResult& result)
6060{
61- URCL_LOG_INFO (" Trajectory done with result %d" , result);
62- ;
61+ URCL_LOG_INFO (" Trajectory done with result %s" , urcl::control::trajectoryResultToString (result).c_str ());
6362 g_trajectory_done = true ;
6463}
6564
@@ -126,6 +125,8 @@ int main(int argc, char* argv[])
126125 // Trajectory definition
127126 std::vector<urcl::vector6d_t > points{ { -1.57 , -1.57 , 0 , 0 , 0 , 0 }, { -1.57 , -1.6 , 1.6 , -0.7 , 0.7 , 0.2 } };
128127 std::vector<double > motion_durations{ 5.0 , 2.0 };
128+ std::vector<double > velocities{ 2.0 , 2.3 };
129+ std::vector<double > accelerations{ 2.5 , 2.5 };
129130 std::vector<double > blend_radii{ 0.1 , 0.1 };
130131
131132 // Trajectory execution
@@ -140,7 +141,8 @@ int main(int argc, char* argv[])
140141 motion_durations = { 0.0 , 0.0 };
141142 for (size_t i = 0 ; i < points.size (); i++)
142143 {
143- g_my_driver->writeTrajectoryPoint (points[i], 2.0 , 2.0 , false , motion_durations[i], blend_radii[i]);
144+ g_my_driver->writeTrajectoryPoint (points[i], accelerations[i], velocities[i], false , motion_durations[i],
145+ blend_radii[i]);
144146 }
145147
146148 while (!g_trajectory_done)
@@ -159,17 +161,27 @@ int main(int argc, char* argv[])
159161 std::vector<urcl::vector6d_t > points{ { -0.203 , 0.263 , 0.559 , 0.68 , -1.083 , -2.076 },
160162 { -0.203 , 0.463 , 0.559 , 0.68 , -1.083 , -2.076 } };
161163 std::vector<double > motion_durations{ 5.0 , 5.0 };
164+ std::vector<double > velocities{ 2.0 , 2.3 };
165+ std::vector<double > accelerations{ 2.5 , 2.5 };
162166 std::vector<double > blend_radii{ 0.0 , 0.0 };
163167
164168 // Trajectory execution
165169 g_my_driver->writeTrajectoryControlMessage (urcl::control::TrajectoryControlMessage::TRAJECTORY_START,
166- points.size ());
170+ points.size () * 2 );
167171 for (size_t i = 0 ; i < points.size (); i++)
168172 {
169173 // setting the cartesian parameter makes it interpret the 6d vector as a pose and use movel
170174 g_my_driver->writeTrajectoryPoint (points[i], true , motion_durations[i], blend_radii[i]);
171175 }
172176
177+ // Same motion, but parametrized with acceleration and velocity
178+ motion_durations = { 0.0 , 0.0 };
179+ for (size_t i = 0 ; i < points.size (); i++)
180+ {
181+ g_my_driver->writeTrajectoryPoint (points[i], accelerations[i], velocities[i], true , motion_durations[i],
182+ blend_radii[i]);
183+ }
184+
173185 while (!g_trajectory_done)
174186 {
175187 std::this_thread::sleep_for (std::chrono::milliseconds (100 ));
0 commit comments