Re: problem in finding the forces applied on the cars
Bernhard Wymann <[email protected]>
| Newsgroups | gmane.games.torcs.general |
|---|---|
| Organization | wytec |
| Message-ID | <[email protected]> |
Hi Alan You are welcome, yes, it can take sometimes indeed some time till I answer, there fore you should post to the mailing list, so other people might help out or add to the discussion. I do not get exactly what you have tried from you text below, but to get the forces into the robot I would do this: - Add to the tPrivCar struct the fields you require (car.h), beware to change the right file and to run setup_win32.bat afterwards to deploy it (and/or the debug version, depending on your desired target(s)). If you like to have a shortcut macro like _youforce1here, you can define it as well (I find those not so good because the debugger cannot evaluate it, at least not on VS 2008 and 6). - Copy in simu.cpp, simupdate the values, around line 400 are examples, e.g. do carElt->_youforce1here = car->wing[0]->Kx etc. - Just access the value from your robot. Beware, because the robot is just called every 10th simulation step you get just every 10th value, depending on your requirements you need to build an averaging mechanism in simu.cpp. Best regards Bernhard On 10/30/2012 06:31 PM, Alan Ali wrote: > Hi Bernhard, > > Thank you very much for your answer, and i am so glad it was very quick > because i was afraid that it will take long time to get the answer, so > thank you again. > > but i think it is not so easy to take the code from one project to > another beacsue there is alot of connected file and structs... > > and if i managed to take the code to another project (the code that is > responsable of computing the forces and updating them) it is not esay > (to me) to know when i have to update the data, beacuse until now i > have't understand yet the way that the game run (when the engine is > called and and who call it and so on...) > > and i haven't yet found the documentation of the projects (to know what > each project do) some of them are clear where is the other are not. > > can you please just show how to add aero force in the "bt" project and > when to update it and how can i keep consistance with your programing > > thank you very much for your time. > > Best regard > > Alan > > > > > > > > On Wed, Oct 24, 2012 at 6:57 PM, Bernhard Wymann <[email protected] > <mailto:[email protected]>> wrote: > > Hi Alan > > TORCS is modular, because it should be possible to switch modules, > there should no module internals used, this is an architecture > decision (loose coupling, dependency inversion, client (->TORCS) > dictates the interface). Another point is that a real driver doesn't > now the hidden data either, he feels just the final force acting on him. > > But the solution for your requirement is trivial, just add to the > tCarElt struct the fields you need, and fill it in during the update > (I do not have the code handy to look it up, but at some point some > data from the simu tCar struct is copied to tCarElt to "publish" it > to TORCS). > > Have a look as well into the TORCS FAQ, chapter 6. Let me know if > this helped you. > > Best regards > > Bernhard > > > On Oct 24, 2012, at 18:25 , Alan Ali wrote: > >> Hello, >> >> I am new user (i have acceptable progaming experince but not games >> programing). >> >> i am trying to examine some control laws in PHD using TORCS as >> simulator, so now i am working in the "/drive/" function in the >> "/bt/" projects to drive the car but i have some problem in >> finding the forces applied on the cars, accutally it seems that >> the froces are computed in the "simv2" projects(aero dynamic >> forces and the rolling forces...) but the question is how to >> access it from "bt" project ? >> >> accutaly i don't understand why the simuv2 is not used in any >> projects, i can't see any call to the functions of simuv2 outside >> simuv2 (no project depend on it other than TORCS), if you can give >> me a link or reference that explaine how the game work and when >> the physique engine is envolved and whether we can access it's >> variables or not. >> >> thanks a lot > > ------------------------------------------------------------------------------ Everyone hates slow websites. So do we. Make your web apps faster with AppDynamics Download AppDynamics Lite for free today: http://p.sf.net/sfu/appdyn_sfd2d_oct