Skip to content
Switch branches/tags
Go to file

Latest commit


Git stats


Failed to load latest commit information.
Latest commit message
Commit time

Dumbbell about and asteroid

Simulation to test the motion of a dumbbell spacecraft around an asteroid

Testing Coverage
Build Status Coverage Status

Development Environment setup

This code is written in Python and uses:

To set it all up properly you must first install Anaconda and clone the asteroid environment:

conda env create --file asteroid.yml

The follow the instructions in each section below.

Repository setup

Clone and run chmod +x then ./ to automatically create the correct remote repositories. This will ensure that pushes are sent to both:

Blender Setup links

To build and install Blender as a Python module:

  • Ensure you're using the asteroid conda enviornment and Python 3.5
  • Run utilities/ and hope for the best
  • Run py.test and make sure all the tests pass

Building OpenCV

There is a bash script, utilities/ which will build OpenCV for Python

  • Make sure you install the asteroid env - conda env create -n asteroid -f asteroid.yml or update conda env update -n asteroid -f asteroid.yml
  • Run
  • Check and make sure is located in $HOME/anaconda3/envs/asteroid/lib/python3.5/site-packages

Some other helpful links:

Building PCL

There's another bash script, utilities/ which will build Point Cloud Library.

  • Make sure you install the asteroid env - conda env create -n asteroid -f asteroid.yml
  • bash utilities/
  • Run the tests

Usage guide

You can run the simulation for both the inertial and relative equations of motion. There are driver modules for each, which are called: * - Driver functions to simulate the inertial equations of motion * - Driver functions to simulate the relative equations of motion * - More driver functions which were used during testing/debuggin * - Functions to allow the comparision between the different EOMS


To profile the Python code you can use cProfile or line-profiler

pip install line-profiler snakeviz
  • Use cProfile to find which function call is taking the most time out of a bigger script
import cProfile'script to execute as a string')
* You can also do this from within iPython as
%prun -D function()
  • Next use snakeviz to visualize it
%load_ext snakeviz
%snakeviz function()
  • Once you have an idea of the slow function you can find specific lines within the function using line-profiler
%load_ext line_profiler
%lprun -T output.txt -f ast.function() script()

SPICE in Python

There seems to be several attemps to get SPICE working in Python. Use one of the following

Creating a movie from a bunch of images

Use this command to create a movie with ffmpeg

ffmpeg -framerate 60 -i test%06d.png -c:v libx264 -profile:v high -crf 20 -pix_fmt yuv420p -vf "scale=trunc(iw/2)*2:trunc(ih/2)*2" output.mp4 

Some additional information:


  1. Create a setup script that setups up the development environment

    • Can setup Anaconda
    • Downloads shape models from github release (ensure the tar.gz file includes everythign)
    • Runs the build scripts
    • Runs pytest
  2. Figure out how to get TOX/Create a seperate build script for travis



sudo apt-get install -y doxygen graphviz