World¶
raisim::World
class creates/manages all resources.
All objects defined in the same Wolrd class instance can collide with each other unless otherwise their collision mask and group explicitly disables the collision ().
There are two ways to generate the World instance (i.e., two constuctors). The first way is to load an raisim world configuration file, which is in a form of an XML file. The second way is to generate world dynamically in code. You can also mix the two ways, by loading an XML file and dynamically adding objects.
RaiSim World Configuration File Convention¶
We provide a few examples here.
The following describes the RaiSim world configuration xml convention. The (optional) tag means that the element is optional given the parent. If the element is not marked (optional), it must exist given that the parent exist. The (multiple) tag means that there can be multiple elements for the same parent.
- raisim: Top most node.
<attribute>
version
: Describes the version of RaiSim that created the configuration file. The file might be read by different version.- <child> (optional)
material
For more information and examples, check out here. - <child> (optional)
default
If it doesn’t exist, the default parameters are as described here. <attribute>
friction
[double]<attribute>
restitution
[double]<attribute>
restitution_threshold
[double]
- <child> (optional)
- <child> (optional, multiple)
pair_prop
<attribute>
name1
[string]<attribute>
name2
[string]<attribute>
friction
[double]<attribute>
restitution
[double]<attribute>
restitution_threshold
[double]
- <child> (optional, multiple)
- <child> (optional)
- <child> (optional)
gravity
<attribute>
value
[Vec<3>]: default={0, 0, -9.81}
- <child> (optional)
- <child> (optional)
timestep
<attribute>
value
[double]: default = 0.005
- <child> (optional)
- <child> (optional)
erp
For experts only. It is a spring and damper term to the error dynamics. <attribute>
erp
: spring term [double]<attribute>
erp2
: damping term [double]
- <child> (optional)
<child>
objects
: described in “Object XML Description”- <child>
wire
DESCRIPTION, EXAMPLES <attribute>
name
[string]: wire name<attribute>
type
[string]: wire type. “stiff”, “compliant”, or “custom”<attribute>
stretch_type
[string]: stretch type- <child>
object1
andobject2
the object to which the wire is attached First option 1. <attribute>
local_index
[int]: The body index for the wire attachment. 0 for singleBodyObject. 2. <attribute>pos
[Vec<3>]: The position in the local body frame to where the wire is attached. Second option, for articulated system only 1. <attribute>frame
[string]: The name of the frame to where the wire is attached.
- <child>
- <child>
Object XML Description¶
sphere¶
attributes: (optional, default=1) collision_group
[uint64_t], (optional, default=-1) collision_mask
[uint64_t], (optional) appearance
[string], (optional) body_type
[string]: one of {dynamic, kinematic, static}, (optional) name
[string], mass
[double]
<child> (optional, default=From geometry assuming uniform density)
inertia
: <attribute>xx
[double],xy
[double],xz
[double],yy
[double],yz
[double],zz
[double]<child> dim: <attribute> radius[double]
<child> state: <attribute>
pos
[Vec<3>], (optional, default=1,0,0,0)quat
[Vec<4>], (optional, default=0,0,0)lin_vel
[Vec<3>], (optional, default=0,0,0)ang_vel
[Vec<3>]
capsule and cylinder¶
attributes: (optional, default=1) collision_group[uint64_t], (optional, default=-1) collision_mask[uint64_t], (optional) appearance[string], (optional) body_type[string]: one of {dynamic, kinematic, static}, (optional) name[string], mass[double]
<child> (optional, default=From geometry assuming uniform density)
inertia
: <attribute>xx
[double],xy
[double],xz
[double],yy
[double],yz
[double],zz
[double]<child> dim: <attribute>
radius
[double],height
[double]<child> state: <attribute>
pos
[Vec<3>], (optional, default=1,0,0,0)quat
[Vec<4>], (optional, default=0,0,0)lin_vel
[Vec<3>], (optional, default=0,0,0)ang_vel
[Vec<3>]
box¶
attributes: (optional, default=1) collision_group
[uint64_t], (optional, default=-1) collision_mask
[uint64_t], (optional) appearance
[string], (optional) body_type
[string]: one of {dynamic, kinematic, static}, (optional) name
[string], mass
[double]
<child> (optional, default=From geometry assuming uniform density)
inertia
: <attribute>xx
[double],xy
[double],xz
[double],yy
[double],yz
[double],zz
[double]<child> dim: <attribute>
x
[double],y
[double],z
[double]<child> state: <attribute>
pos
[Vec<3>], (optional, default=1,0,0,0)quat
[Vec<4>], (optional, default=0,0,0)lin_vel
[Vec<3>], (optional, default=0,0,0)ang_vel
[Vec<3>]
compound¶
attributes: (optional, default=1) collision_group
[uint64_t], (optional, default=-1) collision_mask
[uint64_t], (optional) appearance
[string], (optional) body_type
[string]: one of {dynamic, kinematic, static}, (optional) name
[string], com
[Vec<3>], mass
[double]
- <child> (optional, default=From geometry assuming uniform density)
inertia
attributes:
xx
[double],xy
[double],xz
[double],yy
[double],yz
[double],zz
[double]
- <child> (optional, default=From geometry assuming uniform density)
- <child>
children
- <child> (optional, multiple)
sphere
- <child> dim
<attribute>
radius
[double]
<attribute> (optional, default=default)
material
- <child> (optional, multiple)
- <child> (optional, multiple)
cylinder
- <child>
dim
<attribute> radius[double]
<attribute> height[double]
- <child>
<attribute> (optional, default=default)
material
- <child> (optional, multiple)
- <child> (optional, multiple)
capsule
- <child>
dim
<attribute>
radius
[double]<attribute>
height
[double]
- <child>
<attribute> (optional, default=default)
material
- <child> (optional, multiple)
- <child> (optional, multiple)
box
- <child>
dim
<attribute>
x
[double]<attribute>
y
[double]<attribute>
z
[double]
- <child>
<attribute> (optional, default=default)
material
- <child> (optional, multiple)
- <child>
- <child> state
attributes:
pos
[Vec<3>], (optional, default=1,0,0,0)quat
[Vec<4>], (optional, default=0,0,0)lin_vel
[Vec<3>], (optional, default=0,0,0)ang_vel
[Vec<3>]
mesh¶
attributes: (optional, default=1) collision_group
[uint64_t], (optional, default=-1) collision_mask
[uint64_t], (optional) appearance
[string], (optional) body_type
[string]: one of {dynamic, kinematic, static}, (optional) name
[string], mass
[double], file_name
[string], com
[Vec<3>], scale
[Vec<3>]
- <child> (optional, default=From geometry assuming uniform density)
inertia
attributes:
xx
[double],xy
[double],xz
[double],yy
[double],yz
[double],zz
[double]
- <child> (optional, default=From geometry assuming uniform density)
- <child>
state
attributes:
pos
[Vec<3>], (optional, default=1,0,0,0)quat
[Vec<4>], (optional, default=0,0,0)lin_vel
[Vec<3>], (optional, default=0,0,0)ang_vel
[Vec<3>]
- <child>
ground¶
attributes: (optional, default=-1) collision_mask
[uint64_t], (optional) appearance
[string], (optional) name
[string], (optional, default=0) height
[double]
heightmap¶
Options
attributes: (optional, default=-1)
collision_mask
[uint64_t], (optional)appearance
[string], (optional, default=default)material
[string], (optional)name
[string],x_sample
[size_t],y_sample
[size_t],x_size
[double],y_size
[double],center_x
[double],center_y
[double],height
[std::vector<double>]attributes: (optional, default=-1)
collision_mask
[uint64_t], (optional)appearance
[string], (optional, default=default)material
[string], (optional)name
[string],x_sample
[size_t],y_sample
[size_t],x_size
[double],y_size
[double],center_x
[double],center_y
[double],z_scale
[double],z_offset
[double],png
[string]attributes: (optional, default=-1)
collision_mask
[uint64_t], (optional)appearance
[string], (optional, default=default)material
[string], (optional)name
[string],center_x
[double],center_y
[double],text
[string]- attributes: (optional, default=-1)
collision_mask
[uint64_t], (optional)appearance
[string], (optional, default=default)material
[string], (optional)name
[string],x_sample
[size_t],y_sample
[size_t],x_size
[double],y_size
[double],center_x
[double],center_y
[double] - <child>
terrain_properties
attributes:
z_scale
[double],fractal_octaves
[size_t],fractal_lacunarity
[double],fractal_gain
[double],step_size
[double],frequency
[double],seed
[size_t]
- <child>
- attributes: (optional, default=-1)
articulated_system¶
attributes: (optional, default=1) collision_group
[uint64_t], (optional, default=-1) collision_mask
[uint64_t], (optional) name
[string], (optional, default=the URDF directory) res_dir
[string], urdf_path
[string]
- <child>
state
attributes:
qpos
[VecDyn], (optional, default=zeros)qvel
[VecDyn]
- <child>
Adding New Objects¶
To add a new object of a shape X, a method named addX
is used.
For example, to add a sphere
raisim::World world;
auto sphere = world.addSphere(0.5, 1.0);
Here sphere
is a pointer to the internal resource.
It can be used to access or to modify the internal variables.
There are three hidden arguments to all object-creation methods: material
, collisionGroup
and collisionMask
.
Descriptions of the collision varaibles are given in “Collision and Contact” chapter.
material
argument specifies the material which governs contact dynamics.
It is further explained in “Material System” chapter.
The list of objects is given in “Object” chapter.
Once an object is added, a name can be set as below
sphere.setName("ball");
A pointer to an object with a specific name can be retrieved as below
auto ball = world.getObject("ball");
An object might contain multiple bodies (i.e., articulated system). To designate each body, local index can be used. To keep the interface consistent, many methods ask for the local index even for simgle body objects. In a single body object case, local index arguments are ignored and users can simply put 0 to comply with the AIP.
Changing Simulation Parameters¶
The following paramters can be changed using the world API
Time step
RaiSim uses a fixed time step. The time step obtained and modified using getTimeStep
and setTimeStep
method.
API¶
-
class
raisim
::
World
¶ Public Functions
-
World
()¶ Create an empty world
-
World
(const std::string &configFile)¶ Create an world as specified in the xml config file
-
void
exportToXml
(const std::string &dir, const std::string &fileName)¶ export the world to an xml config file, which can be loaded using a constructor
- Parameters
dir
: directory to save the xml filefileName
: file name
-
void
setTimeStep
(double dt)¶ - Parameters
set
: the time step
-
double
getTimeStep
() const¶ - Return
the time step
-
Sphere *
addSphere
(double radius, double mass, const std::string &material = "default", CollisionGroup collisionGroup = 1, CollisionGroup collisionMask = CollisionGroup(-1))¶ - Return
pointer to the created box
- Parameters
radius
: radiusmass
: massmaterial
: material of the height map (which defines the contact dynamics)collisionGroup
: read “Contact and Collision/ Collision Group and Mask”collisionMask
: read “Contact and Collision/ Collision Group and Mask”.
-
Box *
addBox
(double xLength, double yLength, double zLength, double mass, const std::string &material = "default", CollisionGroup collisionGroup = 1, CollisionGroup collisionMask = CollisionGroup(-1))¶ - Return
pointer to the created box
- Parameters
XLength
: x dimensionYLength
: y dimensionZLength
: z dimensionmass
: massmaterial
: material of the height map (which defines the contact dynamics)collisionGroup
: read “Contact and Collision/ Collision Group and Mask”collisionMask
: read “Contact and Collision/ Collision Group and Mask”.
-
Cylinder *
addCylinder
(double radius, double height, double mass, const std::string &material = "default", CollisionGroup collisionGroup = 1, CollisionGroup collisionMask = CollisionGroup(-1))¶ - Return
pointer to the created cylinder
- Parameters
radius
: radiusheight
: center-to-center distancemass
: massmaterial
: material of the height map (which defines the contact dynamics)collisionGroup
: read “Contact and Collision/ Collision Group and Mask”collisionMask
: read “Contact and Collision/ Collision Group and Mask”.
-
Capsule *
addCapsule
(double radius, double height, double mass, const std::string &material = "default", CollisionGroup collisionGroup = 1, CollisionGroup collisionMask = CollisionGroup(-1))¶ - Return
pointer to the created capsule
- Parameters
radius
: radiusheight
: center-to-center distancemass
: massmaterial
: material of the height map (which defines the contact dynamics)collisionGroup
: read “Contact and Collision/ Collision Group and Mask”collisionMask
: read “Contact and Collision/ Collision Group and Mask”.
-
Ground *
addGround
(double zHeight = 0.0, const std::string &material = "default", CollisionGroup collisionMask = CollisionGroup(-1))¶ - Return
pointer to the created ground
- Parameters
zHeight
: height of the terrainmaterial
: material of the height map (which defines the contact dynamics)collisionMask
: read “Contact and Collision/ Collision Group and Mask”. Note that collision group of a static object is CollisionGroup(1) << 61ul
-
HeightMap *
addHeightMap
(size_t xSamples, size_t ysamples, double xSize, double ySize, double centerX, double centerY, const std::vector<double> &height, const std::string &material = "default", CollisionGroup collisionGroup = RAISIM_STATIC_COLLISION_GROUP, CollisionGroup collisionMask = CollisionGroup(-1))¶ - Return
pointer to the created height map
- Parameters
xSamples
: how many points along x axisySamples
: how many points along y axisxSize
: x width of the height mapySize
: y length of the height mapcenterX
: x coordinate of the center of the height mapcenterY
: y coordinate of the center of the height mapheight
: a vector of doubles representing heights. the size should be xSample X ySamplesmaterial
: material of the height map (which defines the contact dynamics)collisionGroup
: read “Contact and Collision/ Collision Group and Mask”collisionMask
: read “Contact and Collision/ Collision Group and Mask”
-
HeightMap *
addHeightMap
(const std::string &raisimHeightMapFileName, double centerX, double centerY, const std::string &material = "default", CollisionGroup collisionGroup = RAISIM_STATIC_COLLISION_GROUP, CollisionGroup collisionMask = CollisionGroup(-1))¶ - Return
pointer to the created height map
- Parameters
raisimHeightMapFileName
: the raisim text file which will be used to create the height mapcenterX
: x coordinate of the center of the height mapcenterY
: y coordinate of the center of the height mapmaterial
: material of the height map (which defines the contact dynamics)collisionGroup
: read “Contact and Collision/ Collision Group and Mask”collisionMask
: read “Contact and Collision/ Collision Group and Mask”
-
HeightMap *
addHeightMap
(const std::string &pngFileName, double centerX, double centerY, double xSize, double ySize, double heightScale, double heightOffset, const std::string &material = "default", CollisionGroup collisionGroup = RAISIM_STATIC_COLLISION_GROUP, CollisionGroup collisionMask = CollisionGroup(-1))¶ - Return
pointer to the created height map
- Parameters
pngFileName
: the png file which will be used to create the height mapcenterX
: x coordinate of the center of the height mapcenterY
: y coordinate of the center of the height mapxSize
: x width of the height mapySize
: y length of the height mapheightScale
: a png file (if 8-bit) has pixel values from 0 to 255. This parameter scales the pixel values to the actual heightheightOffset
: height of the 0-value pixelmaterial
: material of the height map (which defines the contact dynamics)collisionGroup
: read “Contact and Collision/ Collision Group and Mask”collisionMask
: read “Contact and Collision/ Collision Group and Mask”
-
HeightMap *
addHeightMap
(double centerX, double centerY, TerrainProperties &terrainProperties, const std::string &material = "default", CollisionGroup collisionGroup = RAISIM_STATIC_COLLISION_GROUP, CollisionGroup collisionMask = CollisionGroup(-1))¶ - Return
pointer to the created height map
- Parameters
centerX
: x coordinate of the center of the height mapcenterY
: y coordinate of the center of the height mapterrainProperties
: perlin noise parameters which will be used to create the height mapmaterial
: material of the height map (which defines the contact dynamics)collisionGroup
: read “Contact and Collision/ Collision Group and Mask”collisionMask
: read “Contact and Collision/ Collision Group and Mask”
-
HeightMap *
addHeightMap
(const HeightMap *heightmapToBeCloned, CollisionGroup collisionGroup = RAISIM_STATIC_COLLISION_GROUP, CollisionGroup collisionMask = CollisionGroup(-1))¶ - Return
pointer to the created height map
- Parameters
heightmapToBeCloned
: Another height map to be clonedcollisionGroup
: read “Contact and Collision/ Collision Group and Mask”collisionMask
: read “Contact and Collision/ Collision Group and Mask”
-
ArticulatedSystem *
addArticulatedSystem
(const std::string &filePathOrURDFScript, const std::string &resPath = "", const std::vector<std::string> &jointOrder = {}, CollisionGroup collisionGroup = 1, CollisionGroup collisionMask = CollisionGroup(-1), ArticulatedSystemOption options = ArticulatedSystemOption())¶ - Return
pointer to the articulated system
- Parameters
filePathOrURDFScript
: Path to urdf file or a URDF string. Depending on the contents of the string, RaiSim will interpret it as an xml string or a file path.resPath
: Path to the resource directory. Leave it empty (“”) if it is the urdf file directoryjointOrder
: this can be used to redefine the joint order. A child cannot precede its parent. Leave it empty ({}) to use the joint order defined in the URDF file.collisionGroup
: read “Contact and Collision/ Collision Group and Mask”collisionMask
: read “Contact and Collision/ Collision Group and Mask”option
: Currently only support “doNotCollideWithParent”
-
ArticulatedSystem *
addArticulatedSystem
(const Child &child, const std::string &resPath = "", CollisionGroup collisionGroup = 1, CollisionGroup collisionMask = CollisionGroup(-1), ArticulatedSystemOption options = ArticulatedSystemOption())¶ This method programmatically creates an articulated system without an URDF file.
- Return
pointer to the articulated system
- Parameters
child
: an instance of Child class which has an articulated system structure.resPath
: Path to the resource directory. Leave it empty (“”) if it is the urdf file directorycollisionGroup
: read “Contact and Collision/ Collision Group and Mask”collisionMask
: read “Contact and Collision/ Collision Group and Mask”option
: Currently only support “doNotCollideWithParent”
-
Compound *
addCompound
(const std::vector<Compound::CompoundObjectChild> &children, double mass, Vec<3> COM, const Mat<3, 3> &inertia, CollisionGroup collisionGroup = 1, CollisionGroup collisionMask = CollisionGroup(-1))¶ Add a single body which is composed of multiple primitive collision shapes
- Return
pointer to the created compound object
- Parameters
children
: a vector of CompoundObjectChild which contains each primitive shape’s position, orientation, material and shape parametersmass
: mass of the composite bodyCOM
: center of the composite bodyinertia
: inertia of the composite bodycollisionGroup
: read “Contact and Collision/ Collision Group and Mask”collisionMask
: read “Contact and Collision/ Collision Group and Mask”
-
Mesh *
addMesh
(const std::string &meshFileInObjFormat, double mass, const Mat<3, 3> &inertia, const Vec<3> &COM, double scale = 1, const std::string &material = "", CollisionGroup collisionGroup = 1, CollisionGroup collisionMask = CollisionGroup(-1))¶ create mesh collision body. only the obj format is supported
- Return
pointer to the created wire
- Parameters
meshFileInObjFormat
: obj file of the meshmass
: massinertia
: inertiaCOM
: the center of the massscale
: rescale the meshmaterial
: material of the mesh (which defines the contact dynamics)collisionGroup
: read “Contact and Collision/ Collision Group and Mask”collisionMask
: read “Contact and Collision/ Collision Group and Mask”
-
Mesh *
addMesh
(const Mesh *meshToClone, const std::string &material = "", CollisionGroup collisionGroup = 1, CollisionGroup collisionMask = CollisionGroup(-1))¶ create mesh collision body. only the obj format is supported
- Return
pointer to the created wire
- Parameters
meshToClone
: mesh to copymaterial
: material of the mesh (which defines the contact dynamics)collisionGroup
: read “Contact and Collision/ Collision Group and Mask”collisionMask
: read “Contact and Collision/ Collision Group and Mask”
-
StiffLengthConstraint *
addStiffWire
(Object *obj1, size_t localIdx1, Vec<3> pos1_b, Object *obj2, size_t localIdx2, Vec<3> pos2_b, double length)¶ Stiff unilateral constraint. It cannot push. It can only pull.
- Return
pointer to the created wire
- Parameters
obj1
: the first object the wire is attached tolocalIdx1
: the body index (0 for a SingleBodyObject) for the first objectpos1_b
: location of the cable attachment on the first objectobj2
: the second object the wire is attached tolocalIdx2
: the body index (0 for a SingleBodyObject) for the second objectpos2_b
: location of the cable attachment on the second objectlength
: length of the wire
-
CompliantLengthConstraint *
addCompliantWire
(Object *obj1, int localIdx1, Vec<3> pos1_b, Object *obj2, int localIdx2, Vec<3> pos2_b, double length, double stiffness)¶ soft unilateral constraint. It cannot push. It can only pull.
- Return
pointer to the created wire
- Parameters
obj1
: the first object the wire is attached tolocalIdx1
: the body index (0 for a SingleBodyObject) for the first objectpos1_b
: location of the cable attachment on the first objectobj2
: the second object the wire is attached tolocalIdx2
: the body index (0 for a SingleBodyObject) for the second objectpos2_b
: location of the cable attachment on the second objectlength
: length of the wirestiffness
: stiffness of the wire
-
CustomLengthConstraint *
addCustomWire
(Object *obj1, int localIdx1, Vec<3> pos1_b, Object *obj2, int localIdx2, Vec<3> pos2_b, double length)¶ Custom wire that applies user-set tension between two points.
- Return
pointer to the created wire
- Parameters
obj1
: the first object the wire is attached tolocalIdx1
: the body index (0 for a SingleBodyObject) for the first objectpos1_b
: location of the cable attachment on the first objectobj2
: the second object the wire is attached tolocalIdx2
: the body index (0 for a SingleBodyObject) for the second objectpos2_b
: location of the cable attachment on the second objectlength
: length of the wire. You can use this to compute how much it stretched from a nominal length. It might not be necessary for some wire types.
-
Object *
getObject
(const std::string &name)¶ - Return
object with the given name. returns nullptr if the object doesn’t exist. The name can be set by Object::setName()
-
Object *
getObject
(std::size_t worldIndex)¶ - Return
object with the given index. This index can be retrieved by Object::getIndexInWorld()
-
Constraints *
getConstraint
(const std::string &name)¶ - Return
a constraint (e.g., wires) with the given name. returns nullptr if the object doesn’t exist. The name can be set by Wire::setName(). This is equivalent to getWire(const std::string&)
-
LengthConstraint *
getWire
(const std::string &name)¶ - Return
a wire with the given name. returns nullptr if the object doesn’t exist. The name can be set by Wire::setName()
-
unsigned long
getConfigurationNumber
()¶ - Return
the configuration number. this number is updated every time an object is added or removed
-
const RayCollisionList &
rayTest
(const Eigen::Vector3d &start, const Eigen::Vector3d &direction, double length, bool closestOnly = true, CollisionGroup collisionMask = CollisionGroup(-1))¶ Returns the internal reference of the ray collision list it contains the geoms (position, normal, object world/local id) and the number of intersections This returns
- Return
A reference to the internal container which contains all ray collisions.
- Parameters
[in] start
: The start position of the ray.[in] direction
: The direction of the ray.[in] length
: The length of the ray.[in] closestOnly
: Only stores the first collision.[in] collisionMask
: Collision mask to filter collisions. By default, it records collisions with all collision groups.
-
void
removeObject
(LengthConstraint *wire)¶ removes a wire (i.e., LengthConstraint)
- Parameters
wire
: the wire to be removed
-
void
integrate
()¶ integrate the world It is equivalent to “integrate1(); integrate2();”
-
void
integrate1
()¶ It performs 1) deletion contacts from previous time step 2) collision detection 3) register contacts to each body 4) calls “preContactSolverUpdate1()” of each object
-
void
integrate2
()¶ It performs 1) calls “preContactSolverUpdate2()” of each body 2) run collision solver 3) calls “integrate” method of each object
-
const ContactProblems *
getContactProblem
() const¶ It performs 1) calls “preContactSolverUpdate2()” of each body 2) run collision solver 3) calls “integrate” method of each object
-
void
updateMaterialProp
(const MaterialManager &prop)¶ this deletes the existing material props and replace them with the argument
- Parameters
prop
: new material prop
-
void
setMaterialPairProp
(const std::string &mat1, const std::string &mat2, double friction, double restitution, double resThreshold)¶ Add a new material pair property. In RaiSim, material property is defined by the pair.
- Parameters
mat1
: name of the first material (the order of mat1 and mat2 is not important)mat2
: name of the first materialfriction
: the coefficient of frictionrestitution
: the coefficient of restitutionresThreshold
: the minimum impact velocity to make the object bounce
-
void
setDefaultMaterial
(double friction, double restitution, double resThreshold)¶ this default material property is used if a material pair property is not defined for the specific collision
- Parameters
friction
: the coefficient of frictionrestitution
: the coefficient of restitutionresThreshold
: the minimum impact velocity to make the object bounce
-
const Vec<3> &
getGravity
() const¶ - Return
gravitational acceleration of the world
-
void
setERP
(double erp, double erp2 = 0)¶ Changes the Error Reduction Parameter. It often has very minimalistic impact on simulation
- Parameters
erp
: spring constant between object. This constant is scaled by the apparent inertia so it has no well-defined physical meaningerp2
: damping constant between object. This constant is scaled by the apparent inertia so it has no well-defined physical meaning
-
void
setContactSolverParam
(double alpha_init, double alpha_min, double alpha_decay, int maxIter, double threshold)¶ Changes the contact solver parameter. For details, please check “Hwangbo, Jemin, Joonho Lee, and Marco Hutter. “Per-contact iteration method for solving contact dynamics.” IEEE Robotics and Automation Letters 3.2 (2018): 895-902.”
- Parameters
alpha_init
: how aggressive the solver is initiallyalpha_min
: how aggressive the solver is after an infinite number of solver iterationsalpha_decay
: how fast alpha converges from alpha_init to alpha_minthreshold
: error threshold for terminationmaxIter
: the maximum number of iterations allowed
-
double
getWorldTime
() const¶ - Return
the total integrated time (which is updated at every integrate2() call)
-
void
setWorldTime
(double time)¶ manually adjust the world time
- Parameters
the
: world time
-
raisim::contact::BisectionContactSolver &
getContactSolver
()¶ - Return
a non-const ref of the contact solver. contact::BisectionContactSolver::setOrder(bool) can be used to make the solver deterministic
-
const raisim::contact::BisectionContactSolver &
getContactSolver
() const¶ - Return
a const ref of the contact solver. Internal states can be retrieved using this method
-
const std::string &
getConfigFile
()¶ get the config file if the world was created using a xml config file
- Return
the path to the xml config file
-
std::vector<std::unique_ptr<LengthConstraint>> &
getWires
()¶ get a vector wires in the world
- Return
a vector of unique_ptrs of wires
Public Static Functions
-
void
setActivationKey
(const std::string &activationKey)¶ export the world to an xml config file, which can be loaded using a constructor
- Parameters
licenseFile
: path to the license file
-