test_time_optimal_trajectory_generation.cpp
Go to the documentation of this file.
1 /*
2  * Copyright (c) 2011, Georgia Tech Research Corporation
3  * All rights reserved.
4  *
5  * Author: Tobias Kunz <tobias@gatech.edu>
6  * Date: 05/2012
7  *
8  * Humanoid Robotics Lab Georgia Institute of Technology
9  * Director: Mike Stilman http://www.golems.org
10  *
11  * Algorithm details and publications:
12  * http://www.golems.org/node/1570
13  *
14  * This file is provided under the following "BSD-style" License:
15  * Redistribution and use in source and binary forms, with or
16  * without modification, are permitted provided that the following
17  * conditions are met:
18  * * Redistributions of source code must retain the above copyright
19  * notice, this list of conditions and the following disclaimer.
20  * * Redistributions in binary form must reproduce the above
21  * copyright notice, this list of conditions and the following
22  * disclaimer in the documentation and/or other materials provided
23  * with the distribution.
24  * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND
25  * CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES,
26  * INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
27  * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
28  * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR
29  * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
30  * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
31  * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
32  * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
33  * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
34  * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
35  * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
36  * POSSIBILITY OF SUCH DAMAGE.
37  */
38 
39 #include <gtest/gtest.h>
42 #include <urdf_parser/urdf_parser.h>
43 
47 
48 TEST(time_optimal_trajectory_generation, test1)
49 {
50  Eigen::VectorXd waypoint(4);
51  std::list<Eigen::VectorXd> waypoints;
52 
53  waypoint << 1424.0, 984.999694824219, 2126.0, 0.0;
54  waypoints.push_back(waypoint);
55  waypoint << 1423.0, 985.000244140625, 2126.0, 0.0;
56  waypoints.push_back(waypoint);
57 
58  Eigen::VectorXd max_velocities(4);
59  max_velocities << 1.3, 0.67, 0.67, 0.5;
60  Eigen::VectorXd max_accelerations(4);
61  max_accelerations << 0.00249, 0.00249, 0.00249, 0.00249;
62 
63  Trajectory trajectory(Path(waypoints, 100.0), max_velocities, max_accelerations, 10.0);
64  EXPECT_TRUE(trajectory.isValid());
65  EXPECT_DOUBLE_EQ(40.080256821829849, trajectory.getDuration());
66 
67  // Test start matches
68  EXPECT_DOUBLE_EQ(1424.0, trajectory.getPosition(0.0)[0]);
69  EXPECT_DOUBLE_EQ(984.999694824219, trajectory.getPosition(0.0)[1]);
70  EXPECT_DOUBLE_EQ(2126.0, trajectory.getPosition(0.0)[2]);
71  EXPECT_DOUBLE_EQ(0.0, trajectory.getPosition(0.0)[3]);
72 
73  // Test end matches
74  EXPECT_DOUBLE_EQ(1423.0, trajectory.getPosition(trajectory.getDuration())[0]);
75  EXPECT_DOUBLE_EQ(985.000244140625, trajectory.getPosition(trajectory.getDuration())[1]);
76  EXPECT_DOUBLE_EQ(2126.0, trajectory.getPosition(trajectory.getDuration())[2]);
77  EXPECT_DOUBLE_EQ(0.0, trajectory.getPosition(trajectory.getDuration())[3]);
78 
79  // Start at rest and end at rest
80  const double traj_duration = trajectory.getDuration();
81  EXPECT_NEAR(0.0, trajectory.getVelocity(0.0)[0], 0.1);
82  EXPECT_NEAR(0.0, trajectory.getVelocity(traj_duration)[0], 0.1);
83 }
84 
85 TEST(time_optimal_trajectory_generation, test2)
86 {
87  Eigen::VectorXd waypoint(4);
88  std::list<Eigen::VectorXd> waypoints;
89 
90  waypoint << 1427.0, 368.0, 690.0, 90.0;
91  waypoints.push_back(waypoint);
92  waypoint << 1427.0, 368.0, 790.0, 90.0;
93  waypoints.push_back(waypoint);
94  waypoint << 952.499938964844, 433.0, 1051.0, 90.0;
95  waypoints.push_back(waypoint);
96  waypoint << 452.5, 533.0, 1051.0, 90.0;
97  waypoints.push_back(waypoint);
98  waypoint << 452.5, 533.0, 951.0, 90.0;
99  waypoints.push_back(waypoint);
100 
101  Eigen::VectorXd max_velocities(4);
102  max_velocities << 1.3, 0.67, 0.67, 0.5;
103  Eigen::VectorXd max_accelerations(4);
104  max_accelerations << 0.002, 0.002, 0.002, 0.002;
105 
106  Trajectory trajectory(Path(waypoints, 100.0), max_velocities, max_accelerations, 10.0);
107  EXPECT_TRUE(trajectory.isValid());
108  EXPECT_DOUBLE_EQ(1922.1418427445944, trajectory.getDuration());
109 
110  // Test start matches
111  EXPECT_DOUBLE_EQ(1427.0, trajectory.getPosition(0.0)[0]);
112  EXPECT_DOUBLE_EQ(368.0, trajectory.getPosition(0.0)[1]);
113  EXPECT_DOUBLE_EQ(690.0, trajectory.getPosition(0.0)[2]);
114  EXPECT_DOUBLE_EQ(90.0, trajectory.getPosition(0.0)[3]);
115 
116  // Test end matches
117  EXPECT_DOUBLE_EQ(452.5, trajectory.getPosition(trajectory.getDuration())[0]);
118  EXPECT_DOUBLE_EQ(533.0, trajectory.getPosition(trajectory.getDuration())[1]);
119  EXPECT_DOUBLE_EQ(951.0, trajectory.getPosition(trajectory.getDuration())[2]);
120  EXPECT_DOUBLE_EQ(90.0, trajectory.getPosition(trajectory.getDuration())[3]);
121 
122  // Start at rest and end at rest
123  const double traj_duration = trajectory.getDuration();
124  EXPECT_NEAR(0.0, trajectory.getVelocity(0.0)[0], 0.1);
125  EXPECT_NEAR(0.0, trajectory.getVelocity(traj_duration)[0], 0.1);
126 }
127 
128 TEST(time_optimal_trajectory_generation, test3)
129 {
130  Eigen::VectorXd waypoint(4);
131  std::list<Eigen::VectorXd> waypoints;
132 
133  waypoint << 1427.0, 368.0, 690.0, 90.0;
134  waypoints.push_back(waypoint);
135  waypoint << 1427.0, 368.0, 790.0, 90.0;
136  waypoints.push_back(waypoint);
137  waypoint << 952.499938964844, 433.0, 1051.0, 90.0;
138  waypoints.push_back(waypoint);
139  waypoint << 452.5, 533.0, 1051.0, 90.0;
140  waypoints.push_back(waypoint);
141  waypoint << 452.5, 533.0, 951.0, 90.0;
142  waypoints.push_back(waypoint);
143 
144  Eigen::VectorXd max_velocities(4);
145  max_velocities << 1.3, 0.67, 0.67, 0.5;
146  Eigen::VectorXd max_accelerations(4);
147  max_accelerations << 0.002, 0.002, 0.002, 0.002;
148 
149  Trajectory trajectory(Path(waypoints, 100.0), max_velocities, max_accelerations);
150  EXPECT_TRUE(trajectory.isValid());
151  EXPECT_DOUBLE_EQ(1919.5597888812974, trajectory.getDuration());
152 
153  // Test start matches
154  EXPECT_DOUBLE_EQ(1427.0, trajectory.getPosition(0.0)[0]);
155  EXPECT_DOUBLE_EQ(368.0, trajectory.getPosition(0.0)[1]);
156  EXPECT_DOUBLE_EQ(690.0, trajectory.getPosition(0.0)[2]);
157  EXPECT_DOUBLE_EQ(90.0, trajectory.getPosition(0.0)[3]);
158 
159  // Test end matches
160  EXPECT_DOUBLE_EQ(452.5, trajectory.getPosition(trajectory.getDuration())[0]);
161  EXPECT_DOUBLE_EQ(533.0, trajectory.getPosition(trajectory.getDuration())[1]);
162  EXPECT_DOUBLE_EQ(951.0, trajectory.getPosition(trajectory.getDuration())[2]);
163  EXPECT_DOUBLE_EQ(90.0, trajectory.getPosition(trajectory.getDuration())[3]);
164 
165  // Start at rest and end at rest
166  const double traj_duration = trajectory.getDuration();
167  EXPECT_NEAR(0.0, trajectory.getVelocity(0.0)[0], 0.1);
168  EXPECT_NEAR(0.0, trajectory.getVelocity(traj_duration)[0], 0.1);
169 }
170 
171 // Test that totg algorithm doesn't give large acceleration
172 TEST(time_optimal_trajectory_generation, testLargeAccel)
173 {
174  double path_tolerance = 0.1;
175  double resample_dt = 0.1;
176  Eigen::VectorXd waypoint(6);
177  std::list<Eigen::VectorXd> waypoints;
178  Eigen::VectorXd max_velocities(6);
179  Eigen::VectorXd max_accelerations(6);
180 
181  // Waypoints
182  // clang-format off
183  waypoint << 1.6113056281076339,
184  -0.21400163389235427,
185  -1.974502599739185,
186  9.9653618690354051e-12,
187  -1.3810916877429624,
188  1.5293902838041467;
189  waypoints.push_back(waypoint);
190 
191  waypoint << 1.6088016187976597,
192  -0.21792862470933924,
193  -1.9758628799742952,
194  0.00010424017303217738,
195  -1.3835690515335755,
196  1.5279972853269816;
197  waypoints.push_back(waypoint);
198 
199  waypoint << 1.5887695443178671,
200  -0.24934455124521923,
201  -1.9867451218551782,
202  0.00093816147756670078,
203  -1.4033879618584812,
204  1.5168532975096607;
205  waypoints.push_back(waypoint);
206 
207  waypoint << 1.1647412393815282,
208  -0.91434018564402375,
209  -2.2170946337498498,
210  0.018590164397622583,
211  -1.8229041212673529,
212  1.2809632867583278;
213  waypoints.push_back(waypoint);
214 
215  // Max velocities
216  max_velocities << 0.89535390627300004,
217  0.89535390627300004,
218  0.79587013890930003,
219  0.92022484811399996,
220  0.82074108075029995,
221  1.3927727430915;
222  // Max accelerations
223  max_accelerations << 0.82673490883799994,
224  0.78539816339699997,
225  0.60883578557700002,
226  3.2074759432319997,
227  1.4398966328939999,
228  4.7292792634680003;
229  // clang-format on
230 
231  Trajectory parameterized(Path(waypoints, path_tolerance), max_velocities, max_accelerations, 0.001);
232 
233  ASSERT_TRUE(parameterized.isValid());
234 
235  size_t sample_count = std::ceil(parameterized.getDuration() / resample_dt);
236  for (size_t sample = 0; sample <= sample_count; ++sample)
237  {
238  // always sample the end of the trajectory as well
239  double t = std::min(parameterized.getDuration(), sample * resample_dt);
240  Eigen::VectorXd acceleration = parameterized.getAcceleration(t);
241 
242  ASSERT_EQ(acceleration.size(), 6);
243  for (std::size_t i = 0; i < 6; ++i)
244  EXPECT_NEAR(acceleration(i), 0.0, 100.0) << "Invalid acceleration at position " << sample_count << "\n";
245  }
246 }
247 
248 TEST(time_optimal_trajectory_generation, testPluginAPI)
249 {
250  constexpr auto robot_name{ "panda" };
251  constexpr auto group_name{ "panda_arm" };
252 
254  ASSERT_TRUE((bool)robot_model) << "Failed to load robot model" << robot_name;
255  auto group = robot_model->getJointModelGroup(group_name);
256  ASSERT_TRUE((bool)group) << "Failed to load joint model group " << group_name;
257  moveit::core::RobotState waypoint_state(robot_model);
258  waypoint_state.setToDefaultValues();
259 
261  waypoint_state.setJointGroupPositions(group, std::vector<double>{ -0.5, -3.52, 1.35, -2.51, -0.88, 0.63, 0.0 });
262  trajectory.addSuffixWayPoint(waypoint_state, 0.1);
263  waypoint_state.setJointGroupPositions(group, std::vector<double>{ -0.5, -3.52, 1.35, -2.51, -0.88, 0.63, 0.0 });
264  trajectory.addSuffixWayPoint(waypoint_state, 0.1);
265  waypoint_state.setJointGroupPositions(group, std::vector<double>{ 0.0, -3.5, 1.4, -1.2, -1.0, -0.2, 0.0 });
266  trajectory.addSuffixWayPoint(waypoint_state, 0.1);
267  waypoint_state.setJointGroupPositions(group, std::vector<double>{ -0.5, -3.52, 1.35, -2.51, -0.88, 0.63, 0.0 });
268  trajectory.addSuffixWayPoint(waypoint_state, 0.1);
269  waypoint_state.setJointGroupPositions(group, std::vector<double>{ 0.0, -3.5, 1.4, -1.2, -1.0, -0.2, 0.0 });
270  trajectory.addSuffixWayPoint(waypoint_state, 0.1);
271  waypoint_state.setJointGroupPositions(group, std::vector<double>{ -0.5, -3.52, 1.35, -2.51, -0.88, 0.63, 0.0 });
272  trajectory.addSuffixWayPoint(waypoint_state, 0.1);
273 
274  // Number TOTG iterations
275  constexpr size_t totg_iterations = 10;
276 
277  // Test computing the dynamics repeatedly with the same totg instance
278  moveit_msgs::RobotTrajectory first_trajectory_msg_start, first_trajectory_msg_end;
279  {
280  robot_trajectory::RobotTrajectory test_trajectory(trajectory, true /* deep copy */);
281 
282  // Test if the trajectory was copied correctly
283  ASSERT_EQ(test_trajectory.getDuration(), trajectory.getDuration());
284  moveit::core::JointBoundsVector test_bounds = test_trajectory.getRobotModel()->getActiveJointModelsBounds();
285  moveit::core::JointBoundsVector original_bounds = trajectory.getRobotModel()->getActiveJointModelsBounds();
286  ASSERT_EQ(test_bounds.size(), original_bounds.size());
287  for (size_t bound_idx = 0; bound_idx < test_bounds.at(0)->size(); ++bound_idx)
288  {
289  ASSERT_EQ(test_bounds.at(0)->at(bound_idx).max_velocity_, original_bounds.at(0)->at(bound_idx).max_velocity_);
290  ASSERT_EQ(test_bounds.at(0)->at(bound_idx).min_velocity_, original_bounds.at(0)->at(bound_idx).min_velocity_);
291  ASSERT_EQ(test_bounds.at(0)->at(bound_idx).velocity_bounded_,
292  original_bounds.at(0)->at(bound_idx).velocity_bounded_);
293 
294  ASSERT_EQ(test_bounds.at(0)->at(bound_idx).max_acceleration_,
295  original_bounds.at(0)->at(bound_idx).max_acceleration_);
296  ASSERT_EQ(test_bounds.at(0)->at(bound_idx).min_acceleration_,
297  original_bounds.at(0)->at(bound_idx).min_acceleration_);
298  ASSERT_EQ(test_bounds.at(0)->at(bound_idx).acceleration_bounded_,
299  original_bounds.at(0)->at(bound_idx).acceleration_bounded_);
300  }
301  ASSERT_EQ(test_trajectory.getWayPointDurationFromPrevious(1), trajectory.getWayPointDurationFromPrevious(1));
302 
304  ASSERT_TRUE(totg.computeTimeStamps(test_trajectory)) << "Failed to compute time stamps";
305 
306  test_trajectory.getRobotTrajectoryMsg(first_trajectory_msg_start);
307 
308  // Iteratively recompute timestamps with same totg instance
309  for (size_t i = 0; i < totg_iterations; ++i)
310  {
311  bool totg_success = totg.computeTimeStamps(test_trajectory);
312  EXPECT_TRUE(totg_success) << "Failed to compute time stamps with a same TOTG instance in iteration " << i;
313  }
314 
315  test_trajectory.getRobotTrajectoryMsg(first_trajectory_msg_end);
316  }
317 
318  // Test computing the dynamics repeatedly with one TOTG instance per call
319  moveit_msgs::RobotTrajectory second_trajectory_msg_start, second_trajectory_msg_end;
320  {
321  robot_trajectory::RobotTrajectory test_trajectory(trajectory, true /* deep copy */);
322 
323  {
325  ASSERT_TRUE(totg.computeTimeStamps(test_trajectory)) << "Failed to compute time stamps";
326  }
327 
328  test_trajectory.getRobotTrajectoryMsg(second_trajectory_msg_start);
329 
330  // Iteratively recompute timestamps with new totg instances
331  for (size_t i = 0; i < totg_iterations; ++i)
332  {
334  bool totg_success = totg.computeTimeStamps(test_trajectory);
335  EXPECT_TRUE(totg_success) << "Failed to compute time stamps with a new TOTG instance in iteration " << i;
336  }
337 
338  test_trajectory.getRobotTrajectoryMsg(second_trajectory_msg_end);
339  }
340 
341  // Make sure trajectories produce equal waypoints independent of TOTG instances
342  ASSERT_EQ(first_trajectory_msg_start, second_trajectory_msg_start);
343  ASSERT_EQ(first_trajectory_msg_end, second_trajectory_msg_end);
344 
345  // Iterate on the original trajectory again
346  moveit_msgs::RobotTrajectory third_trajectory_msg_end;
347 
348  {
350  ASSERT_TRUE(totg.computeTimeStamps(trajectory)) << "Failed to compute time stamps";
351  }
352 
353  for (size_t i = 0; i < totg_iterations; ++i)
354  {
356  bool totg_success = totg.computeTimeStamps(trajectory);
357  ASSERT_TRUE(totg_success) << "Failed to compute timestamps on a new TOTG instance in iteration " << i;
358  }
359 
360  // Compare with previous work
361  trajectory.getRobotTrajectoryMsg(third_trajectory_msg_end);
362 
363  // Make sure trajectories produce equal waypoints independent of TOTG instances
364  ASSERT_EQ(first_trajectory_msg_end, third_trajectory_msg_end);
365 }
366 
367 TEST(time_optimal_trajectory_generation, testSingleDofDiscontinuity)
368 {
369  // Test a (prior) specific failure case
370  Eigen::VectorXd waypoint(1);
371  std::list<Eigen::VectorXd> waypoints;
372 
373  const double start_position = 1.881943;
374  waypoint << start_position;
375  waypoints.push_back(waypoint);
376  waypoint << 2.600542;
377  waypoints.push_back(waypoint);
378 
379  Eigen::VectorXd max_velocities(1);
380  max_velocities << 4.54;
381  Eigen::VectorXd max_accelerations(1);
382  max_accelerations << 28.0;
383 
384  Trajectory trajectory(Path(waypoints, 0.1 /* path tolerance */), max_velocities, max_accelerations,
385  0.001 /* timestep */);
386  EXPECT_TRUE(trajectory.isValid());
387 
388  EXPECT_GT(trajectory.getDuration(), 0.0);
389  const double traj_duration = trajectory.getDuration();
390  EXPECT_NEAR(0.320681, traj_duration, 1e-3);
391 
392  // Start matches
393  EXPECT_DOUBLE_EQ(start_position, trajectory.getPosition(0.0)[0]);
394  // Start at rest and end at rest
395  EXPECT_NEAR(0.0, trajectory.getVelocity(0.0)[0], 0.1);
396  EXPECT_NEAR(0.0, trajectory.getVelocity(traj_duration)[0], 0.1);
397 
398  // Check vels and accels at all points
399  for (double time = 0; time < traj_duration; time += 0.01)
400  {
401  // This trajectory has a single switching point
402  double t_switch = 0.1603407;
403  if (time < t_switch)
404  {
405  EXPECT_NEAR(trajectory.getAcceleration(time)[0], max_accelerations[0], 1e-3) << "Time: " << time;
406  }
407  else if (time > t_switch)
408  {
409  EXPECT_NEAR(trajectory.getAcceleration(time)[0], -max_accelerations[0], 1e-3) << "Time: " << time;
410  }
411  }
412 }
413 
414 TEST(time_optimal_trajectory_generation, testMimicJoint)
415 {
416  const std::string urdf = R"(<?xml version="1.0" ?>
417  <robot name="one_robot">
418  <link name="base_link"/>
419  <link name="link_a"/>
420  <link name="link_b"/>
421  <joint name="joint_a" type="continuous">
422  <axis xyz="0 1 0"/>
423  <parent link="base_link"/>
424  <child link="link_a"/>
425  <limit effort="3" velocity="3"/>
426  </joint>
427  <joint name="joint_b" type="continuous">
428  <axis xyz="1 0 0"/>
429  <parent link="link_a"/>
430  <child link="link_b"/>
431  <mimic joint="joint_a" multiplier="2" />
432  <limit effort="3" velocity="3"/>
433  </joint>
434  </robot>)";
435 
436  const std::string srdf = R"(<?xml version="1.0" ?>
437  <robot name="one_robot">
438  <virtual_joint name="base_joint" child_link="base_link" parent_frame="odom_combined" type="planar"/>
439  <group name="group">
440  <joint name="joint_a"/>
441  <joint name="joint_b"/>
442  </group>
443  </robot>)";
444 
445  urdf::ModelInterfaceSharedPtr urdf_model = urdf::parseURDF(urdf);
446  srdf::ModelSharedPtr srdf_model = std::make_shared<srdf::Model>();
447  srdf_model->initString(*urdf_model, srdf);
448  auto robot_model = std::make_shared<moveit::core::RobotModel>(urdf_model, srdf_model);
449  ASSERT_TRUE((bool)robot_model) << "Failed to load robot model";
450 
451  auto group = robot_model->getJointModelGroup("group");
452  ASSERT_TRUE((bool)group) << "Failed to load joint model group ";
453  moveit::core::RobotState waypoint_state(robot_model);
454  waypoint_state.setToDefaultValues();
455 
457  waypoint_state.setJointGroupActivePositions(group, std::vector<double>{ -0.5 });
458  trajectory.addSuffixWayPoint(waypoint_state, 0.1);
459  waypoint_state.setJointGroupActivePositions(group, std::vector<double>{ 100.0 });
460  trajectory.addSuffixWayPoint(waypoint_state, 0.1);
461 
463  ASSERT_TRUE(totg.computeTimeStamps(trajectory)) << "Failed to compute time stamps";
464 }
465 
466 int main(int argc, char** argv)
467 {
468  testing::InitGoogleTest(&argc, argv);
469  return RUN_ALL_TESTS();
470 }
moveit::core
Core components of MoveIt.
Definition: kinematics_base.h:83
trajectory_processing::Trajectory::getVelocity
Eigen::VectorXd getVelocity(double time) const
Return the velocity vector for a given point in time.
Definition: time_optimal_trajectory_generation.cpp:822
robot_trajectory::RobotTrajectory::getRobotModel
const moveit::core::RobotModelConstPtr & getRobotModel() const
Definition: robot_trajectory.h:113
srdf::ModelSharedPtr
std::shared_ptr< Model > ModelSharedPtr
moveit::core::RobotState::setJointGroupActivePositions
void setJointGroupActivePositions(const JointModelGroup *group, const std::vector< double > &gstate)
Given positions for the variables of active joints that make up a group, in the order found in the gr...
Definition: robot_state.cpp:609
robot_trajectory::RobotTrajectory::addSuffixWayPoint
RobotTrajectory & addSuffixWayPoint(const moveit::core::RobotState &state, double dt)
Add a point to the trajectory.
Definition: robot_trajectory.h:205
moveit::core::JointBoundsVector
std::vector< const JointModel::Bounds * > JointBoundsVector
Definition: joint_model_group.h:132
moveit::core::RobotState
Representation of a robot's state. This includes position, velocity, acceleration and effort.
Definition: robot_state.h:155
robot_trajectory::RobotTrajectory::getDuration
double getDuration() const
Definition: robot_trajectory.cpp:114
robot_trajectory::RobotTrajectory
Maintain a sequence of waypoints and the time durations between these waypoints.
Definition: robot_trajectory.h:84
EXPECT_TRUE
#define EXPECT_TRUE(args)
trajectory_processing::TimeOptimalTrajectoryGeneration
Definition: time_optimal_trajectory_generation.h:173
robot_trajectory::RobotTrajectory::getRobotTrajectoryMsg
void getRobotTrajectoryMsg(moveit_msgs::RobotTrajectory &trajectory, const std::vector< std::string > &joint_filter=std::vector< std::string >()) const
Definition: robot_trajectory.cpp:255
trajectory_processing::Trajectory::getDuration
double getDuration() const
Returns the optimal duration of the trajectory.
Definition: time_optimal_trajectory_generation.cpp:777
TEST
TEST(time_optimal_trajectory_generation, test1)
Definition: test_time_optimal_trajectory_generation.cpp:48
EXPECT_NEAR
#define EXPECT_NEAR(a, b, prec)
moveit::core::RobotState::setToDefaultValues
void setToDefaultValues()
Set all joints to their default positions. The default position is 0, or if that is not within bounds...
Definition: robot_state.cpp:434
time_optimal_trajectory_generation.h
robot_trajectory::RobotTrajectory::getWayPointDurationFromPrevious
double getWayPointDurationFromPrevious(std::size_t index) const
Definition: robot_trajectory.h:179
trajectory_processing::Trajectory::getAcceleration
Eigen::VectorXd getAcceleration(double time) const
Return the acceleration vector for a given point in time.
Definition: time_optimal_trajectory_generation.cpp:839
robot_model_test_utils.h
trajectory_processing::Trajectory
Definition: time_optimal_trajectory_generation.h:101
urdf
trajectory_processing::Path
Definition: time_optimal_trajectory_generation.h:74
trajectory_processing::TimeOptimalTrajectoryGeneration::computeTimeStamps
bool computeTimeStamps(robot_trajectory::RobotTrajectory &trajectory, const double max_velocity_scaling_factor=1.0, const double max_acceleration_scaling_factor=1.0) const override
Compute a trajectory with waypoints spaced equally in time (according to resample_dt_)....
Definition: time_optimal_trajectory_generation.h:191
srdf
main
int main(int argc, char **argv)
Definition: test_time_optimal_trajectory_generation.cpp:466
moveit::core::RobotState::setJointGroupPositions
void setJointGroupPositions(const std::string &joint_group_name, const double *gstate)
Given positions for the variables that make up a group, in the order found in the group (including va...
Definition: robot_state.h:671
t
geometry_msgs::TransformStamped t
trajectory_processing::Trajectory::getPosition
Eigen::VectorXd getPosition(double time) const
Return the position/configuration vector for a given point in time.
Definition: time_optimal_trajectory_generation.cpp:805
trajectory_processing::Trajectory::isValid
bool isValid() const
Call this method after constructing the object to make sure the trajectory generation succeeded witho...
Definition: time_optimal_trajectory_generation.cpp:772
moveit::core::loadTestingRobotModel
moveit::core::RobotModelPtr loadTestingRobotModel(const std::string &robot_name)
Loads a robot from moveit_resources.
Definition: robot_model_test_utils.cpp:117


moveit_core
Author(s): Ioan Sucan , Sachin Chitta , Acorn Pooley
autogenerated on Thu Apr 18 2024 02:23:40