Beispiel #1
0
import numpy as np
from heartmap import live
import statedata
from vision_physics_vrona_asymgoal import VisionPhysics
from racing_line_delta import racing_line_delta

pCars = live()


class Task():
    # Task (environment) that defines the lapdist_target and provides feedback to the agent

    def __init__(self,
                 vision=None,
                 pose=None,
                 racing_line=None,
                 euler=None,
                 lVelocity=None,
                 aVelocity=None,
                 lAccel=None,
                 runtime=5):

        # Initialize a Task object.
        self.visiomo = VisionPhysics(vision, pose, racing_line, euler,
                                     lVelocity, aVelocity, lAccel,
                                     runtime)  # clapdist,

        # self.action_repeat = 1

        # state made of PCars2 output on screen in a window captured
        self.visionstate_size = (89, 120, 3)
Beispiel #2
0
import numpy as np
from heartmap import live
import statedata
import csv
livegame  = live()

"""
After driving manually to get the racing line X,Y,Z coordonates (aka X,Z,Y from PCars2 perspective)
The goal is to retrieve in real time the delta between the racing line and the current position of
the car.
racingline_data.txt is processed to provide the final_RL_spainGP.csv. Which contain for each meters X,Y,Z coordinates

The principle here is
As the car drive, its current lap distance is compared to the race_line file.
When these 2 data are matching, live X,Y coordinates of the car are substract
to the X,Y coordinates of the ideal race_line.
"""

# loading final_RL_spainGP.csv
rl_data2np =np.genfromtxt('V:/vrona_bot88/final_RL_spainGP.csv', delimiter='\t')
# print(rl_data2np.shape)
rl_data2npint = rl_data2np.astype(np.int64)

# racing_line_delta function which will be used in the reward function included in Task scripts
def racing_line_delta():
    # getting live current lap distance of the car
    def currentlapdistance():
        # global currentlapdistance
        while True:
            for player in livegame.lapinfo():
                currentlapdistance = int(player['lap_distance'])