41#include <moveit_msgs/msg/robot_trajectory.hpp>
42#include <urdf_parser/urdf_parser.h>
43#include <gtest/gtest.h>
77 EXPECT_EQ(trajectory->getGroupName(),
arm_jmg_name_) <<
"Generated trajectory group name does not match";
78 EXPECT_TRUE(trajectory->empty()) <<
"Generated trajectory not empty";
80 double duration_from_previous = 0.1;
81 std::size_t waypoint_count = 5;
82 for (std::size_t ix = 0; ix < waypoint_count; ++ix)
84 trajectory->addSuffixWayPoint(*
robot_state_, duration_from_previous);
88 EXPECT_EQ(trajectory->getDuration(), duration_from_previous * waypoint_count)
89 <<
"Generated trajectory duration incorrect";
90 EXPECT_EQ(waypoint_count, trajectory->getWayPointDurations().size())
91 <<
"Generated trajectory has the wrong number of waypoints";
92 EXPECT_EQ(waypoint_count, trajectory->size());
96 robot_trajectory::RobotTrajectoryPtr& trajectory_copy,
bool deepcopy)
99 trajectory_copy = std::make_shared<robot_trajectory::RobotTrajectory>(*trajectory, deepcopy);
101 EXPECT_EQ(trajectory_copy->getDuration(), trajectory->getDuration());
102 EXPECT_EQ(trajectory_copy->getWayPointDurations().size(), trajectory->getWayPointDurations().size());
111 moveit::core::RobotStatePtr trajectory_first_waypoint = trajectory->getWayPointPtr(0);
113 std::vector<double> trajectory_first_state;
114 trajectory_first_waypoint->copyJointGroupPositions(
arm_jmg_name_, trajectory_first_state);
117 trajectory_first_state[0] += 0.01;
118 trajectory_first_waypoint->setJointGroupPositions(
arm_jmg_name_, trajectory_first_state);
121 moveit::core::RobotStatePtr trajectory_first_waypoint_after_update = trajectory->getWayPointPtr(0);
122 std::vector<double> trajectory_first_state_after_update;
123 trajectory_first_waypoint_after_update->copyJointGroupPositions(
arm_jmg_name_, trajectory_first_state_after_update);
124 EXPECT_EQ(trajectory_first_state[0], trajectory_first_state_after_update[0]);
127 double trajectory_first_duration_before_update = trajectory->getWayPointDurationFromPrevious(0);
128 double new_duration = trajectory_first_duration_before_update + 0.1;
129 trajectory->setWayPointDurationFromPrevious(0, new_duration);
132 EXPECT_EQ(trajectory->getWayPointDurationFromPrevious(0), new_duration);
143 std::vector<double> trajectory_first_state;
147 trajectory_first_state[0] += 0.01;
152 std::vector<double> trajectory_first_state_after_update;
154 EXPECT_NE(trajectory_first_state[0], trajectory_first_state_after_update[0]);
158class OneRobot :
public testing::Test
163 static const std::string MODEL2 =
164 "<?xml version=\"1.0\" ?>"
165 "<robot name=\"one_robot\">"
166 "<link name=\"base_link\">"
168 " <mass value=\"2.81\"/>"
169 " <origin rpy=\"0 0 0\" xyz=\"0.0 0.0 .0\"/>"
170 " <inertia ixx=\"0.1\" ixy=\"-0.2\" ixz=\"0.5\" iyy=\"-.09\" iyz=\"1\" izz=\"0.101\"/>"
172 " <collision name=\"my_collision\">"
173 " <origin rpy=\"0 0 0\" xyz=\"0 0 0\"/>"
175 " <box size=\"1 2 1\" />"
179 " <origin rpy=\"0 0 0\" xyz=\"0.0 0 0\"/>"
181 " <box size=\"1 2 1\" />"
185 "<joint name=\"panda_joint0\" type=\"continuous\">"
186 " <axis xyz=\"0 0 1\"/>"
187 " <parent link=\"base_link\"/>"
188 " <child link=\"link_a\"/>"
189 " <origin rpy=\" 0.0 0 0 \" xyz=\"0.0 0 0 \"/>"
191 "<link name=\"link_a\">"
193 " <mass value=\"1.0\"/>"
194 " <origin rpy=\"0 0 0\" xyz=\"0.0 0.0 .0\"/>"
195 " <inertia ixx=\"0.1\" ixy=\"-0.2\" ixz=\"0.5\" iyy=\"-.09\" iyz=\"1\" izz=\"0.101\"/>"
198 " <origin rpy=\"0 0 0\" xyz=\"0 0 0\"/>"
200 " <box size=\"1 2 1\" />"
204 " <origin rpy=\"0 0 0\" xyz=\"0.0 0 0\"/>"
206 " <box size=\"1 2 1\" />"
210 "<joint name=\"joint_b\" type=\"fixed\">"
211 " <parent link=\"link_a\"/>"
212 " <child link=\"link_b\"/>"
213 " <origin rpy=\" 0.0 -0.42 0 \" xyz=\"0.0 0.5 0 \"/>"
215 "<link name=\"link_b\">"
217 " <mass value=\"1.0\"/>"
218 " <origin rpy=\"0 0 0\" xyz=\"0.0 0.0 .0\"/>"
219 " <inertia ixx=\"0.1\" ixy=\"-0.2\" ixz=\"0.5\" iyy=\"-.09\" iyz=\"1\" izz=\"0.101\"/>"
222 " <origin rpy=\"0 0 0\" xyz=\"0 0 0\"/>"
224 " <box size=\"1 2 1\" />"
228 " <origin rpy=\"0 0 0\" xyz=\"0.0 0 0\"/>"
230 " <box size=\"1 2 1\" />"
234 " <joint name=\"panda_joint1\" type=\"prismatic\">"
235 " <axis xyz=\"1 0 0\"/>"
236 " <limit effort=\"100.0\" lower=\"0.0\" upper=\"0.09\" velocity=\"0.2\"/>"
237 " <safety_controller k_position=\"20.0\" k_velocity=\"500.0\" soft_lower_limit=\"0.0\" "
238 "soft_upper_limit=\"0.089\"/>"
239 " <parent link=\"link_b\"/>"
240 " <child link=\"link_c\"/>"
241 " <origin rpy=\" 0.0 0.42 0.0 \" xyz=\"0.0 -0.1 0 \"/>"
243 "<link name=\"link_c\">"
245 " <mass value=\"1.0\"/>"
246 " <origin rpy=\"0 0 0\" xyz=\"0.0 0 .0\"/>"
247 " <inertia ixx=\"0.1\" ixy=\"-0.2\" ixz=\"0.5\" iyy=\"-.09\" iyz=\"1\" izz=\"0.101\"/>"
250 " <origin rpy=\"0 0 0\" xyz=\"0 0 0\"/>"
252 " <box size=\"1 2 1\" />"
256 " <origin rpy=\"0 0 0\" xyz=\"0.0 0 0\"/>"
258 " <box size=\"1 2 1\" />"
262 " <joint name=\"mim_f\" type=\"prismatic\">"
263 " <axis xyz=\"1 0 0\"/>"
264 " <limit effort=\"100.0\" lower=\"0.0\" upper=\"0.19\" velocity=\"0.2\"/>"
265 " <parent link=\"link_c\"/>"
266 " <child link=\"link_d\"/>"
267 " <origin rpy=\" 0.0 0.0 0.0 \" xyz=\"0.1 0.1 0 \"/>"
268 " <mimic joint=\"joint_f\" multiplier=\"1.5\" offset=\"0.1\"/>"
270 " <joint name=\"joint_f\" type=\"prismatic\">"
271 " <axis xyz=\"1 0 0\"/>"
272 " <limit effort=\"100.0\" lower=\"0.0\" upper=\"0.19\" velocity=\"0.2\"/>"
273 " <parent link=\"link_d\"/>"
274 " <child link=\"link_e\"/>"
275 " <origin rpy=\" 0.0 0.0 0.0 \" xyz=\"0.1 0.1 0 \"/>"
277 "<link name=\"link_d\">"
279 " <origin rpy=\"0 0 0\" xyz=\"0 0 0\"/>"
281 " <box size=\"1 2 1\" />"
285 " <origin rpy=\"0 1 0\" xyz=\"0 0.1 0\"/>"
287 " <box size=\"1 2 1\" />"
291 "<link name=\"link_e\">"
293 " <origin rpy=\"0 0 0\" xyz=\"0 0 0\"/>"
295 " <box size=\"1 2 1\" />"
299 " <origin rpy=\"0 1 0\" xyz=\"0 0.1 0\"/>"
301 " <box size=\"1 2 1\" />"
307 static const std::string SMODEL2 =
308 "<?xml version=\"1.0\" ?>"
309 "<robot name=\"one_robot\">"
310 "<virtual_joint name=\"base_joint\" child_link=\"base_link\" parent_frame=\"odom_combined\" type=\"planar\"/>"
311 "<group name=\"panda_arm\">"
312 "<chain base_link=\"base_link\" tip_link=\"link_e\"/>"
313 "<joint name=\"base_joint\"/>"
317 urdf::ModelInterfaceSharedPtr urdf_model = urdf::parseURDF(MODEL2);
318 srdf::ModelSharedPtr srdf_model = std::make_shared<srdf::Model>();
319 srdf_model->initString(*urdf_model, SMODEL2);
320 robot_model_ = std::make_shared<moveit::core::RobotModel>(urdf_model, srdf_model);
323 robot_state_->setVariablePositions({
"panda_joint0" }, { -3.1416 });
341 EXPECT_EQ(trajectory->getGroupName(),
arm_jmg_name_) <<
"Generated trajectory group name does not match";
342 EXPECT_TRUE(trajectory->empty()) <<
"Generated trajectory not empty";
344 double duration_from_previous = 0.1;
345 std::size_t waypoint_count = 5;
346 for (std::size_t ix = 0; ix < waypoint_count; ++ix)
347 trajectory->addSuffixWayPoint(*
robot_state_, duration_from_previous);
349 EXPECT_EQ(trajectory->getDuration(), duration_from_previous * waypoint_count)
350 <<
"Generated trajectory duration incorrect";
351 EXPECT_EQ(waypoint_count, trajectory->getWayPointDurations().size())
352 <<
"Generated trajectory has the wrong number of waypoints";
353 EXPECT_EQ(waypoint_count, trajectory->size());
364 robot_trajectory::RobotTrajectoryPtr trajectory;
365 initTestTrajectory(trajectory);
366 modifyFirstWaypointPtrAndCheckTrajectory(trajectory);
371 robot_trajectory::RobotTrajectoryPtr trajectory;
372 initTestTrajectory(trajectory);
373 modifyFirstWaypointAndCheckTrajectory(trajectory);
378 robot_trajectory::RobotTrajectoryPtr trajectory;
379 initTestTrajectory(trajectory);
380 moveit_msgs::msg::RobotTrajectory initial_trajectory_msg;
381 trajectory->getRobotTrajectoryMsg(initial_trajectory_msg);
383 trajectory->reverse().reverse();
385 moveit_msgs::msg::RobotTrajectory edited_trajectory_msg;
386 trajectory->getRobotTrajectoryMsg(edited_trajectory_msg);
388 EXPECT_EQ(initial_trajectory_msg, edited_trajectory_msg);
393 robot_trajectory::RobotTrajectoryPtr initial_trajectory;
394 initTestTrajectory(initial_trajectory);
395 moveit_msgs::msg::RobotTrajectory initial_trajectory_msg;
396 initial_trajectory->getRobotTrajectoryMsg(initial_trajectory_msg);
406 .
append(*initial_trajectory, 0.1);
409 EXPECT_EQ(trajectory.
getWayPointCount(), initial_trajectory->getWayPointCount() * 2 + 3);
414 robot_trajectory::RobotTrajectoryPtr initial_trajectory;
415 initTestTrajectory(initial_trajectory);
416 EXPECT_EQ(initial_trajectory->getWayPointCount(),
size_t(5));
419 robot_trajectory::RobotTrajectoryPtr traj2;
420 initTestTrajectory(traj2);
421 EXPECT_EQ(traj2->getWayPointCount(),
size_t(5));
424 const double expected_duration = 0.1;
425 initial_trajectory->append(*traj2, expected_duration, 0, 5);
426 EXPECT_EQ(initial_trajectory->getWayPointCount(),
size_t(10));
428 EXPECT_EQ(initial_trajectory->getWayPointDurationFromPrevious(4), expected_duration);
429 EXPECT_EQ(initial_trajectory->getWayPointDurationFromPrevious(5), expected_duration);
430 EXPECT_EQ(initial_trajectory->getWayPointDurationFromPrevious(6), expected_duration);
435 bool deepcopy =
false;
437 robot_trajectory::RobotTrajectoryPtr trajectory;
438 robot_trajectory::RobotTrajectoryPtr trajectory_copy;
440 initTestTrajectory(trajectory);
441 copyTrajectory(trajectory, trajectory_copy, deepcopy);
442 modifyFirstWaypointPtrAndCheckTrajectory(trajectory);
446 std::vector<double> trajectory_first_state_after_update;
447 trajectory_first_waypoint_after_update.
copyJointGroupPositions(arm_jmg_name_, trajectory_first_state_after_update);
451 std::vector<double> trajectory_copy_first_state_after_update;
453 trajectory_copy_first_state_after_update);
456 EXPECT_EQ(trajectory_first_state_after_update[0], trajectory_copy_first_state_after_update[0]);
461 bool deepcopy =
true;
463 robot_trajectory::RobotTrajectoryPtr trajectory;
464 robot_trajectory::RobotTrajectoryPtr trajectory_copy;
466 initTestTrajectory(trajectory);
467 copyTrajectory(trajectory, trajectory_copy, deepcopy);
468 modifyFirstWaypointPtrAndCheckTrajectory(trajectory);
472 std::vector<double> trajectory_first_state_after_update;
473 trajectory_first_waypoint_after_update.
copyJointGroupPositions(arm_jmg_name_, trajectory_first_state_after_update);
477 std::vector<double> trajectory_copy_first_state_after_update;
479 trajectory_copy_first_state_after_update);
482 EXPECT_NE(trajectory_first_state_after_update[0], trajectory_copy_first_state_after_update[0]);
484 EXPECT_NE(trajectory->getWayPointDurationFromPrevious(0), trajectory_copy->getWayPointDurationFromPrevious(0));
489 robot_trajectory::RobotTrajectoryPtr trajectory;
490 initTestTrajectory(trajectory);
492 ASSERT_EQ(5u, trajectory->size());
493 std::vector<double> positions;
495 double start_pos = 0.0;
497 for (
size_t i = 0; i < trajectory->size(); ++i)
499 auto waypoint = trajectory->getWayPointPtr(i);
501 waypoint->copyJointGroupPositions(arm_jmg_name_, positions);
502 start_pos = positions[0];
503 positions[0] += 0.01 * i;
504 waypoint->setJointGroupPositions(arm_jmg_name_, positions);
507 unsigned int count = 0;
508 for (
const auto& waypoint_and_duration : *trajectory)
510 const auto& waypoint = waypoint_and_duration.first;
511 waypoint->copyJointGroupPositions(arm_jmg_name_, positions);
512 EXPECT_EQ(start_pos + count * 0.01, positions[0]);
516 EXPECT_EQ(count, trajectory->size());
519 EXPECT_EQ(trajectory->begin(), trajectory->begin());
520 EXPECT_EQ(trajectory->end(), trajectory->end());
523 EXPECT_NE(trajectory->begin(), trajectory->end());
524 EXPECT_NE(++trajectory->begin(), trajectory->end());
525 EXPECT_NE(++(++trajectory->begin()), trajectory->end());
526 EXPECT_NE(++(++(++trajectory->begin())), trajectory->end());
527 EXPECT_NE(++(++(++(++trajectory->begin()))), trajectory->end());
528 EXPECT_EQ(++(++(++(++(++trajectory->begin())))), trajectory->end());
533 robot_trajectory::RobotTrajectoryPtr trajectory;
534 initTestTrajectory(trajectory);
538 std::vector<double> positions;
539 for (
size_t i = 0; i < trajectory->size(); ++i)
541 auto waypoint = trajectory->getWayPointPtr(i);
542 waypoint->copyJointGroupPositions(arm_jmg_name_, positions);
543 positions[0] += 0.01 * i;
544 waypoint->setJointGroupPositions(arm_jmg_name_, positions);
551 robot_trajectory::RobotTrajectoryPtr trajectory;
552 initTestTrajectory(trajectory);
555 std::vector<double> positions;
556 for (
size_t i = 0; i < trajectory->size(); ++i)
558 auto waypoint = trajectory->getWayPointPtr(i);
559 waypoint->copyJointGroupPositions(arm_jmg_name_, positions);
560 positions[0] += 0.01 * i;
561 waypoint->setJointGroupPositions(arm_jmg_name_, positions);
565 ASSERT_TRUE(smoothness.has_value());
566 EXPECT_GT(smoothness.value(), 0.0);
575 robot_trajectory::RobotTrajectoryPtr trajectory;
576 initTestTrajectory(trajectory);
580 ASSERT_FALSE(density.has_value());
583 std::vector<double> positions;
584 for (
size_t i = 0; i < trajectory->size(); ++i)
586 auto waypoint = trajectory->getWayPointPtr(i);
587 waypoint->copyJointGroupPositions(arm_jmg_name_, positions);
588 positions[0] += 0.01 * i;
589 waypoint->setJointGroupPositions(arm_jmg_name_, positions);
593 ASSERT_TRUE(density.has_value());
594 EXPECT_GT(density.value(), 0.0);
599 EXPECT_FALSE(density.has_value());
604 robot_trajectory::RobotTrajectoryPtr trajectory;
605 initTestTrajectory(trajectory);
606 EXPECT_EQ(trajectory->size(), 5);
607 EXPECT_EQ(trajectory->getDuration(), 0.5);
613 EXPECT_NO_THROW(trajectory->findWayPointIndicesForDurationAfterStart(0.15, before, after, blend));
614 EXPECT_EQ(before, 0);
616 EXPECT_NEAR(blend, 0.5, 1e-6);
618 EXPECT_NO_THROW(trajectory->findWayPointIndicesForDurationAfterStart(0.3, before, after, blend));
619 EXPECT_EQ(before, 1);
621 EXPECT_NEAR(blend, 1.0, 1e-6);
626 robot_trajectory::RobotTrajectoryPtr trajectory;
627 initTestTrajectory(trajectory);
633 const double total_duration = trajectory->getDuration();
634 EXPECT_NO_THROW(trajectory->findWayPointIndicesForDurationAfterStart(total_duration, before, after, blend));
635 EXPECT_EQ(before, 3);
637 EXPECT_DOUBLE_EQ(blend, 1.0);
642 robot_trajectory::RobotTrajectoryPtr trajectory;
643 initTestTrajectory(trajectory);
645 const double total_duration = trajectory->getDuration();
646 const double outbound_duration = total_duration + 100.0;
647 EXPECT_GT(outbound_duration, total_duration);
652 EXPECT_NO_THROW(trajectory->findWayPointIndicesForDurationAfterStart(outbound_duration, before, after, blend));
653 EXPECT_EQ(before, 4);
655 EXPECT_DOUBLE_EQ(blend, 1.0);
661 const double total_duration = empty_traj.
getDuration();
662 EXPECT_DOUBLE_EQ(total_duration, 0.0);
664 const double outbound_duration = 1.0;
665 EXPECT_GT(outbound_duration, total_duration);
671 EXPECT_EQ(before, 0);
673 EXPECT_DOUBLE_EQ(blend, 0.0);
678 robot_trajectory::RobotTrajectoryPtr trajectory;
679 initTestTrajectory(trajectory);
685 EXPECT_NO_THROW(trajectory->findWayPointIndicesForDurationAfterStart(-0.1, before, after, blend));
686 EXPECT_EQ(before, 0);
688 EXPECT_DOUBLE_EQ(blend, 0.0);
700 const double total_duration = trajectory.
getDuration();
702 EXPECT_EQ(before, 0);
704 EXPECT_DOUBLE_EQ(blend, 1.0);
709 const double epsilon = 1e-4;
713 robot_trajectory::RobotTrajectoryPtr trajectory;
714 initTestTrajectory(trajectory);
715 moveit::core::RobotStatePtr& first_waypoint = trajectory->getFirstWayPointPtr();
716 const double random_large_angle = 20.2;
717 first_waypoint->setVariablePosition(
"panda_joint0", random_large_angle);
718 first_waypoint->update();
719 trajectory->unwind();
720 EXPECT_NEAR(trajectory->getFirstWayPoint().getVariablePosition(
"panda_joint0"), 1.350444, epsilon);
726 const double epsilon = 1e-4;
730 robot_trajectory::RobotTrajectoryPtr trajectory;
731 initTestTrajectory(trajectory);
734 const double wrapped_angle = first_waypoint.
getVariablePosition(
"panda_joint0") + 12.566371;
738 trajectory->unwind(first_waypoint);
739 EXPECT_NEAR(trajectory->getFirstWayPoint().getVariablePosition(
"panda_joint0"), wrapped_angle, epsilon);
751 auto maybe_trajectory_msg = toJointTrajectory(trajectory,
true );
754 ASSERT_TRUE(maybe_trajectory_msg.has_value());
756 const auto& traj = maybe_trajectory_msg.value();
757 const auto& joint_names = traj.joint_names;
759 size_t joint_variable_count = 0u;
760 for (
const auto& active_joint : robot_model_->getActiveJointModels())
762 joint_variable_count += active_joint->getVariableCount();
766 EXPECT_EQ(joint_names.size(), joint_variable_count);
767 EXPECT_TRUE(std::find(joint_names.begin(), joint_names.end(),
"base_joint/x") != joint_names.end());
769 ASSERT_EQ(traj.points.size(), 2u);
771 EXPECT_EQ(traj.points.at(0).positions.size(), joint_variable_count);
772 EXPECT_EQ(traj.points.at(1).positions.size(), joint_variable_count);
779 moveit_msgs::msg::RobotTrajectory trajectory_msg;
781 trajectory_msg.multi_dof_joint_trajectory.joint_names = {
"base_joint" };
783 trajectory_msg.multi_dof_joint_trajectory.points.resize(1);
784 trajectory_msg.multi_dof_joint_trajectory.points[0].transforms.resize(1);
785 trajectory_msg.multi_dof_joint_trajectory.points[0].transforms[0].translation.x = 0.01;
787 trajectory_msg.multi_dof_joint_trajectory.points[0].velocities.resize(1);
788 trajectory_msg.multi_dof_joint_trajectory.points[0].velocities[0].linear.x = 0.02;
789 trajectory_msg.multi_dof_joint_trajectory.points[0].velocities[0].linear.y = 0.03;
791 trajectory_msg.multi_dof_joint_trajectory.points[0].accelerations.resize(1);
792 trajectory_msg.multi_dof_joint_trajectory.points[0].accelerations[0].linear.x = 0.04;
793 trajectory_msg.multi_dof_joint_trajectory.points[0].accelerations[0].linear.y = 0.05;
800 EXPECT_EQ(wp.getVariablePosition(
"base_joint/x"), 0.01);
803 EXPECT_EQ(wp.getVariableVelocity(
"base_joint/x"), 0.02);
804 EXPECT_EQ(wp.getVariableVelocity(
"base_joint/y"), 0.03);
807 EXPECT_EQ(wp.getVariableAcceleration(
"base_joint/x"), 0.04);
808 EXPECT_EQ(wp.getVariableAcceleration(
"base_joint/y"), 0.05);
812 testing::InitGoogleTest(&argc, argv);
813 return RUN_ALL_TESTS();
const std::string arm_jmg_name_
void initTestTrajectory(robot_trajectory::RobotTrajectoryPtr &trajectory)
moveit::core::RobotStatePtr robot_state_
moveit::core::RobotModelConstPtr robot_model_
void modifyFirstWaypointPtrAndCheckTrajectory(robot_trajectory::RobotTrajectoryPtr &trajectory)
const std::string robot_model_name_
void copyTrajectory(const robot_trajectory::RobotTrajectoryPtr &trajectory, robot_trajectory::RobotTrajectoryPtr &trajectory_copy, bool deepcopy)
moveit::core::RobotModelConstPtr robot_model_
moveit::core::RobotStatePtr robot_state_
void modifyFirstWaypointAndCheckTrajectory(robot_trajectory::RobotTrajectoryPtr &trajectory)
const std::string arm_jmg_name_
const std::string arm_state_name_
void initTestTrajectory(robot_trajectory::RobotTrajectoryPtr &trajectory)
Representation of a robot's state. This includes position, velocity, acceleration and effort.
void setVariablePosition(const std::string &variable, double value)
Set the position of a single variable. An exception is thrown if the variable name is not known.
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...
void copyJointGroupPositions(const std::string &joint_group_name, std::vector< double > &gstate) const
For a given group, copy the position values of the variables that make up the group into another loca...
double getVariablePosition(const std::string &variable) const
Get the position of a particular variable. An exception is thrown if the variable is not known.
void update(bool force=false)
Update all transforms.
Maintain a sequence of waypoints and the time durations between these waypoints.
RobotTrajectory & reverse()
RobotTrajectory & addPrefixWayPoint(const moveit::core::RobotState &state, double dt)
const std::string & getGroupName() const
RobotTrajectory & addSuffixWayPoint(const moveit::core::RobotState &state, double dt)
Add a point to the trajectory.
void findWayPointIndicesForDurationAfterStart(double duration, int &before, int &after, double &blend) const
Finds the waypoint indices before and after a duration from start.
RobotTrajectory & clear()
RobotTrajectory & setRobotTrajectoryMsg(const moveit::core::RobotState &reference_state, const trajectory_msgs::msg::JointTrajectory &trajectory)
Copy the content of the trajectory message into this class. The trajectory message itself is not requ...
RobotTrajectory & append(const RobotTrajectory &source, double dt, size_t start_index=0, size_t end_index=std::numeric_limits< std::size_t >::max())
Add a specified part of a trajectory to the end of the current trajectory. The default (when start_in...
std::size_t getWayPointCount() const
RobotTrajectory & setGroupName(const std::string &group_name)
const moveit::core::RobotState & getWayPoint(std::size_t index) const
double getDuration() const
RobotTrajectory & insertWayPoint(std::size_t index, const moveit::core::RobotState &state, double dt)
moveit::core::RobotModelPtr loadTestingRobotModel(const std::string &package_name, const std::string &urdf_relative_path, const std::string &srdf_relative_path)
Loads a robot model given a URDF and SRDF file in a package.
std::optional< double > waypointDensity(const RobotTrajectory &trajectory)
Calculate the waypoint density of a trajectory.
std::optional< double > smoothness(const RobotTrajectory &trajectory)
Calculate the smoothness of a given trajectory.
double pathLength(const RobotTrajectory &trajectory)
Calculate the path length of a given trajectory based on the accumulated robot state distances....
int main(int argc, char **argv)
TEST_F(RobotTrajectoryTestFixture, ModifyFirstWaypointByPtr)