Objects

Body types

There are three available body types.

  1. DYNAMIC: can have a velocity, has a finite mass

  2. KINEMATIC: can have a velocity, has an infinite mass (e.g., conveyor belt)

  3. STATIC: cannot have a velocity, has an infinite mass (e.g., wall)

SingleBodyObjects can be of any type. ArticulatedSystems can only be DYNAMIC except the fixed base which can be STATIC.

You can get/set the body type using

  • setBodyType(BodyType type)

  • getBodyType() or getBodyType(body_index)

getBodyType() for ArticulatedSystems always returns DYNAMIC.

Name

All objects can be named. These names are used by visualizers. raisim::World has a functionality to retrieve an object by name. Here is an example.

auto sphere = world.addSphere(1,1);
sphere->setName("sphere");
std::string name = sphere->getName();
auto same_sphere = world.getObject("sphere");

API

class raisim::Object

Subclassed by raisim::ArticulatedSystem, raisim::SingleBodyObject

Public Functions

size_t getIndexInWorld() const

get the world index. raisim::World::getObjects() returns a vector of object pointers. This is method returns the index of this object in the vector.

Return

the world index

const std::vector<contact::Contact> &getContacts() const

get a vector of all contacts on the object.

Return

contacts on the body

void setExternalForce(size_t localIdx, const Vec<3> &force) = 0

apply forces at the Center of Mass

void setExternalTorque(size_t localIdx, const Vec<3> &torque) = 0

apply torque on a body

void setExternalForce(size_t localIdx, const Vec<3> &pos, const Vec<3> &force) = 0

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

void setConstraintForce(size_t localIdx, const Vec<3> &pos, const Vec<3> &force) = 0

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

ObjectType getObjectType() const = 0

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

Return

the object type

BodyType getBodyType(size_t localIdx) const

get the object body type. Available types are: DYNAMIC (movable and finite mass), STATIC (not movable and infinite mass), KINETIC (movable and infinite mass)

Return

the body type

BodyType getBodyType() const

get the object body type. Available types are: DYNAMIC (movable and finite mass), STATIC (not movable and infinite mass), KINETIC (movable and infinite mass).

Return

the body type

void getContactPointVel(size_t pointId, Vec<3> &vel) const = 0

get the contact point velocity in the world frame.

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

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

void setName(const std::string &name)

set the name of the object. You can retrieve an object by name using raisim::World::getObject()

Parameters
  • [in] name: name of the object.

const std::string &getName() const

get the name of the object

Return

name of the object