Robowflex  v0.1
Making MoveIt Easy
robowflex::darts::StateSpace Class Reference

An OMPL state space for robowflex::darts::World. Can do motion planning for any of the robots or structures in the world. More...

#include <space.h>

+ Inheritance diagram for robowflex::darts::StateSpace:

Classes

class  StateSampler
 Sampler for robowflex::darts::StateSpace. More...
 
class  StateType
 State type for the robowflex::darts::StateSpace. More...
 

Public Member Functions

void setMetricSpace (bool metric)
 
Constructor and Setup
 StateSpace (WorldPtr world)
 Constructor. More...
 
void addGroup (const std::string &name, const std::string &group, std::size_t cyclic=0)
 Add a group to be planned for. More...
 
void addGroupFromJoints (const std::string &group_name, const std::vector< dart::dynamics::Joint * > &joints, std::size_t cyclic=0)
 Add a group to be planned for. More...
 
World State
void setWorldState (WorldPtr world, const ompl::base::State *state) const
 Set the state of a world from an OMPL state. More...
 
void setWorldState (WorldPtr world, const Eigen::Ref< const Eigen::VectorXd > &x) const
 Set the state of a world from a configuration. More...
 
void getWorldState (WorldPtr world, ompl::base::State *state) const
 Get the state of a world in an OMPL state. More...
 
void getWorldState (WorldPtr world, Eigen::Ref< Eigen::VectorXd > x) const
 Get the state of a world in a configuration vector. More...
 
void setWorldGroupState (WorldPtr world, const std::string &group_name, const Eigen::Ref< const Eigen::VectorXd > &x) const
 Set the state of a world from a configuration of a group. More...
 
void getWorldGroupState (WorldPtr world, const std::string &group_name, Eigen::Ref< Eigen::VectorXd > x) const
 Get the group state of a world. More...
 
Getters and Setters
WorldPtr getWorld ()
 Get underlying world. More...
 
const WorldPtrgetWorldConst () const
 Get underlying world. More...
 
std::vector< std::pair< std::size_t, std::size_t > > getIndices () const
 Get the set of indices that is being planned for. Pairs of skeleton index and joint index. More...
 
Eigen::VectorXd getLowerBound () const
 Get a vector of the lower joint bounds for the space. More...
 
Eigen::VectorXd getUpperBound () const
 Get a vector of the upper joint bounds for the space. More...
 
JointPtr getJoint (std::size_t index) const
 Get a joint that is being planned for. More...
 
JointPtr getJoint (const std::string &name) const
 Get a joint that is being planned for. More...
 
const std::vector< JointPtr > & getJoints () const
 Get a vector of the joints being planned for. More...
 
void getGroupState (const std::string &group, const ompl::base::State *state, Eigen::Ref< Eigen::VectorXd > v) const
 From a full state, get only the state of a group. More...
 
void setGroupState (const std::string &group, ompl::base::State *state, const Eigen::Ref< const Eigen::VectorXd > &v) const
 Set a (sub)group state in a full state. More...
 
std::size_t getGroupDimension (const std::string &group) const
 Get the dimension of joint variables for a subgroup. More...
 
std::vector< std::stringgetGroups () const
 Get the names of all groups managed by this space. More...
 
std::vector< std::stringgetGroupDofNames (const std::string &group_name) const
 Get the names of each of the dof controlled by a group. More...
 
OMPL StateSpace Methods
bool isMetricSpace () const override
 
void enforceBounds (ompl::base::State *state) const override
 
bool satisfiesBounds (const ompl::base::State *state) const override
 
double distance (const ompl::base::State *state1, const ompl::base::State *state2) const override
 
double getMaximumExtent () const override
 
bool equalStates (const ompl::base::State *state1, const ompl::base::State *state2) const override
 
void interpolate (const ompl::base::State *from, const ompl::base::State *to, double t, ompl::base::State *state) const override
 
ompl::base::StateSamplerPtr allocDefaultStateSampler () const override
 
ompl::base::State * allocState () const override
 
