Re: Vehicle configuration

Report any bugs here and we'll post fixes

Moderators: Sascha Willems, Thomas

Re: dNewtonCollisionMesh problem

Postby Julio Jerez » Thu Feb 12, 2015 11:31 am

Ha much better :D , some comments.
are you controlling the steering with an analog control?

when I see from the first person, it looks like you have a keyboard which is an all of nothing controller. That makes it very hard to control the vehicle when driving straight.
In the demos I can not do analog control because the GUI does no support it and the demos are very basic, but try doing analog steering first and fort most.
If you are then try to apply a gain factor to the steering, by this I mean
pretend that the steering wheel is a big wheel, the bigger the wheel the better the control.

There is a show called MythBusters. when they demonstrated the effect of controlling a vehicle with a standard remote control with a small steering button and the vehicle always tumble from side to side just like your video. Then they switched to using a very big steering disk and they can control the vehicle very smoothly. After that now they always use the large bus steering wheel to control vehicles.

The way you implement that is that you can add a gain ratio between the input from the controlling device and the value you pass to the controller. Say you say that gain 0.5, now for each turn of the steering only half turn goes to the controller.

The OFF and all the serialization can be used is jut that I has not implemented then for the dNewton
but you do not when to serialize using OFF, because OFF is a standard format that can not contain the internal connectivity that newton use internally. The reason I use OFF and not OBG, is that OFF support arbitrary polygon so for fix bugs is better than OBG.

what do you want to serialize I assume the streets and all the background.
I can add serialization to the dCollision this weekend.

you can modify anything, I never try updating the wheel but it is possible yes.
Julio Jerez
Moderator
Moderator
 
Posts: 12249
Joined: Sun Sep 14, 2003 2:18 pm
Location: Los Angeles

Re: dNewtonCollisionMesh problem

Postby e3dalive » Thu Feb 12, 2015 12:35 pm

i'm controlling it with keyboard, i will test it with real steering wheel in monday
here is the rolling video test https://www.youtube.com/watch?v=1Ll_rQx6L4U
you have a structure CustomVehicleControllerBodyStateTire::TireCreationInfo
i use it to create tires with AddTire function
my question is how can i change these tire parameters in runtime:
Code: Select all
dVector m_location
dFloat m_springStrength;
dFloat m_suspesionlenght;

if i inherit CustomVehicleControllerBodyStateTire can i safely change those values?

these parameters, i can't access them directly from the tire class, because they marked as protected, and also you do some calculations in addtire for them.
Also in what units does the function CustomVehicleControllerBodyStateTire::GetTireRotationSpeed returns(omegas, rpms, or rotations per iteration)?
e3dalive
 
Posts: 87
Joined: Thu Feb 05, 2015 5:20 am

Re: dNewtonCollisionMesh problem

Postby Julio Jerez » Thu Feb 12, 2015 2:09 pm

e3dalive wrote:you have a structure CustomVehicleControllerBodyStateTire::TireCreationInfo
i use it to create tires with AddTire function
my question is how can i change these tire parameters in runtime:


Ok let us do this, make a list of the thong that you wish, and posted then I can go and add them

maybe stating with a pir of function like
Code: Select all
GetTireInfo (TireCreationInfo& info)
UpdateTireInfo(const TireCreationInfo& info)

that will allows you to do the update an run time.
If that is ok to you I can add that very quickly tonight

In the role over you can do few things, low the CG a little, stiff the tire suspensions, change the lateral tire stiffness.
There are so my variables and only experimentation lead to good result.

On the angular Speed function the values are Radians Per second. In newton all measurement
are in the international Metris system of unit MKS (meter, kilogram, seconds)

some of the vehicles creation parameters are in the English system because that's how most data sheet for vehicle found in American Magazines gives the units in English system of units,
but if you look at the function they are all converted to MKS system
Julio Jerez
Moderator
Moderator
 
Posts: 12249
Joined: Sun Sep 14, 2003 2:18 pm
Location: Los Angeles

Re: dNewtonCollisionMesh problem

Postby e3dalive » Thu Feb 12, 2015 2:49 pm

great
this sounds wonderful:
Code: Select all
GetTireInfo (TireCreationInfo& info)
UpdateTireInfo(const TireCreationInfo& info)

since I've switched to using pure newton, i don't need you to implement anything 'd' related
e3dalive
 
Posts: 87
Joined: Thu Feb 05, 2015 5:20 am

Re: dNewtonCollisionMesh problem

Postby e3dalive » Fri Feb 13, 2015 6:01 am

about engine overloading
as i understand i can get rotation speed of each wheel[i need float omega of each wheel] with this function
CustomVehicleControllerBodyStateTire::GetTireRotationSpeed()
now i only need to find where can i set torque[resuls is float torque] per each wheel
probably by overloading this CustomVehicleControllerComponentEngine::dFloat GetTorque (dFloat radianPerSeconds) but i'm not sure if it' what i need
e3dalive
 
Posts: 87
Joined: Thu Feb 05, 2015 5:20 am

Re: dNewtonCollisionMesh problem

Postby Julio Jerez » Fri Feb 13, 2015 11:53 am

ok the function for updating the tire are these

Code: Select all
void GetInfo(TireCreationInfo& tireInfo) const;
void UpdateInfo(const TireCreationInfo& tireInfo);

there are member of class CustomVehicleControllerBodyStateTire

