1 #ifndef GENERALIZED_ROBOT_H 2 #define GENERALIZED_ROBOT_H 5 #include "RigidObject.h" 22 int Add(
RobotModel* robot,
const char* name=NULL);
25 void Remove(
const char* name) { Remove(
ID(name)); }
29 int ID(
const char* name)
const;
37 string DofName(
int index)
const;
41 pair<int,int>
Dofs(
int id)
const;
43 pair<int,int>
Dofs(
const char* name)
const {
return Dofs(
ID(name)); }
49 int Dof(
int id,
int link)
const {
return Dofs(
id).first+link; }
53 int Dof(
const char* name,
int link)
const {
return Dof(
ID(name),link); }
65 void Split(
const Config& q,vector<Config>& qsplit)
const;
67 void SplitRefs(
const Config& q,vector<Config>& qsplit)
const;
69 void Join(
const vector<Config>& qsplit,Config& q)
const;
71 void Interpolate(
const Config& a,
const Config& b,Real u,Config& out)
const;
75 void Integrate(
const Config& q,
const Vector& dq,Config& out)
const;
77 Real
Distance(
const Config& a,
const Config& b,Real floatingRotationWeight=1.0)
const;
93 map<int,Element> elements;
102 void ConfigToTransform(
const Vector& q,RigidTransform& T);
105 void TransformToConfig(
const RigidTransform& T,Vector& q);
pair< int, int > Dofs(RigidObjectModel *object) const
Returns the DOF index range associated with the given object.
Definition: GeneralizedRobot.h:47
void Interpolate(const Config &a, const Config &b, Real u, Config &out) const
Interpolates two configurations.
Vector3 GetCOM() const
Gets the overall center of mass.
int NumDof() const
Returns the total number of DOF.
int ID(const char *name) const
Returns the array index of the given named element.
void SetConfig(const Config &q)
Sets a joint configuration of all the elements.
void GetConfig(Config &q) const
Gets the joint configuration of all the elements.
pair< int, int > Dofs(const char *name) const
Returns the DOF index range associated with the given named element.
Definition: GeneralizedRobot.h:43
A (static) rigid object that may be manipulated.
Definition: RigidObject.h:15
Defines the WorldModel class.
Definition: GeneralizedRobot.h:85
string DofName(int index) const
Returns a name for the given DOF index.
void GetJointLimits(Config &qmin, Config &qmax) const
Gets joint limits among all objects.
int DofToID(int index) const
Returns the ID for the indicated DOF.
pair< int, int > Dofs(RobotModel *robot) const
Returns the DOF index range associated with the given robot.
Definition: GeneralizedRobot.h:45
void GetVelocity(Vector &v) const
Gets the joint velocity of all the elements.
A collection of robots and objects that can be treated like one "big robot".
Definition: GeneralizedRobot.h:17
void GetMegaRobot(RobotModel &voltron) const
Gets the "mega robot" that merges all robots and objects together.
pair< int, int > Dofs(int id) const
Returns the DOF index range associated with the given id.
int Dof(RobotModel *robot, int link) const
Returns the DOF index associated with the element of the given id, offset by link.
Definition: GeneralizedRobot.h:51
void InterpolateVelocity(const Config &a, const Config &b, Real u, Vector &dq) const
Returns the velocity vector that will move from a to b at the parameter u.
int indexStart
indices governed by this element are in range [indexStart,indexEnd)
Definition: GeneralizedRobot.h:91
void Join(const vector< Config > &qsplit, Config &q) const
Joins a list of configurations of indivdual elements into a single joint configuration.
void Split(const Config &q, vector< Config > &qsplit) const
Splits the joint configuration to a list of configurations of individual elements.
The main robot type used in RobotSim.
Definition: Robot.h:83
void SplitRefs(const Config &q, vector< Config > &qsplit) const
Same as split, but generates references to q in order to minimize copying.
int Dof(const char *name, int link) const
Returns the DOF index associated with the element of the given name.
Definition: GeneralizedRobot.h:53
void UpdateGeometry()
Updates the geometry of all the elements.
Definition: ContactDistance.h:6
Real Distance(const Config &a, const Config &b, Real floatingRotationWeight=1.0) const
Returns a distance metric between two configurations.
void SetVelocity(const Vector &v)
Sets a joint velocity of all the elements.
The main world class containing multiple robots, objects, and static geometries (terrains). Lights and other viewport information may also be stored here.
Definition: World.h:24
int Dof(int id, int link) const
Returns the DOF index associated with the element of the given id, offset by link.
Definition: GeneralizedRobot.h:49