1© 2011 Roy Featherstone
Simulating Mobile Robots Using Simulink
Roy Featherstone
School of EngineeringAustralian National University
2
Why Use Simulink?
widely used simulator
good user interface
good documentation
tightly coupled with Matlab
general discrete/continuous event simulator
variablestep integrators
both interactive and programmable
supports model libraries, sharing and hierarchicalmodel decomposition
3
Why Not Use Simulink?
expensive
slow (compared with best specialpurpose simulators)
designed for systems with unidirectional signals
4
Programmability
From inside a Matlab function you can call
sim( modelname, parameters );
to make simulink run a specified simulation with specifiedparameters. Results can be output to the Matlab workspace.
This is useful (e.g.) for automatic optimization of parametervalues.
5
VariableStep Integrators
Rigidbody dynamics tends to produce spiky accelerations.A variablestep integrator can improve both efficiency andaccuracy by adapting the step size.
time
|accn|
small steps here
big steps here
6
Discrete/Continuous Simulation
discrete events are instantaneous – they take place atinstants in time
continuous dynamics is simulated (by numericalintegration) in the time intervals between discrete events
there are two types of discrete event:
data driven scheduled
gain/loss of contactstick/slip transitionshitting a saturation limit
scheduled finish timeregular execution ofcontrolling software(e.g. servo cycles)
7
Discrete/Continuous Simulation
whenever a discrete event occurs, the current integrationstep is truncated (if necessary) so as to end at exactly theinstant when the event occurs
collisionevent here
original integration step truncated integration step
8
TopLevel Model
Controller
Robot
Ground
Command
Doc
feedbackbus
footpos/vel
groundreactionforces
actuatorcommandsignals
9
TopLevel Model
Controller
Robot
Ground
Command
Doc footpos/vel
groundreactionforces
documentation describing what the model is, what it does, how it works, how
to use it, etc.
actuatorcommandsignals
feedbackbus
10
TopLevel Model
Controller
Robot
Ground
Command
Doc footpos/vel
groundreactionforces
content depends on what the controller can do
actuatorcommandsignals
feedbackbus
11
TopLevel Model
Controller
Robot
Ground
Command
Doc footpos/vel
groundreactionforces
every signal a controller might need
and contact state data
allows multiple feet
feedbackbus
actuatorcommandsignals
12
Controller
Controller
Robot
Ground
Command
Doc footpos/vel
groundreactionforces
actuatorcommandsignals
feedbackbus
13
Controller
controlalgorithm
(Matlab code)
1/z
statevector
feedbacksignals
newstatevector
bus expands to individual
signals
command
feedback
actu cmd
output toworkspace
oscilloscope
signals to be viewed/saved
14
Controller
controlalgorithm
(Matlab code)
1/z
statevector
feedbacksignals
newstatevector
memoryless function block – executes at fixed sample rate
command
feedback
actu cmd
signals to be viewed/saved
remembers state vector for
one sample timeoutput to
workspace
oscilloscope
15
Robot
Controller
Robot
Ground
Command
Doc footpos/vel
actuatorcommandsignals
groundreactionforces
supportbus
feedbackbus
16
Robot
forwarddynamics
(Matlab code)1/s
q
support feedback
actu cmdactuator
dynamics
all useful signals
collected here
foot pos/vel
1/s
tau
qd
f_ext
qdd qqd
footkinematics
contact status and
forces
18
Ground
normalcontactmodel
support
frictionmodel
foot pos/vel
f_ext
normal
normal
tangent
combine
position
velocity
tan
f_T
f_N
sticking
in_ctact
19
Ground
normalcontactmodel
support
frictionmodel
foot pos/vel
f_ext
normal
normal
tangent
combine
position
velocity
tan
f_T
f_N
sticking
in_ctact
a foot is the union of one or more points or spheres
the model accepts data on multiple feet
20
Ground
normalcontactmodel
support
frictionmodel
foot pos/vel
f_ext
normal
normal
tangent
combine
position
velocity
tan
f_T
f_N
sticking
in_ctact
detects contact and calculates contact normal
forces
21
Ground
normalcontactmodel
support
frictionmodel
foot pos/vel
f_ext
normal
normal
tangent
combine
position
velocity
tan
f_T
f_N
sticking
in_ctact
detects sticking vs. sliding and
calculates Coulomb friction forces
22
Ground
normalcontactmodel
support
frictionmodel
foot pos/vel
f_ext
normal
normal
tangent
combine
position
velocity
tan
calculates ground reaction forces from normal and tangent
components
f_T
f_N
sticking
in_ctact
23
Results so Far
students have implemented Raibertstyle controllers onhoppers and runners in 2D and 3D
new, improved contact normal model
realistic models of lossy electric motors and drive trains
3D animation software for offline analysis of simulationresults
Sfunctions (C/C++) for faster simulations