Example #1
0
def carInteractive():
    vehicle = vh.car((0,-1,0),0,1.,VEHICLE_SPEED)
    window = Window(position=(0,14,0),flying=True,vehicle=vehicle,
                    height=800,width=800, caption='Pyglet',
                    resizable=True)
    # Hide the mouse cursor and prevent the mouse from leaving the window.
    window.set_exclusive_mouse(False)
    setup()
    pyglet.app.run()
Example #2
0
def carMaze(controller=None):
    x,z = mazeStart
    vehicle = vh.car((-x,-1,z),np.pi,1.,VEHICLE_SPEED,controller=controller)
    window = Window(position=(0,14,0),flying=True,vehicle=vehicle,
                    height=800,width=800, caption='Pyglet',
                    resizable=True)
    # Hide the mouse cursor and prevent the mouse from leaving the window.
    window.set_exclusive_mouse(False)
    setup()
    pyglet.app.run()
Example #3
0
    def __init__(self):
        gain = 0.1
        vehicle = vh.car((0, -1, 0), np.pi, 1., gain=gain, controller=None)
        model = mc.Model(vehicle, mc.smallLayout)

        self.gain = gain
        dt = 0.05

        uLow = np.array([-1, -1.])
        uHigh = np.array([1., 1.])
        self.action_space = gym.spaces.Box(low=uLow,
                                           high=uHigh,
                                           dtype=np.float32)

        xHigh = np.array([2.5, 2.5, np.inf, 2., 2.])
        xLow = np.array([-2.5, -2.5, -np.inf, -2., -2.])
        self.observation_space = gym.spaces.Box(low=xLow,
                                                high=xHigh,
                                                dtype=np.float32)
        super().__init__(model, dt)
Example #4
0
def carSmall(controller=None):
    vehicle = vh.car((0,0),np.pi,1.,VEHICLE_SPEED,controller=controller)
    window = Window(position=(0,3,0),flying=True,
                    layout=smallLayout,
                    vehicle = vehicle,
                    height=800,width=800, caption='Pyglet',
                    resizable=True)

    # Hide the mouse cursor and prevent the mouse from leaving the window.
    window.set_exclusive_mouse(False)
    setup()
    pyglet.app.run()

    fig,ax = plt.subplots(3,1,sharex=True)
    ax[0].plot(vehicle.Time,vehicle.XTraj)
    ax[0].set_ylabel('x',fontsize=16)
    ax[1].plot(vehicle.Time,vehicle.YTraj)
    ax[1].set_ylabel('y',fontsize=16)
    ax[2].plot(vehicle.Time,vehicle.ThetaTraj)
    ax[2].set_ylabel(r'$\theta$',fontsize=16)
    ax[2].set_xlabel('Time',fontsize=16)