|
Python Tool for Classical Mechanics |
|
|
|
|
Written by Luke
|
|
Tuesday, 17 March 2009 15:56 |
|
On Friday I headed up to University of Nevada, Reno to meet with Ondrej Certik, the project leader of the SymPy project. The goal for the weekend was to: - Develop some python/sympy tools to generate equations of motion for multibody mechanical systems
- Go on a bike ride
- Drink some beer
We were successful in all three endeavors! The basic functionality that we implemented were some classes for symbolic unit vectors, reference frames, sympy expressions involving unitvectors, rotations, angular velocities, expressing a vector expression in different frames, etc. So far, we have derived the equations of motion for two systems, the simple point mass pendulum, and a torus rolling on the plane without slip. A lot more work is needed to polish the user interface, but the core functionality is there and seems to be working very well. A few really exciting things about this project so far: - Pretty printing of vector expressions -- unitvectors in bold with subscripts
- LaTeX output of symbolic expressions
- Generation of C/C++/Cython code for the equations of motion or whatever quantities you want
- Really easy to animate things using the functionality of Visual Python
The goal is essentially to be a one stop shop place to study the dynamics of mechanical systems, especially multi body systems and those with nonholonomic constraints. The project will be part of the Sympy project, but currently it is available at: git://github.com/hazelnusse/pydy.git If you have git installed, just go to the terminal and type: git clone git://github.com/hazelnusse/pydy.git and you'll have a working copy that you can play with and run. |
|
Last Updated on Tuesday, 17 March 2009 15:57 |
|
|
Steady Turning Velocity and Steer Torque Level Curves |
|
|
|
|
Written by Luke
|
|
Sunday, 01 March 2009 23:48 |
|
At last, some results! This was a tough cookie. I need to automate this, otherwise it will never be done again. It was really time consuming. Green lines on the left and right are the minimum and maximum lean curves. Solid thick black lines are boundary curves to the feasible steady turning motions. Solid thin black lines are the level curves of velocity. Thick dashed lines are the steer torque level curves corresponding to zero torque. Red lines are positive steer torque level curves, blue lines are negative steer torque level curves. There is more to say about this figure than I have time for at the moment.... More to follow soon. |
|
Last Updated on Monday, 02 March 2009 00:15 |
|
|
General Circular Motions of the benchmark bicycle |
|
|
|
|
Written by Luke
|
|
Tuesday, 17 February 2009 16:00 |
|
My current work is focused on investigating the general circular motions of the benchmark bicycle model. The parameters for this model are described by Meijaard et al., and what I am doing is generating steady turning level curves of yaw rate (or one of the wheel rates) and steer torque in the lean - steer plane. In a steady turn, lean and steer are fixed (hence their rates are zero, rear frame pitch is determined from the holonomic constraint, and rear frame pitch rate is zero), but the wheel(s) are spinning and the bicycle is yawing. In certain special cases, one of the wheels may spin about its axle while the other doesn't spin about its axle but instead spins only about the contact point. For this reason, I am convinced that using the yaw rate as a parameter of the circular motions is better than using either of the wheel rates, because in any configuration besides upright zero steer, there will be a yaw rate. The upright zero steer configuration has been well studied by Meijaard et al. for a set of benchmark parameters, my goal is to study motions away from this configuration, but using the same parameters. In the interest of better serving the research community that is interested in bicycle dynamics, I set out to do create the following software tools and make them (and their source code) publicly available: - Holonomic constraint solver. Lean, frame pitch, and steer are not independent coordinates if both wheels are required to touch the ground. This tool will allow you to numerically specify two out of the three, then calculate the third.
- Nonholonomic constraint solver.
- Equations of motion. Be able to numerically specify two independent coordinates (lean and steer, lean and pitch, or pitch and steer) and three independent generalized speeds (really only the time derivatives of generalized coordinates, the simplest case) that you are considering to be independent, and solve for the time derivatives of these three independent generalized speeds. Also will allow for a flag that allows you to specify if you want the time derivatives of the dependent generaliized speeds.
- Eigenvalues of equations of motion when linearized about an arbitrary configuration. Five independent quantities need to be specified: two independent coordinates and three rates.
- Animations of nonlinear simulation results that show the four rigid bodies of the bicycle: Rear wheel, front wheel, rear bicycle frame with rigidly attached rider, and front fork/handlebar assembly. Include ground reaction forces.
- Parameter converter between the parameters used by Meijaard et al., and those I use (I don't use wheelbase, head angle complement, and trail; instead I use those that Franke et al. used).
- Generalized coordinates converter between Basu-Mandal and Meijaard and my coordinates.
Each small subtask will be programmed as a C/C++ function. SWIG interface files to Python will be created in order to allow Python scripts to utilize compiled code to quickly perform numerical studies. These functions will be part of a C/C++ library that I will make available here. My goal is to have many of these tasks complete by the end of February 2009. |
|
Last Updated on Tuesday, 17 February 2009 16:40 |
|
|