Skip to content

Commit

Permalink
AER1216 files
Browse files Browse the repository at this point in the history
  • Loading branch information
JacopoPan committed Nov 18, 2020
1 parent 4aea5c1 commit dc32880
Show file tree
Hide file tree
Showing 4 changed files with 25 additions and 24 deletions.
26 changes: 13 additions & 13 deletions assignments/README.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# On Ubuntu or macOS

The repo was written using *Python 3.7* on *macOS 10.15* and tested on *Ubuntu 18.04*
The repo was written using *Python 3.7* on *macOS 10.15* and tested on *macOS 11*, *Ubuntu 18.04*

## Requirements
In a terminal, type
Expand All @@ -14,45 +14,45 @@ $ pip install --upgrade 'ray[rllib]'
## Installation
In a terminal, type
```
$ wget https://github.com/JacopoPan/gym-pybullet-drones/archive/v0.5.0.zip
$ unzip v0.5.0.zip
$ cd gym-pybullet-drones-0.5.0/
$ wget https://github.com/JacopoPan/gym-pybullet-drones/archive/v0.5.1.zip
$ unzip v0.5.1.zip
$ cd gym-pybullet-drones-0.5.1/
$ pip install -e .
```

## Use
In a terminal, type
```
$ cd assignments/
$ python hw_simulation.py
$ python aer1216_fall2020_hw1_sim.py #### e.g., for hw1
```

# On Windows

## Requirements

Download [C++ 14.0](https://visualstudio.microsoft.com/downloads/)
Download Visual Studio and [C++ 14.0](https://visualstudio.microsoft.com/downloads/)
- We recommend the free Community version
- Select "Desktop development with C++"

Download [Python 3](https://www.python.org/downloads/release/python-390/)
- Note: we used the [Windows x86-64 installer](https://www.python.org/ftp/python/3.9.0/python-3.9.0-amd64.exe) on Windows 10 Home

Download a Python IDE.
Download a Python IDE
- We recommend [PyCharm Community](https://www.jetbrains.com/pycharm/download/#section=windows)
- Select all the options in the installer and reboot

## Installation

Download the code
- Go to https://github.com/JacopoPan/gym-pybullet-drones/releases
- Under version `TBD`, click on "Assets" and download the source code (zip or tar.gz)
- Under "Release", `v0.5.1`, click on "Assets" and download the source code (zip or tar.gz)

<img src="../files/readme_images/assignment_img1.png" alt="source code" width="800">

Open the `gym-pybullet-drones-v.TBD` folder in PyCharm
Unzip and open folder `gym-pybullet-drones-v0.5.1` in PyCharm

Open `hw1_simulation.py` in PyCharm
Open `aer1216_fall2020_hw1_sim.py` in PyCharm

To run code you may need to configure PyCharm.
- Go to `File->Settings` and Select `Project:gym-pybullet-drones.py->Python Interpreter`
Expand All @@ -75,16 +75,16 @@ To run code you may need to configure PyCharm.
## Use

As you did not install the `gym_pybullet_drones` module add lines
If (as) you did not install the `gym_pybullet_drones` module, uncomment lines 17-18
```
import sys
sys.path.append('../')
```
to files `hw1_simulation.py` and `hw1_control.py`
in file `aer1216_fall2020_hw1_sim.py`

Go to the "Run" drop down menu and select "Run"

<img src="../files/readme_images/assignment_img3.png" alt="run" width="800">

- Select `hw1_simulation.py` to start the simulation
- Select `aer1216_fall2020_hw1_sim.py` to start the simulation

13 changes: 7 additions & 6 deletions assignments/aer1216_fall2020_hw1_ctrl.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,12 @@
The script is used the simulation in file "aer1216_fall2020_hw1_sim.py".
Example:
To run the simulation, type in a terminal
To run the simulation, type in a terminal:
$ python aer1216_fall2020_hw1_sim.py
Todo:
* Tune the PD coefficients in HW1Control.__init__()
"""
import numpy as np
Expand Down Expand Up @@ -108,11 +109,11 @@ def compute_control(self,

#### Print relevant output #################################
if self.control_counter%(1/self.timestep) == 0:
print(current_position)
print(current_velocity)
print(target_position)
print(target_velocity)
print(target_acceleration)
print("current_position", current_position)
print("current_velocity", current_velocity)
print("target_position", target_position)
print("target_velocity", target_velocity)
print("target_acceleration", target_acceleration)

return np.array([propellers_0_and_3_rpm, propellers_1_and_2_rpm,
propellers_1_and_2_rpm, propellers_0_and_3_rpm])
8 changes: 4 additions & 4 deletions assignments/aer1216_fall2020_hw1_sim.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
The script uses the control defined in file "aer1216_fall2020_hw1_ctrl.py".
Example:
To run the simulation, type in a terminal
To run the simulation, type in a terminal:
$ python aer1216_fall2020_hw1_sim.py
"""
Expand All @@ -20,10 +20,10 @@
from gym_pybullet_drones.envs.CtrlAviary import CtrlAviary
from gym_pybullet_drones.utils.Logger import Logger
from gym_pybullet_drones.utils.utils import sync
from hw1_control import HW1Control
from aer1216_fall2020_hw1_ctrl import HW1Control

DURATION = 10 # int: the duration of the simulation in seconds
GUI = True # bool: whether to use PyBullet graphical interface
DURATION = 10 # int: the duration of the simulation in seconds
GUI = True # bool: whether to use PyBullet graphical interface
RECORD = False # bool: whether to save a video under /files/videos
# requires to have ffmpeg installed

Expand Down
2 changes: 1 addition & 1 deletion gym_pybullet_drones/utils/Logger.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
import numpy as np
import matplotlib.pyplot as plt

os.environ['KMP_DUPLICATE_LIB_OK']='True'
#os.environ['KMP_DUPLICATE_LIB_OK']='True'

######################################################################################################################################################
#### Logger class ####################################################################################################################################
Expand Down

0 comments on commit dc32880

Please sign in to comment.