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
6 changes: 6 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,12 @@ __pycache__/
*.py[cod]
*$py.class

# vim files
*.swp

# ignore generated datafile
*.npy

# C extensions
*.so

Expand Down
10 changes: 10 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -29,5 +29,15 @@ Though, these are included in the setup.py file. For the absolutely correct lis
There are a variety of examples in the 'examples' folder. Check these out before
starting your simulation!

You can run the examples with
```
./run_sim.py rps/examples/<example_name>.py
```

You can also run the examples without the wrapper, but it won't perform any dependnecy sanity checks.
```
python3 rps/examples/<example_name>.py
```

# Submission Instructions
When your simulation is complete, go the the Robotarium [website](https://www.robotarium.org), follow the instructions there, and see your code run on real robots!
2 changes: 1 addition & 1 deletion rps/examples/formation_control.py
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@
iterations = 2000
N = 6

r = robotarium.Robotairum(number_of_agents=N, number_of_agents=10, show_figure=True, save_data=True, update_time=1)
r = robotarium.Robotarium(number_of_agents=N, show_figure=True, save_data=True, update_time=1)

si_barrier_cert = create_single_integrator_barrier_certificate(N)

Expand Down
41 changes: 41 additions & 0 deletions run_sim.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
#!/usr/bin/env python3

import os
import sys

# PyQt4 still has a bug where it fails to yeild interactive control
# back to the starting terminal on some operating systems. This is
# at least observed on Linux and may affect OSX as well. Manually
# setting Qt4 return hooks didn't work. The only apparent fix
# is to move to Qt5 if able. This method check if the required
# PyQt5 modules and backend are present. If they are, we move the
# renderer forward to PyQt5. Otherwise, we fallback to the default.
#
# Backend *MUST* be set before any subpackages are imported.
def select_pyplot_renderer():
try:
from PyQt5 import QtCore, QtGui, QtWidgets
import matplotlib
matplotlib.use('Qt5Agg')
except ImportError:
if sys.platform == "linux" or sys.platform == "linux2":
print('*** could not set sim renderer to Qt5Agg')
print('*** canvas may fail to yield interactive control on close')
print('*** please install PyQt5 if you experience issues')
print('\tDebian Package: python3-pyqt5')
print('\tFedora Core: python3-qt5')
print('')
print('')

# fallback renderer
import matplotlib
matplotlib.use('TkAgg')


select_pyplot_renderer()

print('launching sim program: ' + sys.argv[1])
print('')
os.system('python3 ' + sys.argv[1])
exit(0)