Objects¶
Body types¶
There are three available body types.
DYNAMIC
: can have a velocity, has a finite massKINEMATIC
: can have a velocity, has an infinite mass (e.g., conveyor belt)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()
orgetBodyType(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");
Types¶
All objects can be specified as either a SingleBodyObject or an ArticulatedSystem.
API¶
-
class
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.
- Returns
the world index
-
const std::vector<Contact> &
getContacts
() const¶ get a vector of all contacts on the object.
- Returns
contacts on the body
-
virtual void
setExternalForce
(size_t localIdx, const Vec<3> &force) = 0¶ apply forces at the Center of Mass
-
virtual void
setExternalTorque
(size_t localIdx, const Vec<3> &torque) = 0¶ apply torque on a body
-
virtual 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)
-
virtual 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)
-
virtual ObjectType
getObjectType
() const = 0¶ get the object type. Possible types are SPHERE, BOX, CYLINDER, CONE, CAPSULE, MESH, HALFSPACE, COMPOUND, HEIGHTMAP, ARTICULATED_SYSTEM
- Returns
the object type
-
inline virtual 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)
- Returns
the body type
-
inline virtual 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).
- Returns
the body type
-
virtual void
getContactPointVel
(size_t pointId, Vec<3> &vel) const = 0¶ 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
-
inline void
setName
(const std::string &name)¶ set the name of the object. You can retrieve an object by name using raisim::World::getObject()
- Parameters
name – [in] name of the object.
-
inline const std::string &
getName
() const¶ get the name of the object
- Returns
name of the object
-
inline void
lockMutex
()¶ locks object mutex. This can be used if you use raisim in a multi-threaded environment.
-
inline void
unlockMutex
()¶ unlock object mutex. This can be used if you use raisim in a multi-threaded environment.
-
size_t