ikt32 / GTAVManualTransmission

Manual Transmission for GTA V
https://www.gta5-mods.com/scripts/manual-transmission-ikt
184 stars 43 forks source link

Steering wheel self driving mode support #29

Closed ConradoMateu closed 5 years ago

ConradoMateu commented 6 years ago

Hello,

I am having problems in my thesis with the steering wheel output in self driving mod (using DeepGTAV), the steering wheel seems that sometimes is behaving the contrary of the current steering and sometimes moves when the car is going straight without any sense.

I have tried to invert the value of the effSteer in doWheelSteering() and also change the steerValRaw and steerVal from updateWheel(), in order to fix it, but no one is working.

Could support this mod the self driving?

Thanks :)

Here is the link (wasn't working in markdown): https://media.giphy.com/media/4WFDMMRNfDLduAi2NB/giphy.gif

ikt32 commented 6 years ago

Ooh, awesome project you're doing!

The steering wheel motors are used as outputs to the forces measured in-game. If you steer left you can notice a force in the opposite direction. Without your hands stopping the wheel it'll indeed move the opposite direction the car is going.

What are you doing to make the car navigate? How I force the steering wheel as input completely overrides any other game inputs, so I'm not sure how compatible it is to DeepGTAV. I'll be happy to help though, so more detailed info on how you access/use the vehicle (and this script) might help a lot.

ConradoMateu commented 6 years ago

I use this mode as normal, I just configure the steering wheel and then I launch DeepGTA (modified for my thesis).

The main command that makes the car navigate by itself is: AI:TASK_VEHICLE_DRIVE_TO_COORD_LONGRANGE Here is more detail info about it. Then DeepGTAV makes it more accurate with Rewarders.

My idea was to get the input steering of the car that is in self driving mode and then send that value to the steering wheel in order to move it in the right direction (but I don't know how to send this steering in order to move the wheel). The way to extract the steering of the car that I'm using right now is the following: float steeringDirection = -getFloatValue(vehicle,0x924)/0.6981317008 //value between [-1,1]

Thank you for your help, hope that this information is useful for you :)

ikt32 commented 6 years ago

If you don't mind me asking, what's your thesis about exactly?

Sounds like your use case is vastly different to what the mod was made for. Do you want DeepGTAV to generate input commands and then pipe them through Manual Transmission?

You could fork this repo and I think the following changes would allow you to use the steering wheel as input (using output from DeepGTAV):

I'm not sure if AI::TASK_VEHICLE_DRIVE_TO_COORD_LONGRANGE does lane-keeping and all that and I can't say I've messed with the game AI, but if you just want to achieve full control, that might be the best way.

There are still a bunch of features that aid gameplay (automatic input switching and for the most part, the Manual Transmission part) which might not be useful to you. Do you only plan to use the steering wheel input aspect of this?

ConradoMateu commented 6 years ago

Of course, sorry for not explain the thesis well. The purpose of it is to foster trust in self-driving cars by providing different feedback to the users on board, for instance, HUD or an AR Layer that highlight cars and pedestrians, shows the behaviour of the car (directions), sound feedback when there is a warning to crash or a danger situation (accident) and an event manager that takes care of dangerous situations.

The idea of using this mod is for two reasons, the first one there is an approach where a the autonomous vehicle cannot handle the situation and gives the control to the user by triggering a takeover, so the mod is useful for this part. On the other hand, the other approach is about self driving where the aim to achieve would be move the steering wheel in the right direction that is going the Autonomous vehicle (with the help of this mode if possible). So i was wondering how can I use for this case the steering wheel to give the input of the steering and move it into the right direction, cause I was trying to modify different parameters and none of them seem to work.

ikt32 commented 6 years ago

Hmmm, IM might be better to chat about this. If you have Discord, it's ikt#0758. I prefer not to use Skype or Steam.

What you want to achieve sounds pretty reasonable, but I won't have much time on my hands until after the 28th.

For purely steering input you need to force the mod to use the steering wheel as input, and move the steering wheel with the motors. You can move them by using DirectInput or just by modifying some parameters. For example, you'd replace carControls.PlayFFBDynamics(totalForce, damperForce); in playFFBGround() by a function like SetWheelPosition(position).

So, what do you exactly want from me and the modification? You're free to fork the project and make your changes (That's what GitHub is for, after all ;)). I can help with identifying and stripping out parts that aren't needed for basic operation, such as the manual transmission emulation part and also probably adapt it to your wishes.

Just out of curiosity - how long do you have for the project?

ikt32 commented 5 years ago

Closing this issue as the project has ended successfully.