void freeState (ompl::base::State *state) const override
 

Public Attributes

friend Joint
 
friend RnJoint
 
friend StateSampler
 

Protected Member Functions

void addJoint (const std::string &group_name, const JointPtr &joint)
 
void addJointToGroup (const std::string &group_name, const JointPtr &joint)
 

Protected Attributes

WorldPtr world_
 World to use for planning. More...
 
std::set< dart::dynamics::Joint * > jointset_
 Set of joints used in planning. More...
 
std::vector< std::size_tindices_
 Vector of indices for planning. More...
 
bool metric_ {true}
 Is this space all Rn? More...
 
std::vector< JointPtrjoints_
 Vector of all joints used in planning. More...
 
ompl::RNG rng_
 Random number generator. More...
 
std::map< std::string, std::vector< JointPtr > > group_joints_
 Joints belonging to a group. More...
 
std::map< std::string, std::size_tgroup_dimension_
 Dimension of the group. More...
 

Detailed Description

An OMPL state space for robowflex::darts::World. Can do motion planning for any of the robots or structures in the world.

Definition at line 30 of file space.h.

Constructor & Destructor Documentation

◆ StateSpace()

StateSpace::StateSpace ( WorldPtr  world)

Constructor.

Parameters
[in]worldWorld to plan for.

StateSpace::StateType

Definition at line 56 of file space.cpp.

56  : ompl::base::RealVectorStateSpace(), world_(std::move(world))
57 {
58 }
WorldPtr world_
World to use for planning.
Definition: space.h:257
T move(T... args)

Member Function Documentation

◆ addGroup()

void StateSpace::addGroup ( const std::string name,
const std::string group,
std::size_t  cyclic = 0 
)

Add a group to be planned for.

Parameters
[in]nameName of the robot that has the group.
[in]groupGroup to plan for.
[in]cyclicIf >0, will flatten rotational groups (i.e., SO(2), SO(3)) into Rn spaces, where n is cyclic.

Definition at line 65 of file space.cpp.

66 {
67  auto robot = world_->getRobot(name);
68  if (not robot)
69  {
70  RBX_ERROR("Robot %1% does not exist in world.", name);
71  throw std::runtime_error("Invalid robot");
72  }
73 
74  auto joints = robot->getGroupJoints(group);
75  addGroupFromJoints(group, joints, cyclic);
76 }
void addGroupFromJoints(const std::string &group_name, const std::vector< dart::dynamics::Joint * > &joints, std::size_t cyclic=0)
Add a group to be planned for.
Definition: space.cpp:78
#define RBX_ERROR(fmt,...)
Output a error logging message.
Definition: log.h:102
Functions for loading and animating robots in Blender.

◆ addGroupFromJoints()

void StateSpace::addGroupFromJoints ( const std::string group_name,
const std::vector< dart::dynamics::Joint * > &  joints,
std::size_t  cyclic = 0 
)

Add a group to be planned for.

Parameters
[in]group_nameName of the new group.
[in]jointsJoints to add to this group.
[in]cyclicIf >0, will flatten rotational groups (i.e., SO(2), SO(3)) into Rn spaces, where n is cyclic.

Definition at line 78 of file space.cpp.

