Single-Body Objects

SingleBodyObject API (Parent class)

class raisim::SingleBodyObject : public raisim::Object

this class is only for inheritance

Subclassed by raisim::Box, raisim::Capsule, raisim::Compound, raisim::Cone, raisim::Cylinder, raisim::Ground, raisim::HeightMap, raisim::Mesh, raisim::Sphere

Public Functions

inline Eigen::Vector4d getQuaternion() const

returns the quaternion in Eigen::Vector4d

Returns

the orientation of the object

inline void getQuaternion(Vec<4> &quat) const

returns the quaternion in raisim::Vec<4>

Parameters

quat[out] the orientation of the object

inline Eigen::Matrix3d getRotationMatrix() const

returns the rotation matrix in Eigen::Matrix3d

Returns

the orientation of the object

inline void getRotationMatrix(Mat<3, 3> &rotation) const

returns the quaternion in raisim::Mat<3,3>

Parameters

rotation[out] the orientation of the object

inline Eigen::Vector3d getPosition() const

returns the body position in Eigen::Vector3d. Currently, all body positions are the same as the COM position

Returns

the position of the object

inline Eigen::Vector3d getComPosition() const

returns the body position in Eigen::Vector3d. Currently, all body positions are the same as the COM position

Returns

the position of the object

inline const raisim::Vec<3> &getComPosition_rs() const

returns the body position in raisim::Vec<3>. Currently, all body positions are the same as the COM position

Returns

the position of the object

inline const raisim::Vec<3> &getBodyToComPosition_rs() const

returns the body position in raisim::Vec<3>. Currently, all body positions are the same as the COM position

Returns

the position of the object

inline Eigen::Vector3d getLinearVelocity() const

returns the linear velocity

Returns

the linear velocity of the object

inline void getLinearVelocity(Vec<3> &linVel)

returns the linear velocity

Parameters

linVel[out] the linear velocity of the object

inline Eigen::Vector3d getAngularVelocity() const

returns the angular velocity

Returns

the angular velocity of the object

inline void getAngularVelocity(Vec<3> &angVel)

returns the angular velocity

Parameters

angVel[out] the angular velocity of the object

double getKineticEnergy() const

returns the kinetic energy

Returns

the kinetic energy of the object

double getPotentialEnergy(const Vec<3> &gravity) const

returns the potential energy w.r.t. z=0 and the given gravitational acceleration param[in] gravity gravitational acceleration

Returns

the potential energy of the object

double getEnergy(const Vec<3> &gravity) const

equivalent to getKineticEnergy() + getPotentialEnergy(gravity) param[in] gravity gravitational acceleration

Returns

the sum of the potential and gravitational energy of the object

Eigen::Vector3d getLinearMomentum() const

returns the linear momentum of the object

Returns

the linear momentum of the object

virtual double getMass(size_t localIdx = 0) const override

returns the mass of the object. The localIdx is unused

Returns

the linear momentum of the object

inline void setMass(double mass)

set the mass of the object.

Parameters

mass[in] set the mass of the object

inline Eigen::Matrix3d getInertiaMatrix_B() const

get the inertia matrix in the body frame. This value is constant.

Returns

the inertia matrix in the body frame

inline Eigen::Matrix3d getInertiaMatrix_W() const

get the inertia matrix in the world frame. This value changes as the body rotates.

Returns

the inertia matrix in the world frame

inline const raisim::Mat<3, 3> &getInertiaMatrix_B_rs() const

get the inertia matrix in the body frame (raisim matrix type). This value is constant.

Returns

the inertia matrix in the body frame

inline const raisim::Mat<3, 3> &getInertiaMatrix_W_rs() const

get the inertia matrix in the world frame (raisim matrix type). This value changes as the body rotates.

Returns

the inertia matrix in the world frame

virtual ObjectType getObjectType() const final

get the object type. Possible types are SPHERE, BOX, CYLINDER, CONE, CAPSULE, MESH, HALFSPACE, COMPOUND, HEIGHTMAP, ARTICULATED_SYSTEM

Returns

the object type

virtual void setExternalForce(size_t localIdx, const Vec<3> &force) final

apply forces at the Center of Mass

virtual void setExternalTorque(size_t localIdx, const Vec<3> &torque) final

apply torque on a body

virtual void setExternalForce(size_t localIdx, const Vec<3> &pos, const Vec<3> &force) final

apply force (expressed in the world frame) at specific location of the body (expressed in the body frame)

virtual void setConstraintForce(size_t localIdx, const Vec<3> &pos, const Vec<3> &force) final

apply spring force (expressed in the world frame) at specific location of the body (expressed in the body frame)

virtual void getContactPointVel(size_t pointId, Vec<3> &vel) const final

get the contact point velocity in the world frame.

Parameters
  • pointId[in] the contact index. This is an index of a contact in the contact vector that you can retrieve from getContacts().

  • vel[out] the contact point velocity in the world frame

Sphere API

class raisim::Sphere : public raisim::SingleBodyObject

Public Functions

explicit Sphere(double radius, double mass)

NOTE body frame origin of Sphere is C.O.M of Sphere

double getRadius() const

returns the radius of the sphere

Returns

the radius of the sphere

Box API

class raisim::Box : public raisim::SingleBodyObject

Public Functions

Box(double xLength, double yLength, double zLength, double mass)

NOTE body origin of Box is C.O.M of Box

inline Vec<3> getDim()

returns the dimension of the box

Returns

the box of the box

Capsule API

class raisim::Capsule : public raisim::SingleBodyObject

Public Functions

Capsule(double radius, double height, double mass)

NOTE body origin of Capsule is C.O.M of Capsule

double getRadius() const

returns the radius of the capsule

Returns

the radius of the capsule

double getHeight() const

returns the height of the capsule

Returns

the height of the capsule

Cylinder API

class raisim::Cylinder : public raisim::SingleBodyObject

Public Functions

Cylinder(double radius, double height, double mass)

NOTE body frame origin of Cylinder is C.O.M of Cylinder

double getRadius() const

returns the radius of the cylinder

Returns

the radius of the cylinder

double getHeight() const

returns the height of the cylinder

Returns

the height of the cylinder

Ground API

class raisim::Ground : public raisim::SingleBodyObject

Public Functions

inline double getHeight()

returns the height of the plane

Returns

the height