GSoC 2017 Application Aaron Miller : Featherstone Method for Equations of Motion

Aaron Miller edited this page Apr 3, 2017 · 4 revisions

Featherstone Method for Equations of Motion

Personal Information

  • Name: Aaron Miller
  • University: University of Pittsburgh
  • About me: I'm a third-year undergrad (expecting to graduate in Spring 2018) majoring in Physics and Computer Science. I'm also pretty interested in math and numerical algorithms, partly because they have a lot of interesting applications in Physics. I do a lot of robotics in my spare time, and that leads me to a lot of open source projects which I have submitted patches to as I discover bugs or new features that would be useful. I'm really passionate about free software because of the freedom it provides to users, especially for areas like robotics and math where the users are typically more experienced and greater freedom is useful.
  • Email: acmiller273@gmail.com or acm131@pitt.edu
  • GitHub username (and username in most other places): amiller27

Programming Experience

I have been using Ubuntu Linux since high school, and I'm currently running Ubuntu Gnome 16.10. I also use Windows occasionally, in rare instances when I have to run something that I can't on Linux. I've tried out other assorted distributions for robotics projects such as Arch and Raspbian on the Raspberry Pi. I use Vim almost exclusively as an editor for a couple reasons. First, it's available on all the platforms I use and works just as well in an ssh session as it does on my own computer. Second, a lot of operations are faster in Vim than in other text editors because it's multimodal and has a large collection of keyboard shortcuts and integrated commands. And finally, it's very customizable, although Vimscript isn't really ideal.

I've been programming since my freshman year of high school, so I've worked on a variety of projects. One of my larger finished projects was a MicroMouse robot that I worked on last year. The MicroMouse competition has been around for a couple decades. Essentially, the robot is placed in a square maze about 3m x 3m in size, with 256 square cells. The robot has no knowledge of the maze initially, but knows the relative location of the target square. Robots must search to find this destination, and then must go back to the start, and finally do a speed run along the fastest path from start to finish. Solving this problem involved a lot of math and control code to integrate our various sensors and some fairly simple graph algorithms for finding the fastest path. All of this was done using C++ and the Arduino framework on a Teensy 3.1 (a board with an ARM processor that works with Arduino).

Python was actually my first programming language, so I have quite a lot of experience with it and have worked on multiple projects with it. One of the most interesting features of Python that I've found is the ability to generate variables dynamically. I've seen this used for creating classes at runtime and adding instance variables based on information available only at runtime; an example would be parsing JSON into actual Python objects with fields as instance variables. A more interesting use of this that I've seen is for utility functions that automatically generate several named instance variables and methods that are related; for example, there might be a utility function that takes a variable name as a string, some indicator of the intended type, and a docstring as an argument, and adds a field for that variable, appropriately named getters and setters with auto-generated code, and other functionality automatically.

I'm not sure what I would consider the most advanced feature of Python. I do really like how dynamic everything is, allowing for creation of objects or variables based on information at runtime, as well as several constructs that aren't much more than syntactic sugar but are nonetheless incredibly convenient, such as list comprehensions, generator expressions, and list slicing.

My favorite feature of SymPy isn't really single feature, it's the fact that SymPy is completely integrated into Python, allowing it to be used effortlessly in conjunction with Python's extensive collection of other libraries. My favorite example of this is here. I just love the fact that all these modules (especially the ones in the SciPy stack) can be used together to give functionality some people would only expect from non-free software.

I've been using git with projects since high school for collaboration with other developers and for version controlling my own software. I also have some experience with other version control systems (svn and ClearCase).

PRs:

The Project

By the end of the project, I would like to have a fast, working implementation of Featherstone's method as part of SymPy. I'm really interested in learning more about algorithms for this, and I'm also glad for the opportunity to contribute to making SymPy a useful open source alternative for doing computations like this. I want to work on SymPy because I really love using Python for mathematical applications, but so many people end up using non-free software like MATLAB or Mathematica because they think those applications are better, and I'd like to be a small part of changing that. I have also tried using Sage in the past, but it wasn't really a good experience because of its reliance on so many external libraries that makes it somewhat cumbersome. I love the fact that SymPy is written entirely in Python for that reason.

I have experience working with this kind of thing from a few different places. First, I have taken Classical Mechanics as part of my Physics education. In that class, we also spent a little bit of time solving systems on a computer using Mathematica. I then took a class on Computational Methods in Physics, which explored a variety of algorithms (mostly relating to numerical methods) for solving Physics problems. My professor actually wrote his own software package for solving systems analytically using Hamiltonian Mechanics in C++, and I spent some time digging through his code out of curiosity. All in all, I'm very comfortable with Classical Physics and methods of approaching these problems computationally.

I can put in 40 hours every week for 12 weeks, but there will be one week when I'm on a family vacation and another couple of days when I'm away at a robotics competition. My spring semester finishes earlier than most other universities, so I'll be able to start on the project in May to make up for that lost time.

Timeline

Weeks 1-2:

  • Go through existing code for FeatherstonesMethod (in #11415), KanesMethod, and LagrangesMethod to become familiar with how they work internally
  • Read Featherstone's book on his method of generating equations of motion

Weeks 3:

  • Work on benchmarking existing equations of motion methods (KanesMethod and LagrangesMethod) for comparison with Featherstone Method
  • Create useful test cases amenable to speedup with FeatherstonesMethod

Weeks 4-5:

  • Design and finalize FeatherstonesMethod public interface
  • Design internal class/method structure
  • Create preliminary examples of functionality (expected inputs/outputs) for user-facing methods
  • Preliminary documentation (some of this is already present in #11415, but might need to change based on the interface to the class. It was mentioned there that it might be more useful to simply create a function that generates and returns a SymbolicSystem representing the equations of motion instead of a class with similar structure to KanesMethod and LagrangesMethod, would need to look into this more.

Week 6:

  • Work on dependencies of the Featherstone method code, especially Joints in physics/mechanics/joint.py and the code in physics/vector/spatial.py (in #11415). These seem to be mostly implemented, but there are a few things that need to be added. First, the code in spatial.py could be cleaned up and better organized. Second, unit tests should be written for the functions in spatial.py. Some of the methods in joint.py also need better documentation, some cleaning up, and better functionality.
  • A PR could be submitted at the end of this period with the necessary documentation, tests, and changes.

Weeks 7-8:

  • Take existing preliminary implementation of Featherstone's method from [#11415(https://github.com/sympy/sympy/pull/11415) and clean it up, implementing other methods from KanesMethod and LagrangesMethod in FeatherstonesMethod, and breaking __init__ into separate methods
  • These changes will go into a PR that the end of these two weeks

Weeks 9-10:

  • Implement more parameters for existing FeatherstonesMethod (for external forces other than gravity)
  • These can be put together into a PR at the end of this period

Weeks 11-12:

  • Benchmark resulting Featherstone method code, compare to KanesMethod and LagrangesMethod
  • Clean up documentation
  • Submit any remaining PRs
Clone this wiki locally
You can’t perform that action at this time.
You signed in with another tab or window. Reload to refresh your session. You signed out in another tab or window. Reload to refresh your session.
Press h to open a hovercard with more details.