80 {
81  group_joints_.emplace(group_name, std::vector<JointPtr>{});
82  group_dimension_.emplace(group_name, 0);
83 
84  for (auto *joint : joints)
85  {
86  if (jointset_.find(joint) != jointset_.end())
87  {
88  addJointToGroup(group_name, getJoint(joint->getName()));
89  continue;
90  }
91 
92  jointset_.emplace(joint);
93 
94  const auto &type = joint->getType();
95  if (type == "RevoluteJoint")
96  {
97  auto *revolute = static_cast<dart::dynamics::RevoluteJoint *>(joint);
98 
99  if (revolute->isCyclic(0))
100  {
101  if (cyclic)
102  {
103  double low = -constants::pi * cyclic;
104  double high = constants::pi * cyclic;
105  addJoint(group_name, std::make_shared<RnJoint>(this, revolute, low, high));
106  }
107  else
108  addJoint(group_name, std::make_shared<SO2Joint>(this, revolute));
109  }
110  else
111  {
112  auto *dof = joint->getDof(0);
113  auto limits = dof->getPositionLimits();
114  addJoint(group_name, std::make_shared<RnJoint>(this, revolute, limits.first, limits.second));
115  }
116  }
117  else if (type == "PrismaticJoint")
118  {
119  auto *prismatic = static_cast<dart::dynamics::PrismaticJoint *>(joint);
120  auto *dof = joint->getDof(0);
121  auto limits = dof->getPositionLimits();
122  addJoint(group_name, std::make_shared<RnJoint>(this, prismatic, limits.first, limits.second));
123  }
124  else if (type == "PlanarJoint")
125  {
126  // Assume XY plane for now
127  auto *planar = static_cast<dart::dynamics::PlanarJoint *>(joint);
128  if (cyclic)
129  {
130  Eigen::Vector3d low;
131  Eigen::Vector3d high;
132 
133  // XY limits
134  for (std::size_t i = 0; i < 2; ++i)
135  {
136  low[i] = world_->getWorkspaceLowConst()[i];
137  high[i] = world_->getWorkspaceHighConst()[i];
138  }
139 
140  low[2] = -constants::pi * cyclic;
141  high[2] = constants::pi * cyclic;
142 
143  addJoint(group_name, std::make_shared<RnJoint>(this, planar, 3, 0, low, high));
144  }
145  else
146  {
147  Eigen::Vector2d low;
148  Eigen::Vector2d high;
149 
150  for (std::size_t i = 0; i < 2; ++i)
151  {
152  low[i] = world_->getWorkspaceLowConst()[i];
153  high[i] = world_->getWorkspaceHighConst()[i];
154  }
155 
156  addJoint(group_name, std::make_shared<RnJoint>(this, planar, 2, 0, low, high));
157  addJoint(group_name, std::make_shared<SO2Joint>(this, planar, 2));
158  }
159  }
160  else if (type == "FreeJoint")
161  {
162  auto *free = static_cast<dart::dynamics::FreeJoint *>(joint);
163 
164  if (cyclic)
165  {
166  double alow = -constants::pi * cyclic;
167  double ahigh = constants::pi * cyclic;
168 
169  Eigen::Vector6d low;
170  Eigen::Vector6d high;
171 
172  for (std::size_t i = 0; i < 3; ++i)
173  {
174  low[i] = alow;
175  high[i] = ahigh;
176  low[3 + i] =
177  std::max({free->getPositionLowerLimit(3 + i), world_->getWorkspaceLowConst()[i]});
178  high[3 + i] =
179  std::min({free->getPositionUpperLimit(3 + i), world_->getWorkspaceHighConst()[i]});
180  }
181  auto j = std::make_shared<RnJoint>(this, free, 6, 0, low, high);
182  addJoint(group_name, j);
183  }
184  else
185  {
186  Eigen::Vector3d low;
187  Eigen::Vector3d high;
188 
189  for (std::size_t i = 0; i < 3; ++i)
190  {
191  low[i] =
192  std::max({free->getPositionLowerLimit(3 + i), world_->getWorkspaceLowConst()[i]});
193  high[i] =
194  std::min({free->getPositionUpperLimit(3 + i), world_->getWorkspaceHighConst()[i]});
195  }
196 
197  addJoint(group_name, std::make_shared<RnJoint>(this, free, 3, 3, low, high));
198  addJoint(group_name, std::make_shared<SO3Joint>(this, free));
199  }
200  }
201  else
202  RBX_WARN("Unknown joint type %1%, skipping.", type);
203  }
204 
205  registerDefaultProjection(
206  std::make_shared<ompl::base::RealVectorRandomLinearProjectionEvaluator>(this, 2));
207 }
void addJointToGroup(const std::string &group_name, const JointPtr &joint)
Definition: space.cpp:218
void addJoint(const std::string &group_name, const JointPtr &joint)
Definition: space.cpp:209
std::set< dart::dynamics::Joint * > jointset_
Set of joints used in planning.
Definition: space.h:259
std::map< std::string, std::vector< JointPtr > > group_joints_
Joints belonging to a group.
Definition: space.h:268
std::map< std::string, std::size_t > group_dimension_
Dimension of the group.
Definition: space.h:269
JointPtr getJoint(std::size_t index) const
Get a joint that is being planned for.
Definition: space.cpp:397
T emplace(T... args)
T end(T... args)
T find(T... args)
T free(T... args)
#define RBX_WARN(fmt,...)
Output a warning logging message.
Definition: log.h:110
T max(T... args)
T min(T... args)
static const double pi
Definition: constants.h:21

◆ addJoint()

void StateSpace::addJoint ( const std::string group_name,
const JointPtr joint 
)
protected

Definition at line 209 of file space.cpp.

210 {
211  joints_.emplace_back(joint);
212  addJointToGroup(group_name, joint);
213 
214  if (not std::dynamic_pointer_cast<RnJoint>(joint))
215  metric_ = false;
216 }
bool metric_
Is this space all Rn?
Definition: space.h:262
std::vector< JointPtr > joints_
Vector of all joints used in planning.
Definition: space.h:264

◆ addJointToGroup()

void StateSpace::addJointToGroup ( const std::string group_name,
const JointPtr joint 
)
protected

Definition at line 218 of file space.cpp.

219 {
220  group_joints_[group_name].emplace_back(joint);
221  group_dimension_[group_name] += joint->getDimension();
222 }

◆ allocDefaultStateSampler()

ompl::base::StateSamplerPtr StateSpace::allocDefaultStateSampler ( ) const
override

Definition at line 357 of file space.cpp.

358 {
359  return std::make_shared<StateSampler>(this);
360 }

◆ allocState()

ompl::base::State * StateSpace::allocState ( ) const
override

Definition at line 362 of file space.cpp.

363 {
364  return new StateType(dimension_);
365 }

◆ distance()

double StateSpace::distance ( const ompl::base::State *  state1,
const ompl::base::State *  state2 
) const
override

Definition at line 309 of file space.cpp.

310 {
311  const auto &as1 = state1->as<StateType>();
312  const auto &as2 = state2->as<StateType>();
313 
314  double d = 0;
315  for (const auto &joint : joints_)
316  {
317  const auto &v1 = joint->getSpaceVarsConst(as1->data);
318  const auto &v2 = joint->getSpaceVarsConst(as2->data);
319 
320  d += joint->distance(v1, v2);
321  }
322 
323  return d;
324 }

◆ enforceBounds()

void StateSpace::enforceBounds ( ompl::base::State *  state) const
override

Definition at line 286 of file space.cpp.

287 {
288  const auto &as = state->as<StateType>();
289  for (const auto &joint : joints_)
290  {
291  auto v = joint->getSpaceVars(as->data);
292  joint->enforceBounds(v);
293  }
294 }

◆ equalStates()

bool StateSpace::equalStates ( const ompl::base::State *  state1,
const ompl::base::State *  state2 
) const
override

Definition at line 335 of file space.cpp.

336 {
337  return distance(state1, state2) <= 1e-8;
338 }
double distance(const ompl::base::State *state1, const ompl::base::State *state2) const override
Definition: space.cpp:309

◆ freeState()

void StateSpace::freeState ( ompl::base::State *  state) const
override

Definition at line 367 of file space.cpp.

368 {
369  auto *as = state->as<StateType>();
370  delete as;
371 }

◆ getGroupDimension()

std::size_t StateSpace::getGroupDimension ( const std::string group) const

Get the dimension of joint variables for a subgroup.

Returns
The group's dimension.

Definition at line 446 of file space.cpp.

447 {
448  return group_dimension_.find(group)->second;
449 }

◆ getGroupDofNames()

std::vector< std::string > StateSpace::getGroupDofNames ( const std::string group_name) const

Get the names of each of the dof controlled by a group.

