@@ -58,8 +58,7 @@ void handleRobotProgramState(bool program_running)
58
58
59
59
void trajDoneCallback (const urcl::control::TrajectoryResult& result)
60
60
{
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 ());
63
62
g_trajectory_done = true ;
64
63
}
65
64
@@ -126,6 +125,8 @@ int main(int argc, char* argv[])
126
125
// Trajectory definition
127
126
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 } };
128
127
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 };
129
130
std::vector<double > blend_radii{ 0.1 , 0.1 };
130
131
131
132
// Trajectory execution
@@ -140,7 +141,8 @@ int main(int argc, char* argv[])
140
141
motion_durations = { 0.0 , 0.0 };
141
142
for (size_t i = 0 ; i < points.size (); i++)
142
143
{
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]);
144
146
}
145
147
146
148
while (!g_trajectory_done)
@@ -159,17 +161,27 @@ int main(int argc, char* argv[])
159
161
std::vector<urcl::vector6d_t > points{ { -0.203 , 0.263 , 0.559 , 0.68 , -1.083 , -2.076 },
160
162
{ -0.203 , 0.463 , 0.559 , 0.68 , -1.083 , -2.076 } };
161
163
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 };
162
166
std::vector<double > blend_radii{ 0.0 , 0.0 };
163
167
164
- // Trajectory execution
168
+ // Trajectory execution of the path that goes through the points twice.
165
169
g_my_driver->writeTrajectoryControlMessage (urcl::control::TrajectoryControlMessage::TRAJECTORY_START,
166
- points.size ());
170
+ points.size () * 2 );
167
171
for (size_t i = 0 ; i < points.size (); i++)
168
172
{
169
173
// setting the cartesian parameter makes it interpret the 6d vector as a pose and use movel
170
174
g_my_driver->writeTrajectoryPoint (points[i], true , motion_durations[i], blend_radii[i]);
171
175
}
172
176
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
+
173
185
while (!g_trajectory_done)
174
186
{
175
187
std::this_thread::sleep_for (std::chrono::milliseconds (100 ));
0 commit comments