71 const RobotModelConstPtr& robot_model_)
75 auto robot_state = std::make_shared<RobotState>(
robot_model_);
76 robot_state->setToDefaultValues();
80 for (std::size_t traj_ix = 0; traj_ix < 3; ++traj_ix)
82 traj.push_back(std::make_shared<RobotState>(*robot_state));
85 ja = robot_state->getVariablePosition(
"a-b-joint");
86 jc = robot_state->getVariablePosition(
"b-c-joint");
90 robot_state->setVariablePosition(
"a-b-joint", ja);
92 robot_state->setVariablePosition(
"b-c-joint", jc);
93 traj.push_back(std::make_shared<RobotState>(*robot_state));
97 robot_state->setVariablePosition(
"a-b-joint", ja);
98 traj.push_back(std::make_shared<RobotState>(*robot_state));
102 robot_state->setVariablePosition(
"b-c-joint", jc);
103 traj.push_back(std::make_shared<RobotState>(*robot_state));
106 traj.push_back(std::make_shared<RobotState>(*robot_state));
113 std::vector<std::shared_ptr<RobotState>> traj;
116 const std::size_t expected_full_traj_len = 7;
119 std::size_t full_traj_len = generateTestTraj(traj, robot_model_);
122 EXPECT_EQ(full_traj_len, expected_full_traj_len);
127 const JointModelGroup* joint_model_group = robot_model_->getJointModelGroup(
"group");
128 std::vector<std::shared_ptr<RobotState>> traj;
131 const std::size_t expected_revolute_jump_traj_len = 4;
132 const std::size_t expected_prismatic_jump_traj_len = 5;
135 std::size_t full_traj_len = generateTestTraj(traj, robot_model_);
136 const double expected_revolute_jump_fraction =
137 static_cast<double>(expected_revolute_jump_traj_len) /
static_cast<double>(full_traj_len);
138 const double expected_prismatic_jump_fraction =
139 static_cast<double>(expected_prismatic_jump_traj_len) /
static_cast<double>(full_traj_len);
145 generateTestTraj(traj, robot_model_);
147 EXPECT_EQ(expected_revolute_jump_traj_len, traj.size());
148 EXPECT_NEAR(expected_revolute_jump_fraction, fraction, 0.01);
151 generateTestTraj(traj, robot_model_);
153 EXPECT_EQ(expected_revolute_jump_traj_len, traj.size());
154 EXPECT_NEAR(expected_revolute_jump_fraction, fraction, 0.01);
157 generateTestTraj(traj, robot_model_);
159 EXPECT_EQ(expected_prismatic_jump_traj_len, traj.size());
160 EXPECT_NEAR(expected_prismatic_jump_fraction, fraction, 0.01);
171 const JointModelGroup* joint_model_group = robot_model_->getJointModelGroup(
"group");
172 std::vector<std::shared_ptr<RobotState>> traj;
175 const std::size_t expected_relative_jump_traj_len = 4;
178 std::size_t full_traj_len = generateTestTraj(traj, robot_model_);
179 const double expected_relative_jump_fraction =
180 static_cast<double>(expected_relative_jump_traj_len) /
static_cast<double>(full_traj_len);
183 double fraction = 0.0;
186 generateTestTraj(traj, robot_model_);
188 EXPECT_EQ(expected_relative_jump_traj_len, traj.size());
189 EXPECT_NEAR(expected_relative_jump_fraction, fraction, 0.01);
192 generateTestTraj(traj, robot_model_);
194 EXPECT_EQ(full_traj_len, traj.size());
195 EXPECT_NEAR(1.0, fraction, 0.01);
static Percentage checkJointSpaceJump(const JointModelGroup *group, std::vector< std::shared_ptr< RobotState > > &path, const JumpThreshold &jump_threshold)
Checks if a path has a joint-space jump, and truncates the path at the jump.
void addChain(const std::string §ion, const std::string &type, const std::vector< geometry_msgs::msg::Pose > &joint_origins={}, urdf::Vector3 joint_axis=urdf::Vector3(1.0, 0.0, 0.0))
Adds a chain of links and joints to the builder. The joint names are generated automatically as "<par...