Simulation and Modeling (CSCI 3010U)
Faculty of Science, Ontario Tech University
http://vclab.science.ontariotechu.ca
Discuss in class
This code simulates a 2D box. To keep things simple, the mass is set to \(1.0\), and the inertia tensor (in the body coordinate frame) is set to identity. This is a 2D rigid body simulation and we assume that the z-axis is coming out of the screen. A force acts on the center of mass of the box in the xy-plane, and a torque acts on the box in the counter-clockwise direction about the z-axis. As discussed in the lecture, the state of this box is represented by its position, rotation, linear and angular momentum. We store the state in state vector.
Complete the f(self, t, state, force, torque, IbodyInv)
function in the code provided on the course website. This function is
called f
by the ode solver, and it sets up the
right-hand-side of the differential equations describing the state
variables.
The starter code is available here. Check out rigid body notes here.
Nothing to submit. Please show your work to the instructor. Due in class.