GCOP
1.0
|
#include <bulletrccar.h>
Classes | |
struct | CarState |
Public Member Functions | |
Bulletrccar (BulletWorld &m_world, vector< double > *zs_=0) | |
~Bulletrccar () | |
double | Step (Vector4d &xb, double t, const Vector4d &xa, const Vector2d &u, double h, const VectorXd *p, Matrix4d *A=0, Matrix42d *B=0, Matrix4pd *C=0) |
double | Step (Vector4d &xb, const Vector2d &u, double h, const VectorXd *p=0, Matrix4d *A=0, Matrix42d *B=0, Matrix4pd *C=0) |
double | Step (Vector4d &xb, const Vector2d &u, double h, const VectorXd *p, const Vector4d &w, Matrix4d *A=0, Matrix42d *B=0, Matrix4pd *C=0, Matrix4d *D=0) |
bool | Reset (const Vector4d &x, double t=0) |
void | setinitialstate (const CarState &inputstate, Vector4d &x) |
void | setinitialstate (Vector4d &x) |
Set the car initial state as the current state. | |
bool | NoiseMatrix (Matrix4d &Q, double t, const Vector4d &x, const Vector2d &u, double dt, const VectorXd *p) |
Public Attributes | |
int | rightIndex |
right of the car index in terms of x,y,z assigns the coordinate sys of car | |
int | upIndex |
int | forwardIndex |
double | carmass |
Mass of the car. | |
btVector3 | car_halfdims |
half dimensions of car width, height, length | |
double | gEngineForce |
Engine Torque. | |
double | gBreakingForce |
Breaking Force on the vehicle. | |
double | maxEngineForce |
Maximum Engine force that can be applied. | |
double | maxBreakingForce |
Not Used. | |
double | gVehicleSteering |
Vehicle Steering angle. | |
double | steeringClamp |
Clamp on Steering angle. | |
double | velocityClamp |
Clamp on velocity of car. | |
double | wheelRadius |
Radius of wheel. | |
double | wheelWidth |
Width of wheel. | |
double | wheelFriction |
wheel friction usually large value | |
double | suspensionStiffness |
Stiffness of suspension. If not enough, the car will sink into ground. | |
double | suspensionDamping |
Damping on suspension. | |
double | suspensionCompression |
Compression factor decides by how much the car will compress wrto external loads. | |
double | rollInfluence |
btScalar | suspensionRestLength |
Rest length of suspension. | |
btScalar | m_defaultContactProcessingThreshold |
if contact goes above this value, it will process | |
btVector3 | wheelDirectionCS0 |
direction from the car towards the wheel contact point | |
btVector3 | wheelAxleCS |
Wheel Axle Direction. | |
double | gain_cmdvelocity |
Gain parameter on the commanded velocity. Can be used to convert radio commands into true velocity commands. | |
double | kp_torque |
Proportional gain parameter for commanding torque to get to a desired velocity. | |
double | kp_steer |
Steering proportional gain. Should be between 0 and 1. | |
double | initialz |
Initial height of the car. | |
btTransform | offsettrans |
To Account for the difference to coordinate system Usage: worldpose_inregcoordsys = offsettrans.inv()*worldpose_bullet*offsettrans. | |
btTransform | offsettransinv |
The inverse of the offset transformation above. | |
vector< double > * | zs |
Height of the rccar only used for visualization only x and y are used in optimization. | |
int | count_zs |
Internal variable to find the zs count to fill the height. | |
bool | reset_drivevel |
Used to make sure the velocity of the chassis is used just after reset instead of vehicle vel. | |
btRigidBody * | m_carChassis |
Pointer to the car rigidbody. | |
btCollisionShape * | chassisShape |
Pointer to the car collision shape. | |
btRaycastVehicle * | m_vehicle |
Pointer to the raycast vehicle (Does the constraint enforcing to convert the rigidbody to a vehicle) | |
btCollisionShape * | m_wheelShape |
Shape of the wheels used only for display purposes. | |
btRaycastVehicle::btVehicleTuning | m_tuning |
Tuning parameters for the vehicle used only internally. | |
btVehicleRaycaster * | m_vehicleRayCaster |
Raycaster which gives the point of contact of the vehicle wheels. | |
BulletWorld & | m_world |
CarState * | initialstate |
Initialstate if passed is stored here. |
A simple rear-drive Rccar model derived from Vehicle Demo using Bullet Physics Engine
This car model uses the full 6DOF state for simulation. To keep compatibility with existing 2D rccar model, this class only provides the state output as . The controls for the car are given as desired steering angle and desired body velocity. These controls are converted into true controls for the bullet rccar i.e driving torque and actual steering angle through proportional control. The gains for the controller are input as parameters to the system #TODO Use full state of the car
Author: Marin Kobilarov marin(at)jhu.edu Modified: Gowtham Garimella ggarime(at)jhu.edu
Bulletrccar::Bulletrccar | ( | BulletWorld & | m_world, |
vector< double > * | zs_ = 0 |
||
) |
Constructor. Each bullet system takes in a world in which it lies.
m_world | World class in which the current system lies. Only systems in one world can interact with each other |
zs_ | Vector of car heights along the trajectory used for display purposes. |
never deactivate the vehicle from computing collisions etc. Usually the bodies are deactivated after some time if they are not moving
create wheel connections
References gcop::Manifold< T, _n >::bnd, car_halfdims, carmass, chassisShape, forwardIndex, gcop::BulletWorld::IsZupAxis(), gcop::Rccar::l, gcop::Manifold< T, _n >::lb, gcop::BulletWorld::LocalCreateRigidBody(), m_carChassis, gcop::BulletWorld::m_dynamicsWorld, m_tuning, m_vehicle, m_vehicleRayCaster, m_wheelShape, m_world, offsettrans, offsettransinv, rightIndex, rollInfluence, steeringClamp, suspensionCompression, suspensionDamping, suspensionRestLength, suspensionStiffness, gcop::System< T, _nx, _nu, _np >::U, gcop::Manifold< T, _n >::ub, upIndex, velocityClamp, wheelAxleCS, wheelDirectionCS0, wheelFriction, wheelRadius, and wheelWidth.
gcop::Bulletrccar::~Bulletrccar | ( | ) | [inline] |
Destructor: Removes the car and its accessories from the world and deletes them
bool Bulletrccar::NoiseMatrix | ( | Matrix4d & | Q, |
double | t, | ||
const Vector4d & | x, | ||
const Vector2d & | u, | ||
double | dt, | ||
const VectorXd * | p | ||
) |
Reimplementation of Noise matrix for specific system
bool Bulletrccar::Reset | ( | const Vector4d & | x, |
double | t = 0 |
||
) |
never deactivate the vehicle from computing collisions etc. Usually the bodies are deactivated after some time if they are not moving
create wheel connections
References car_halfdims, gcop::Bulletrccar::CarState::carangularvel, gcop::Bulletrccar::CarState::carlinearvel, carmass, gcop::Bulletrccar::CarState::cartransform, chassisShape, count_zs, forwardIndex, gBreakingForce, gEngineForce, gVehicleSteering, initialstate, initialz, gcop::BulletWorld::IsZupAxis(), gcop::BulletWorld::LocalCreateRigidBody(), m_carChassis, gcop::BulletWorld::m_dynamicsWorld, m_tuning, m_vehicle, m_vehicleRayCaster, m_world, gcop::BulletWorld::Reset(), reset_drivevel, rightIndex, rollInfluence, suspensionCompression, suspensionDamping, suspensionRestLength, suspensionStiffness, gcop::System< T, _nx, _nu, _np >::t, upIndex, wheelAxleCS, wheelDirectionCS0, wheelFriction, wheelRadius, gcop::System< T, _nx, _nu, _np >::x, and zs.
Referenced by Step().
void Bulletrccar::setinitialstate | ( | const CarState & | inputstate, |
Vector4d & | x | ||
) |
Set the intial state of the car to given full state. This overrides the reset state of the car and allows to use full state #TODO Use full stat of the car directly
References gcop::Bulletrccar::CarState::carlinearvel, gcop::Bulletrccar::CarState::cartransform, initialstate, gcop::BulletWorld::IsZupAxis(), m_carChassis, gcop::BulletWorld::m_dynamicsWorld, m_vehicle, m_world, suspensionRestLength, wheelRadius, gcop::System< T, _nx, _nu, _np >::x, and zs.
void Bulletrccar::setinitialstate | ( | Vector4d & | x | ) |
Set the car initial state as the current state.
References gcop::Bulletrccar::CarState::carangularvel, gcop::Bulletrccar::CarState::carlinearvel, gcop::Bulletrccar::CarState::cartransform, initialstate, gcop::BulletWorld::IsZupAxis(), m_carChassis, m_world, offsettrans, offsettransinv, gcop::System< T, _nx, _nu, _np >::x, and zs.
double Bulletrccar::Step | ( | Vector4d & | xb, |
double | t, | ||
const Vector4d & | xa, | ||
const Vector2d & | u, | ||
double | h, | ||
const VectorXd * | p, | ||
Matrix4d * | A = 0 , |
||
Matrix42d * | B = 0 , |
||
Matrix4pd * | C = 0 |
||
) | [virtual] |
Reimplementation of the step function specific to bullet rccar
Reimplemented from gcop::Rccar.
References Reset().
Referenced by Step().
double Bulletrccar::Step | ( | Vector4d & | xb, |
const Vector2d & | u, | ||
double | h, | ||
const VectorXd * | p = 0 , |
||
Matrix4d * | A = 0 , |
||
Matrix42d * | B = 0 , |
||
Matrix4pd * | C = 0 |
||
) |
References count_zs, gain_cmdvelocity, gEngineForce, gVehicleSteering, gcop::Rccar::h, gcop::BulletWorld::IsZupAxis(), kp_steer, kp_torque, m_carChassis, gcop::BulletWorld::m_dynamicsWorld, m_vehicle, m_world, offsettrans, offsettransinv, reset_drivevel, steeringClamp, gcop::System< T, _nx, _nu, _np >::t, gcop::System< T, _nx, _nu, _np >::x, and zs.
double Bulletrccar::Step | ( | Vector4d & | xb, |
const Vector2d & | u, | ||
double | h, | ||
const VectorXd * | p, | ||
const Vector4d & | w, | ||
Matrix4d * | A = 0 , |
||
Matrix42d * | B = 0 , |
||
Matrix4pd * | C = 0 , |
||
Matrix4d * | D = 0 |
||
) |
References m_carChassis, and Step().
btVector3 gcop::Bulletrccar::car_halfdims |
half dimensions of car width, height, length
Referenced by Bulletrccar(), and Reset().
double gcop::Bulletrccar::carmass |
Mass of the car.
Referenced by Bulletrccar(), and Reset().
btCollisionShape* gcop::Bulletrccar::chassisShape |
Pointer to the car collision shape.
Referenced by Bulletrccar(), and Reset().
Referenced by Bulletrccar(), and Reset().
Gain parameter on the commanded velocity. Can be used to convert radio commands into true velocity commands.
Referenced by Step().
Initialstate if passed is stored here.
Referenced by Reset(), and setinitialstate().
double gcop::Bulletrccar::initialz |
Initial height of the car.
Referenced by Reset().
double gcop::Bulletrccar::kp_steer |
Steering proportional gain. Should be between 0 and 1.
Referenced by Step().
double gcop::Bulletrccar::kp_torque |
Proportional gain parameter for commanding torque to get to a desired velocity.
Referenced by Step().
btRigidBody* gcop::Bulletrccar::m_carChassis |
Pointer to the car rigidbody.
Referenced by Bulletrccar(), Reset(), setinitialstate(), and Step().
if contact goes above this value, it will process
btRaycastVehicle::btVehicleTuning gcop::Bulletrccar::m_tuning |
Tuning parameters for the vehicle used only internally.
Referenced by Bulletrccar(), and Reset().
btRaycastVehicle* gcop::Bulletrccar::m_vehicle |
Pointer to the raycast vehicle (Does the constraint enforcing to convert the rigidbody to a vehicle)
Referenced by Bulletrccar(), Reset(), setinitialstate(), and Step().
btVehicleRaycaster* gcop::Bulletrccar::m_vehicleRayCaster |
Raycaster which gives the point of contact of the vehicle wheels.
Referenced by Bulletrccar(), and Reset().
btCollisionShape* gcop::Bulletrccar::m_wheelShape |
Shape of the wheels used only for display purposes.
Referenced by Bulletrccar().
Referenced by Bulletrccar(), Reset(), setinitialstate(), and Step().
Not Used.
Maximum Engine force that can be applied.
btTransform gcop::Bulletrccar::offsettrans |
To Account for the difference to coordinate system Usage: worldpose_inregcoordsys = offsettrans.inv()*worldpose_bullet*offsettrans.
Referenced by Bulletrccar(), setinitialstate(), and Step().
btTransform gcop::Bulletrccar::offsettransinv |
The inverse of the offset transformation above.
Referenced by Bulletrccar(), setinitialstate(), and Step().
right of the car index in terms of x,y,z assigns the coordinate sys of car
Referenced by Bulletrccar(), and Reset().
Referenced by Bulletrccar(), and Reset().
Clamp on Steering angle.
Referenced by Bulletrccar(), and Step().
Compression factor decides by how much the car will compress wrto external loads.
Referenced by Bulletrccar(), and Reset().
Damping on suspension.
Referenced by Bulletrccar(), and Reset().
Rest length of suspension.
Referenced by Bulletrccar(), Reset(), and setinitialstate().
Stiffness of suspension. If not enough, the car will sink into ground.
Referenced by Bulletrccar(), and Reset().
Referenced by Bulletrccar(), and Reset().
Clamp on velocity of car.
Referenced by Bulletrccar().
btVector3 gcop::Bulletrccar::wheelAxleCS |
Wheel Axle Direction.
Referenced by Bulletrccar(), and Reset().
btVector3 gcop::Bulletrccar::wheelDirectionCS0 |
direction from the car towards the wheel contact point
Referenced by Bulletrccar(), and Reset().
wheel friction usually large value
Referenced by Bulletrccar(), and Reset().
Radius of wheel.
Referenced by Bulletrccar(), Reset(), and setinitialstate().
Width of wheel.
Referenced by Bulletrccar().
vector<double>* gcop::Bulletrccar::zs |
Height of the rccar only used for visualization only x and y are used in optimization.
Referenced by Reset(), setinitialstate(), and Step().