Returns
The names of all the controlled dof for a group.

Definition at line 460 of file space.cpp.

461 {
463 
464  const auto &joints = group_joints_.find(group_name)->second;
465  for (const auto &joint : joints)
466  {
467  const auto &jdofs = joint->getDofs();
468  dofs.insert(dofs.end(), jdofs.begin(), jdofs.end());
469  }
470 
471  return dofs;
472 }
T insert(T... args)

◆ getGroups()

std::vector< std::string > StateSpace::getGroups ( ) const

Get the names of all groups managed by this space.

Returns
Names of all the groups.

Definition at line 451 of file space.cpp.

452 {
454  for (const auto &pair : group_joints_)
455  groups.emplace_back(pair.first);
456 
457  return groups;
458 }
T emplace_back(T... args)

◆ getGroupState()

void StateSpace::getGroupState ( const std::string group,
const ompl::base::State *  state,
Eigen::Ref< Eigen::VectorXd >  v 
) const

From a full state, get only the state of a group.

Parameters
[in]groupThe group to get the state for.
[in]stateThe state to get the group state from.
[out]vThe group state to set.

Definition at line 416 of file space.cpp.

418 {
419  const auto &joints = group_joints_.find(group)->second;
420  const auto &as = state->as<StateType>();
421 
422  std::size_t index = 0;
423  for (const auto &joint : joints)
424  {
425  std::size_t n = joint->getDimension();
426  v.segment(index, n) = joint->getSpaceVarsConst(as->data);
427  index += n;
428  }
429 }

◆ getIndices()

std::vector< std::pair< std::size_t, std::size_t > > StateSpace::getIndices ( ) const

Get the set of indices that is being planned for. Pairs of skeleton index and joint index.

Returns
Vector of indices.

Definition at line 383 of file space.cpp.

384 {
386  for (const auto &joint : joints_)
387  {
388  auto skelx = joint->getSkeletonIndex();
389  auto add = joint->getIndices();
390  for (const auto &index : add)
391  indices.emplace_back(skelx, index);
392  }
393 
394  return indices;
395 }

◆ getJoint() [1/2]

JointPtr StateSpace::getJoint ( const std::string name) const

Get a joint that is being planned for.

Returns
The joint.

Definition at line 402 of file space.cpp.

403 {
404  auto it = std::find_if(joints_.begin(), joints_.end(),
405  [&](const JointPtr &j) { return j->getJoint(world_)->getName() == name; });
406  if (it != joints_.end())
407  return *it;
408  return nullptr;
409 }
A shared pointer wrapper for robowflex::darts::Joint.

◆ getJoint() [2/2]

JointPtr StateSpace::getJoint ( std::size_t  index) const

Get a joint that is being planned for.

Returns
The joint.

Definition at line 397 of file space.cpp.

398 {
399  return joints_[index];
400 }

◆ getJoints()

const std::vector< JointPtr > & StateSpace::getJoints ( ) const

Get a vector of the joints being planned for.

Returns
The vector of joints being planned for.

Definition at line 411 of file space.cpp.

412 {
413  return joints_;
414 }

◆ getLowerBound()

Eigen::VectorXd StateSpace::getLowerBound ( ) const

Get a vector of the lower joint bounds for the space.

Returns
The lower bounds of the space.

Definition at line 474 of file space.cpp.

475 {
476  const auto &bounds = getBounds();
477  return Eigen::Map<const Eigen::VectorXd>(bounds.low.data(), bounds.low.size());
478 }

◆ getMaximumExtent()

double StateSpace::getMaximumExtent ( ) const
override

Definition at line 326 of file space.cpp.

327 {
328  double d = 0;
329  for (const auto &joint : joints_)
330  d += joint->getMaximumExtent();
331 
332  return d;
333 }

◆ getUpperBound()

Eigen::VectorXd StateSpace::getUpperBound ( ) const

Get a vector of the upper joint bounds for the space.

Returns
The upper bounds of the space.

Definition at line 480 of file space.cpp.

