Objects
Body types
There are three available body types:
DYNAMIC: can have a velocity, has finite massKINEMATIC: can have a velocity, has infinite mass (e.g., conveyor belt)STATIC: cannot have a velocity, has infinite mass (e.g., wall)
SingleBodyObjects can be of any type. ArticulatedSystems can only be DYNAMIC, except for fixed bases, which can be STATIC.
You can get or 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 provides 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.
- Articulated Systems
- TL;DR
- Introduction
- Creating an instance
- URDF modules (optional attachments)
- URDF loader details
- State Representation
- Joints
- URDF convention
- Kinematics
- Dynamics
- Inverse Dynamics
- PD Controller
- Integration Steps
- Get and Modify Robot Description in Code
- Apply External Forces/Torques
- Collision
- Types of Indices
- Closed-loop system
- API
- Single-Body Objects
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 const std::vector<Vec<3>> &getExternalForce() const
- Returns:
External forces currently applied for visualization (world frame).
-
inline const std::vector<Vec<3>> &getExternalForcePosition() const
- Returns:
Positions where external forces are applied (world frame).
-
inline const std::vector<Vec<3>> &getExternalTorque() const
- Returns:
External torques currently applied for visualization (world frame).
-
inline const std::vector<Vec<3>> &getExternalTorquePosition() const
- Returns:
Positions where external torques are applied (world frame).
-
inline void lockMutex()
locks chart mutex. This can be used if you use raisim in a multi-threaded environment.
-
inline void unlockMutex()
unlock chart mutex. This can be used if you use raisim in a multi-threaded environment.
-
size_t getIndexInWorld() const