Skip to content

Instantly share code, notes, and snippets.

Avatar

Roger Cheng Roger-random

View GitHub Profile
@Roger-random
Roger-random / hello_cartpole.py
Created Jun 2, 2019
Failed first attempt to adapt simple Q-Learning to CartPole example
View hello_cartpole.py
import gym
import numpy as np
import matplotlib.pyplot as plt
class hello_cartpole:
def __init__(self):
self.env = gym.make('CartPole-v0')
self.env.reset()
def close(self):
@Roger-random
Roger-random / taxi_q.py
Created Jun 2, 2019
Following simple Q-learning tutorial
View taxi_q.py
# Following along sample from this page
# https://www.oreilly.com/learning/introduction-to-reinforcement-learning-and-openai-gym
# with a few modifications to look at what's going on under the hood.
import gym
import numpy as np
import matplotlib.pyplot as plt
env = gym.make("Taxi-v2")
env.reset()
@Roger-random
Roger-random / neato_commander.py
Created Apr 1, 2019
Test program to poll Neato laser distance sensor data
View neato_commander.py
import serial
import time
lf = b'\n'
eom = b'\x1a'
class NeatoCommander():
def __init__(self, port="/dev/ttyACM1", timeout=1):
s = serial.Serial()