RobWorkProject  23.9.11-
Classes | Public Member Functions | List of all members
BtBody Class Reference

Wrapper class for a bullet btRigidBody, that bridges between RobWork and Bullet. More...

#include <BtBody.hpp>

Classes

struct  BodyMetaData
 Data structure to attach to bullet bodies, allowing friction and restitution to be specified separately for each pair of bodies. More...
 
struct  GeometryMetaData
 Data structure to attch to bullet collision shapes. More...
 

Public Member Functions

 BtBody (rw::core::Ptr< rwsim::dynamics::Body > body, const rwsim::dynamics::MaterialDataMap *frictionMap, const rwsim::dynamics::ContactDataMap *collisionMap, btDynamicsWorld *btWorld, const rw::kinematics::State &state)
 Construct new bullet body for the given world. More...
 
virtual ~BtBody ()
 Destructor.
 
rw::core::Ptr< rwsim::dynamics::BodygetRwBody () const
 Get the RobWork body. More...
 
btRigidBody * getBulletBody () const
 Get the underlying btRigidBody from Bullet. More...
 
void update (double dt, rw::kinematics::State &state) const
 Update the position of all kinematic bodies. More...
 
void postupdate (rw::kinematics::State &state) const
 This method updates the state with state info of the Bullet object. Which means that Bullet states are converted to rw states. More...
 
bool isDynamic () const
 Test whether the object is dynamic (equivalent to the RigidBody type in RobWork). More...
 
const rw::math::Transform3DgetBodyTcom () const
 Get the transform from the body frame to the center of mass frame. More...
 
rw::math::Transform3D getWorldTcom () const
 Get the current transform of the Bullet body. More...
 

Detailed Description

Wrapper class for a bullet btRigidBody, that bridges between RobWork and Bullet.

Constructor & Destructor Documentation

◆ BtBody()

BtBody ( rw::core::Ptr< rwsim::dynamics::Body body,
const rwsim::dynamics::MaterialDataMap frictionMap,
const rwsim::dynamics::ContactDataMap collisionMap,
btDynamicsWorld *  btWorld,
const rw::kinematics::State state 
)

Construct new bullet body for the given world.

Parameters
body[in] the RobWork body to create bullet body for.
frictionMap[in] the friction map to look up in (must point to the same map for two objects in contact).
collisionMap[in] the collision map to look up in (must point to the same map for two objects in contact).
btWorld[in] the Bullet world to add the body to.
state[in] the initial state with the initial position and velocity for the body.
Note
The initial body state is set when the body is constructed. It is not possible to reset the body position and velocity after creation. Instead the body must be deleted and created again.

Member Function Documentation

◆ getBodyTcom()

const rw::math::Transform3D& getBodyTcom ( ) const

Get the transform from the body frame to the center of mass frame.

Note
In Bullet the body frame must lie in the center of gravity, and the axes must coincide with the principal axes of inertia. This transform gives the relation between the body frame used in RobWork and the body frame used internally in Bullet.
Returns
a reference to the transform.

◆ getBulletBody()

btRigidBody* getBulletBody ( ) const

Get the underlying btRigidBody from Bullet.

Note
A btRigidBody can both be static, kinematic or dynamic. This is different than the RobWork RigidBody type, as the RigidBody type in RobWork is equivalent to a dynamic btRigidBody only.
Returns
a pointer to a btRigidBody.

◆ getRwBody()

rw::core::Ptr<rwsim::dynamics::Body> getRwBody ( ) const

Get the RobWork body.

Returns
a smart pointer to a RobWork Body.

◆ getWorldTcom()

rw::math::Transform3D getWorldTcom ( ) const

Get the current transform of the Bullet body.

Note
This transform is to the Bullet body frame which is different than the RobWork body frame - see getBodyTcom .
Returns
the current transform.

◆ isDynamic()

bool isDynamic ( ) const

Test whether the object is dynamic (equivalent to the RigidBody type in RobWork).

Returns
true if object is dynamic, false if object is kinematic or static.

◆ postupdate()

void postupdate ( rw::kinematics::State state) const

This method updates the state with state info of the Bullet object. Which means that Bullet states are converted to rw states.

Parameters
state[in/out] the state is updated with new positions and velocities.

◆ update()

void update ( double  dt,
rw::kinematics::State state 
) const

Update the position of all kinematic bodies.

Parameters
dt[in] the size of the timestep.
state[in/out] the state with updated position for kinematic bodies.

The documentation for this class was generated from the following file: