8 #include <moveit/ompl_interface/parameterization/model_based_state_space.h>
24 auto path = ompl::geometric::PathGeometric(ss->getSpaceInformation());
25 auto *tstate = ss->getSpaceInformation()->allocState();
26 auto traj_msg = getMessage();
29 for (
const auto &state_vec : traj_msg.joint_trajectory.points)
30 for (
unsigned int j = 0; j < state_vec.positions.size(); j++)
31 tstate->as<ompl_interface::ModelBasedStateSpace::StateType>()->values[j] = state_vec.positions[j];
39 const ompl::geometric::PathGeometric &path)
41 const auto &mbss = std::dynamic_pointer_cast<ompl_interface::ModelBasedStateSpace>(
42 path.getSpaceInformation()->getStateSpace());
45 throw Exception(1,
"Failed to extract StateSpace from provided OMPL path!");
48 for (
std::size_t i = 0; i < path.getStateCount(); ++i)
50 mbss->copyToRobotState(ks, path.getState(i));
51 trajectory_->addSuffixWayPoint(ks, 0.0);
Exception that contains a message and an error code.
void fromOMPLPath(const robot_state::RobotState &reference_state, const ompl::geometric::PathGeometric &path)
Sets the trajectory from an OMPL Path and a reference state.
ompl::geometric::PathGeometric toOMPLPath(const ompl::geometric::SimpleSetupPtr &ss)
Converts to an OMPL Path given an OMPL simple_setup.
OMPLTrajectory(const RobotConstPtr &robot, const std::string &group)
Constructor.
A const shared pointer wrapper for robowflex::Robot.
The Trajectory class is a wrapper around MoveIt!'s robot_trajectory::RobotTrajectory,...
Functions for loading and animating robots in Blender.
Main namespace. Contains all library classes and functions.
robot_trajectory::RobotTrajectory trajectory(rmodel,"right_arm")