for the tire torque, in your sub class from CustomVehicleControllerComponentEngine
you will find virtual function virtual void Update (dFloat timestep);
you implement that function and for there you can get the tires that are connected to the engine
and call tire->SetTorque (torque);
something like this
Code: Select all
myEngfineCl;ass::Update (dFloat timestep)
{
      for (int i = 0; i < count; i ++) {
//calculate the tire torque from the engine, transmission, and differetical
         dFloat tireTorque = calculate the tire torque from the engine, transmission, and differetical ;
         const dMatrix& matrix = tireArray[i]->GetMatrix();
         const dVector& torque = tireArray[i]->GetTorque ();
         tireArray[i]->SetTorque(torque + matrix[0].Scale (tireTorque));
      }
}
Julio Jerez
Moderator
Moderator
 
Posts: 12249
Joined: Sun Sep 14, 2003 2:18 pm
Location: Los Angeles

Re: dNewtonCollisionMesh problem

Postby e3dalive » Fri Feb 13, 2015 12:05 pm

thank you very much, i will get right on it
e3dalive
 
Posts: 87
Joined: Thu Feb 05, 2015 5:20 am

Re: dNewtonCollisionMesh problem

Postby e3dalive » Fri Feb 13, 2015 12:21 pm

i think you need to wake the car up after setting new tireinfo
i managed to do so by setting brakes brakes->SetParam(1.0f);
e3dalive
 
Posts: 87
Joined: Thu Feb 05, 2015 5:20 am

Re: dNewtonCollisionMesh problem

Postby Julio Jerez » Fri Feb 13, 2015 12:31 pm

two things.
-when you update tire vehicle at run time, you can not do it from inside a newton updated.

-after a series of tire update, call m_controller->Finalize();

this is needed because the car is a close system, change a tire influence the way the body acct and some calculated parameters can only be calculated after all the component of the are defined.

you go

UpdateTire(...)
UpdateTire(...)
UpdateTire(...)
....

m_controller->Finalize();

-cars do go to sleep yes, there are rigid bodies and obey all the constraints of Dynamic bodies.
Julio Jerez
Moderator
Moderator
 
Posts: 12249
Joined: Sun Sep 14, 2003 2:18 pm
Location: Los Angeles

Re: dNewtonCollisionMesh problem

Postby e3dalive » Sat Feb 14, 2015 3:10 pm

does newton have some form of speed limiter on bodies, do you have a function to change that? i can't get any car going faster then 100KMH?
even when i forcibly apply 100 torque to all wheels it's still stuck at 99.9
e3dalive
 
Posts: 87
Joined: Thu Feb 05, 2015 5:20 am

Re: dNewtonCollisionMesh problem

Postby Julio Jerez » Sat Feb 14, 2015 4:01 pm

void CustomVehicleControllerComponentEngine::SetTopSpeed (dFloat topSpeedMPS, dFloat rpsAtPickPower)
Julio Jerez
Moderator
Moderator
 
Posts: 12249
Joined: Sun Sep 14, 2003 2:18 pm
Location: Los Angeles

Re: dNewtonCollisionMesh problem

Postby e3dalive » Sun Feb 15, 2015 4:04 am

thank you, i've integrated our engine into newtonengine.
in this video http://www.youtube.com/watch?v=frj36agyVmY the blue boxes are the "dfloat location" in tire structure where we attach spring to chasis.
As far as i understand theese points must be where i place them, but after i relocate them when i try to change length of the spring wheels fall through ground, can this be fixed, or do i have to to attach points higher[like in the beginning of the video] and change car center of mass to make it stable?
the white box in center of the car is the center of mass, the blue box in the car is the center of the car.
e3dalive
 
Posts: 87
Joined: Thu Feb 05, 2015 5:20 am

Re: dNewtonCollisionMesh problem

Postby Julio Jerez » Sun Feb 15, 2015 11:15 am

do you call m_controller->Finalize();
after you change the wheel parameters?
Julio Jerez
Moderator
Moderator
 
Posts: 12249
Joined: Sun Sep 14, 2003 2:18 pm
Location: Los Angeles

Re: dNewtonCollisionMesh problem

Postby e3dalive » Sun Feb 15, 2015 11:19 am

yes, if i don't => car is getting stuck inside ground :D
changing length doesn't seem to affect car in anyway, except make wheels get into ground as you can see from video
after i "UpdateInfo" of the tire, "GetInfo" seems to return different values
screenshots of before calling getinfo per each wheel and after
Image
from what i can see the Y values of dLocation and wheel mass are incorrect after calling getinfo
e3dalive
 
Posts: 87
Joined: Thu Feb 05, 2015 5:20 am

Re: dNewtonCollisionMesh problem

Postby Julio Jerez » Sun Feb 15, 2015 1:30 pm

Oh I see there was a bug in function GetInfo, it is fixed now

on the other question, suspension length do not have any impact on tire force calculation.
length is important for vehicle behavior for example a soft suspension must be longer than a hard
suspension so the tire does not hit the limits. ex off-road vehicle vs sport vehicles
Julio Jerez
Moderator
Moderator
 
Posts: 12249
Joined: Sun Sep 14, 2003 2:18 pm
Location: Los Angeles

PreviousNext

Return to Bugs and Fixes

Who is online

Users browsing this forum: No registered users and 1 guest

cron