Since 2004 the number of space launches has been gradually increasing. Currently, there are more than 100 satellites launched into space every year. This number could grow rapidly due to such projects as the constellation providing worldwide internet access internet by OneWeb. The increasing amount of objects in space leads to a higher probability of their collision.
Most conjunction events are currently processed manually. In this project, we employ state-of-the-art reinforcement learning methods to create a system for automatic maneuver optimization in order to avoid collisions.
Space debris reconstrucion from Stuffin Space project |
1 and 2: Space objects are monitored by ROSCOSMOS
3: ROSCOSMOS computes conjunction events
4: Space Navigator gets data from ROSCOSMOS
5: Environment is solved with RL
6: Space Navigator returns optimal collision avoidance maneuver
To set up the project first copy the repo to your local machine:
git clone https://github.com/yandexdataschool/satellite-collision-avoidance.git
After cloning the repo, install requirements:
pip install -r requirements.txt
We use Python 3.6.5 and following libraries:
- Pykep
- Pandas
- Matplotlib
- Numpy
- Scipy
- Torch
- tqdm
If you have problems with Pykep installation, you could use this link.
Install the package:
python setup.py install
or use for development:
python setup.py develop
Now you can run examples of space simulator.
Run following code:
python examples/test_flight.py -p true
If evereything is correct, you should get such plot:
And output:
Start time: 6000.0 End time: 6000.01 Simulation step:1e-06
...
Space objects description
...
Simulation ended in 0.0050948 sec.
Maneuvers table:
no maneuvers.
Collisions (distance <= 2000 meters):
no collisions without maneuvers.
Parameters table:
...
Run following code to generate collision situation environment with 5 dangerous debris objects in the time interval from 6601 to 6601.1 (mjd2000) and save it to data/environments/generated_collision_5_debr.env:
python generation/generate_collision.py \
-save_path data/environments/generated_collision_5_debr.env \
-n_d 5 -start 6601 -end 6601.1 -before 0.1
Then, to calculate the maneuvers using the Cross Entropy method and save them to training/agents_tables/CE/action_table_CE_for_generated_collision_5_debr.csv, run:
python training/CE/CE_train_for_collision.py \
-env data/environments/generated_collision_5_debr.env -print true \
-save_path training/agents_tables/CE/action_table_CE_for_generated_collision_5_debr.csv \
-r false -n_m 1
Finally, to run the simulator for generated environment and obtained maneuvers:
python examples/collision.py -env data/environments/generated_collision_5_debr.env \
-model training/agents_tables/CE/action_table_CE_for_generated_collision_5_debr.csv
Currently there are only tests for api module. Run it with command:
python tests/test_api.py
Tutorial on environment setup and simulator:
Tutorial on learning an agent:
- For space simulation and calculations we use pykep library. [Pykep]
- http://stuffin.space/