481 {
482  const auto &bounds = getBounds();
483  return Eigen::Map<const Eigen::VectorXd>(bounds.high.data(), bounds.high.size());
484 }

◆ getWorld()

WorldPtr StateSpace::getWorld ( )

Get underlying world.

Returns
The world for the space.

Definition at line 373 of file space.cpp.

374 {
375  return world_;
376 }

◆ getWorldConst()

const WorldPtr & StateSpace::getWorldConst ( ) const

Get underlying world.

Returns
The world for the space.

Definition at line 378 of file space.cpp.

379 {
380  return world_;
381 }

◆ getWorldGroupState()

void StateSpace::getWorldGroupState ( WorldPtr  world,
const std::string group_name,
Eigen::Ref< Eigen::VectorXd >  x 
) const

Get the group state of a world.

Parameters
[in]worldWorld to get state of.
[in]group_nameName of group to get.
[out]xConfiguration to get.

Definition at line 272 of file space.cpp.

274 {
275  const auto &joints = group_joints_.find(group_name)->second;
276 
277  std::size_t index = 0;
278  for (const auto &joint : joints)
279  {
280  std::size_t n = joint->getDimension();
281  joint->getJointState(world, x.segment(index, n));
282  index += n;
283  }
284 }

◆ getWorldState() [1/2]

void StateSpace::getWorldState ( WorldPtr  world,
Eigen::Ref< Eigen::VectorXd >  x 
) const

Get the state of a world in a configuration vector.

Parameters
[in]worldWorld to get state of.
[out]xConfiguration to fill.

Definition at line 247 of file space.cpp.

248 {
249  for (const auto &joint : joints_)
250  {
251  const auto &v = joint->getSpaceVars(x);
252  joint->getJointState(world, v);
253  }
254 }

◆ getWorldState() [2/2]

void StateSpace::getWorldState ( WorldPtr  world,
ompl::base::State *  state 
) const

Get the state of a world in an OMPL state.

Parameters
[in]worldWorld to get state of.
[out]stateState to fill.

Definition at line 241 of file space.cpp.

242 {
243  auto *as = state->as<StateType>();
244  getWorldState(std::move(world), as->data);
245 }
void getWorldState(WorldPtr world, ompl::base::State *state) const
Get the state of a world in an OMPL state.
Definition: space.cpp:241

◆ interpolate()

void StateSpace::interpolate ( const ompl::base::State *  from,
const ompl::base::State *  to,
double  t,
ompl::base::State *  state 
) const
override

Definition at line 340 of file space.cpp.

342 {
343  const auto &af = from->as<StateType>();
344  const auto &at = to->as<StateType>();
345  auto *as = state->as<StateType>();
346 
347  for (const auto &joint : joints_)
348  {
349  const auto &vf = joint->getSpaceVarsConst(af->data);
350  const auto &vt = joint->getSpaceVarsConst(at->data);
351  auto vs = joint->getSpaceVars(as->data);
352 
353  joint->interpolate(vf, vt, t, vs);
354  }
355 }

◆ isMetricSpace()

bool StateSpace::isMetricSpace ( ) const
override

Definition at line 60 of file space.cpp.

61 {
62  return metric_;
63 }

◆ satisfiesBounds()

bool StateSpace::satisfiesBounds ( const ompl::base::State *  state) const
override

Definition at line 296 of file space.cpp.

297 {
298  const auto &as = state->as<StateType>();
299  for (const auto &joint : joints_)
300  {
301  const auto &v = joint->getSpaceVarsConst(as->data);
302  if (not joint->satisfiesBounds(v))
303  return false;
304  }
305 
306  return true;
307 }

◆ setGroupState()

void StateSpace::setGroupState ( const std::string group,
ompl::base::State *  state,
const Eigen::Ref< const Eigen::VectorXd > &  v 
) const

Set a (sub)group state in a full state.

Parameters
[in]groupThe group to set the state for.
[out]stateThe state to set the group state in.
[in]vThe group state to use.

Definition at line 431 of file space.cpp.

