DeepGTAV
DeepGTAV copied to clipboard
Autopilot for player's agent?
Is it possible to turn on autopilot for the player's agent? For example, give it a goal in world coordinates, and let GTA use a planner, if available?
You have to replace
if (_drivingMode >= 0) AI::TASK_VEHICLE_DRIVE_WANDER(ped, vehicle, _setSpeed, _drivingMode);
with
if (_drivingMode >= 0)AI::TASK_VEHICLE_DRIVE_TO_COORD(ped, vehicle, dir.x, dir.y, dir.z, _setSpeed, 1.0, vehicleHash, drivingStyle, 1.0, true);
in Scenario.cpp
.
dir.x
, dir.y
and dir.z
are the coordinates you want to drive to.
Yes, it is possible. In my repo, I extended the DeepGTAV. You may pickup the world coordinates first, and set up the python client script like this:
# Creates a new connection to DeepGTAV using the specified ip and port
client = Client(ip=args.host, port=args.port, datasetPath=args.dataset_path, compressionLevel=9 , divideByTrip=True)
dataset = Dataset(rate=20 ,frame=[320,180], throttle=True, brake=True, steering=True, speed=True, acceleration=True, yaw=True, yawRate=True, isCollide=True, location=True,
drivingModeMsg=True)# lidar=[3, True, 100.0, 1000, 60.0, 300.0, 20, 85.0, 115.0], , vehicles=True, peds=True
# Automatic driving scenario
scenario = Scenario(weather='EXTRASUNNY',vehicle='blista', time=[12,0], drivingMode=[-2, 3, 25.0, 1.0, 1.0],
route=[ \
-1989.000000, -468.250000, 10.562500,
1171.351563, -1925.791748, 36.220097
])
The robot will drive for you in the GTAV world along the path you choose. Have fun!!