Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,2 +1,3 @@
*.idea
__pycache__/
*.DS_Store
18 changes: 18 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,2 +1,20 @@
# ARoboCarController
Controller for ARoboCar simulator
## Setup notes
Please set OS environment variable called DATA_DIR to a directory where the controller will write the training and model hdf5 files. It needs to be fully qualified and not a relative path as h5py isn't able to deal with relative paths on Mac.

## Running it on Windows
- Install Unreal engine if you haven't.
- Install Cygwin (Cygwin.com) - default installation worked for me. We need this for some code to work.
- Install Visual Studio 2017 if you haven't. (This is the environment I tried with and you need it to rebuild the project)
- Clone git repos - ARoboCar and ARoboCarController (you will need git) - https://github.com/eastbayML/
- Open ARoboCar directory in file explorer, choose ARoboCar.uproject and open with a text editor. Under plugins, set UnrealEnginePython plugin to false. Now, select ARoboCar.uproject, click right mouse button and you should see the option to generate Visual Studio Project files.
- Open the Visual studio solution file and build the solution. It also shows the path to python interactive environment. You should note that in case you have to install hdpy.
- Install UnrealEnginePython from https://github.com/20tab/UnrealEnginePython/. Just place the directory under Plugins directory of your project.
- Now open Epic Games, launch the Unreal Engine and open the project just to make sure you can. Re-enable UnrealEnginePython plugin and quit the engine.
- Now go to a Cygwin terminal and set the required python environment e.g. "source activate root"
- Open the project from commandline.
"$PATH_TO_ENGINE/UE4Editor.exe path_to_uproject_file_in_windows_convention"
Unreal engine doesn't seem to understand cygwin version of path so just use windows path
- Next set your DATA_DIR environment variable, open your favorite python editor from commandline (in the cygwin environment). This is important for the communication to work between the two processes.

2 changes: 1 addition & 1 deletion controller.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,5 +15,5 @@ def hook(config):

while True:
state=sim.get_state()
print("pathdistance {:7f} offset {:5f} distance {:7f} angle {:5.3f} dt={:5.4f}".format(state["pathdistance"], state["offset"], state["PIDthrottle"], state["PIDsteering"],state["delta_time"]))
print("pathdistance {:7f} offset {:5f} distance {:7f} angle {:5.3f} dt={:5.4f}".format(state["pathdistance"], state["pathoffset"], state["PIDthrottle"], state["PIDsteering"],state["delta_time"]))
sim.send_cmd({"steering":state["PIDsteering"],'throttle':state["PIDthrottle"]})
5 changes: 4 additions & 1 deletion deviating_controller.py
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,7 @@
deviating_cnt=0
h5idx=0
while True:
try:
# get images and state from simulator
# record images and steering,throttle
state=sim.get_state()
Expand Down Expand Up @@ -72,5 +73,7 @@
deviation_angle = steering + random.random() * steering_noise - (steering_noise / 2)
print("** Begin Steering deviation {}".format(deviation_angle))


sim.send_cmd({"steering":steering,'throttle':throttle})

except TypeError:
pass
Binary file added docs/plan.jpeg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added docs/plan.key
Binary file not shown.
Binary file added docs/plan.pptx
Binary file not shown.
8 changes: 6 additions & 2 deletions project.py
Original file line number Diff line number Diff line change
@@ -1,2 +1,6 @@
datadir="../data/"
modeldir="../data/"
import os
#datadir="../data/"
# VL: 6/23/17. have to do this because on the Mac h5py isn't able to deal with relative paths
datadir=os.environ["DATA_DIR"]
modeldir=datadir
#modeldir="../data/"
4 changes: 2 additions & 2 deletions simulator.py
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ def get_state(self):
try:
return pickle.load(self.fstate)
except EOFError:
print("Connection closed")
#print("Connection closed")
return None

def send_cmd(self,command):
Expand Down Expand Up @@ -59,4 +59,4 @@ def reset(self):
print("pausing")
tmp=self.get_state()
self.send_cmd({"steering": 0, "throttle": 0})
print("Done")
print("Done")