433 {
434  const auto &joints = group_joints_.find(group)->second;
435  auto *as = state->as<StateType>();
436 
437  std::size_t index = 0;
438  for (const auto &joint : joints)
439  {
440  std::size_t n = joint->getDimension();
441  joint->getSpaceVars(as->data) = v.segment(index, n);
442  index += n;
443  }
444 }

◆ setMetricSpace()

void StateSpace::setMetricSpace ( bool  metric)

Definition at line 486 of file space.cpp.

487 {
488  metric_ = metric;
489 }

◆ setWorldGroupState()

void StateSpace::setWorldGroupState ( WorldPtr  world,
const std::string group_name,
const Eigen::Ref< const Eigen::VectorXd > &  x 
) const

Set the state of a world from a configuration of a group.

Parameters
[out]worldWorld to set state of.
[in]group_nameName of group to set.
[in]xConfiguration to set.

Definition at line 256 of file space.cpp.

258 {
259  const auto &joints = group_joints_.find(group_name)->second;
260 
261  std::size_t index = 0;
262  for (const auto &joint : joints)
263  {
264  std::size_t n = joint->getDimension();
265  joint->setJointState(world, x.segment(index, n));
266  index += n;
267  }
268 
269  world->forceUpdate();
270 }

◆ setWorldState() [1/2]

void StateSpace::setWorldState ( WorldPtr  world,
const Eigen::Ref< const Eigen::VectorXd > &  x 
) const

Set the state of a world from a configuration.

Parameters
[out]worldWorld to set state of.
[in]xConfiguration to set world.

Definition at line 230 of file space.cpp.

231 {
232  for (const auto &joint : joints_)
233  {
234  const auto &v = joint->getSpaceVarsConst(x);
235  joint->setJointState(world, v);
236  }
237 
238  world->forceUpdate();
239 }

◆ setWorldState() [2/2]

void StateSpace::setWorldState ( WorldPtr  world,
const ompl::base::State *  state 
) const

Set the state of a world from an OMPL state.

Parameters
[out]worldWorld to set state of.
[in]stateState to set world.

Definition at line 224 of file space.cpp.

225 {
226  const auto &as = state->as<StateType>();
227  setWorldState(std::move(world), as->data);
228 }
void setWorldState(WorldPtr world, const ompl::base::State *state) const
Set the state of a world from an OMPL state.
Definition: space.cpp:224

Member Data Documentation

◆ group_dimension_

std::map<std::string, std::size_t> robowflex::darts::StateSpace::group_dimension_
protected

Dimension of the group.

Definition at line 269 of file space.h.

◆ group_joints_

std::map<std::string, std::vector<JointPtr> > robowflex::darts::StateSpace::group_joints_
protected

Joints belonging to a group.

Definition at line 268 of file space.h.

◆ indices_

std::vector<std::size_t> robowflex::darts::StateSpace::indices_
protected

Vector of indices for planning.

Definition at line 260 of file space.h.

◆ Joint

friend robowflex::darts::StateSpace::Joint

Definition at line 80 of file space.h.

◆ joints_

std::vector<JointPtr> robowflex::darts::StateSpace::joints_
protected

Vector of all joints used in planning.

Definition at line 264 of file space.h.

◆ jointset_

std::set<dart::dynamics::Joint *> robowflex::darts::StateSpace::jointset_
protected

Set of joints used in planning.

Definition at line 259 of file space.h.

◆ metric_

bool robowflex::darts::StateSpace::metric_ {true}
protected

Is this space all Rn?

Definition at line 262 of file space.h.

◆ rng_

ompl::RNG robowflex::darts::StateSpace::rng_
protected

Random number generator.

Definition at line 266 of file space.h.

◆ RnJoint

friend robowflex::darts::StateSpace::RnJoint

Definition at line 81 of file space.h.

◆ StateSampler

Definition at line 82 of file space.h.

◆ world_

WorldPtr robowflex::darts::StateSpace::world_
protected

World to use for planning.

Definition at line 257 of file space.h.


The documentation for this class was generated from the following files: