Vehicle gearbox

A place to discuss everything related to Newton Dynamics.

Moderators: Sascha Willems, walaber

Vehicle gearbox

Postby darekruman » Mon Sep 29, 2008 6:36 am

Hi.

I'm using newton in truevision3d engine but i have a problem with making proper working gearbox.

I want to make a gearing for my vehicle simulator but i cannot make it right (like in real car) because i cannot set wheel angular velocity.
When i add vehicle wheels are not adding as a body - so i cannot set SetBodyAngularVelocity.

Only thing that left to my is SetTorque stuff that is not good for car simulator (only for one gear karts or some arcade radio controled vehicles or testing purposes).
As we know or not - in first gear wheels are spinning slowest but torque is highest. Every next gear lower max torque but higher max speed.

If you wanna make it in Newton by SetTorque - car will be accelerating only in 1st gear - in second torque will be lesser than in first so car will be slowing down.

For all others newton fighters - some ideas how can i make good gearing simulator with only SetTorque stuff so gears will be working like in real car?

P.S Code and explanation

My code of what your are talking about :

Code: Select all
  Car.WheelSpeed := physics.GetVehicleWheelAngularVelocity(car_id,2); // rear wheel (RWD)
  Car.Engine_RPM := (Car.WheelSpeed * Car_Perf.final_gear_ratio * car_Perf.gear_ratio[car.gear] * 60) / (2 * PI);
  Car.Torque_Engine := GetTorque(car.Engine_RPM) * car.Throttle;
  Car.Torque_Drive := (Car.Torque_Engine  * Car_Perf.final_gear_ratio * car_Perf.gear_ratio[car.gear]);

 if (Car.Gear <> 0) and (car.Throttle > 0) then begin
    physics.SetVehicleWheelTorque(car_ID, rlw,Car.Torque_Drive,0);
    physics.SetVehicleWheelTorque(car_ID, rrw,Car.Torque_Drive,0);
 end


taking Honda CRX for example

In first gear - redline 7600 rpm we get about 68 km/h and 1435 Nm
We are changing gear to second
Now we have got 4000 rpm and 953 Nm of torque ... so the car is slowing down because we apply less torque than in previous gear

I think that I explain that clear

Thanks for all advices!!
darekruman
 
Posts: 2
Joined: Thu Sep 25, 2008 3:28 pm

Re: Vehicle gearbox

Postby chinanzio » Mon Sep 29, 2008 12:09 pm

what sdk version are you using ??
if 1.53 there is no way to get the tires as bodies , i recommend you to use the 2.0 version where you can do this:

create a car with:
CustomJoint *CreateCustomMultiBodyVehicle(const dFloat* frontDir, const dFloat* upDir, const NewtonBody* carBody);
like this:
CustomJoint *vehicleJoint = CreateCustomMultiBodyVehicle(...);

add tires with:
int CustomMultiBodyVehicleAddTire (CustomJoint *car, const void* userData, const dFloat* localPosition, dFloat mass, dFloat radius, dFloat width, dFloat suspensionLength, dFloat springConst, dFloat springDamper);
like this:
CustomMultiBodyVehicleAddTire( vehicleJoint, NULL, &TireMatrix.m_posit[0], TireMass, radio, ancho, suspensionLength, suspesionSpringConst, suspesionSpringDamper);

then you can get the tire as a body with :
const NewtonBody* CustomMultiBodyVehicleGetTireBody(CustomJoint *car, int tireIndex);

which i think is what you need

to get the 2.0 version send a PM to julio

good luck...
while(true) Pensar();
User avatar
chinanzio
 
Posts: 6
Joined: Thu Apr 26, 2007 5:54 am
Location: Barcelona

Re: Vehicle gearbox

Postby darekruman » Tue Sep 30, 2008 2:01 am

chinanzio wrote:what sdk version are you using ??
if 1.53 there is no way to get the tires as bodies , i recommend you to use the 2.0 version where you can do this:

create a car with:
CustomJoint *CreateCustomMultiBodyVehicle(const dFloat* frontDir, const dFloat* upDir, const NewtonBody* carBody);
like this:
CustomJoint *vehicleJoint = CreateCustomMultiBodyVehicle(...);

add tires with:
int CustomMultiBodyVehicleAddTire (CustomJoint *car, const void* userData, const dFloat* localPosition, dFloat mass, dFloat radius, dFloat width, dFloat suspensionLength, dFloat springConst, dFloat springDamper);
like this:
CustomMultiBodyVehicleAddTire( vehicleJoint, NULL, &TireMatrix.m_posit[0], TireMass, radio, ancho, suspensionLength, suspesionSpringConst, suspesionSpringDamper);

then you can get the tire as a body with :
const NewtonBody* CustomMultiBodyVehicleGetTireBody(CustomJoint *car, int tireIndex);

which i think is what you need

to get the 2.0 version send a PM to julio

good luck...


Thanks for helping - i need to wait until truevision engine developers team will implement Newton 2.0.
darekruman
 
Posts: 2
Joined: Thu Sep 25, 2008 3:28 pm


Return to General Discussion

Who is online

Users browsing this forum: No registered users and 8 guests