MatODE is a Matlab interface to the Open Dynamics Engine (ODE) by Russell Smith. From the ODE website:
"ODE is an open source, high performance library for simulating rigid body dynamics. It is fully featured, stable, mature and platform independent with an easy to use C/C++ API. It has advanced joint types and integrated collision detection with friction. ODE is useful for simulating vehicles, objects in virtual reality environments and virtual creatures. It is currently used in many computer games, 3D authoring tools and simulation tools."
MatODE uses Matlab's oriented programming capabilities to make the interface as easy as possible. The main class is odesim, which provides global interaction with the simulator such as initialization, running a simulation step, and resetting to an initial condition. It also allows you to retrieve sensor and actuator indices, with which you can sense joint positions and drive motors. The bodies that constitute the robot and the joints that connect them are defined in an XML file loaded during initialization.
Below is a simple example of the 'mountain car' problem implemented with MatODE.
%% Initialization sim = odesim('mountaincar.xml'); % Load configuration sim.realtime(); % Slow down to realtime %% Define sensors and actuators vel = sim.sensor('robot.base.velocity.y'); % Define sensor motor = sim.actuator('robot.motorjoint1.torque'); % Define actuator actuators = sim.actuate(); % Get actuation vector %% Control loop for t = 0:sim.step():6 % Simulation loop (6s) sensors = sim.sense(); % Measure sensor values if sensors(vel) > 0 % Read sensor actuators(motor) = 0.5; % Set actuator else actuators(motor) = -0.5; end sim.actuate(actuators); % Run simulation step end %% Clean up sim.close() % Destroy simulation
More complex models are of course also possible, such as a simulation of robot 'LEO'.
Copyright (c) 2010-2012 Delft University of Technology. MatODE was written by Wouter Caarls. The XML-ODE and visualization backend is by Erik Schuitema. It uses muParser, ODE, Pthreads-w32, Qt and TinyXML.
For any additional information and bug reports, please contact Wouter Caarls.
Copyright (c) 2010-2012 Delft Biorobotics Laboratory (DBL). This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program. If not, see <http://www.gnu.org/licenses/>.