lesson 4 –simulation anders lyhne christensen, d6.05...
TRANSCRIPT
INTRODUCTION TO AUTONOMOUS
MOBILE ROBOTS
Lesson 4 – Simulation
Anders Lyhne Christensen, D6.05, [email protected]
Overview
� What is simulation?
� Why simulation?
� Examples of existing simulators
� Issues in simulation
� Tutorial: Simbad and the LegoRobotInterface
What is simulation?
� “Simulation is the imitation of some real thing, state of affairs, or process. The act of simulating something generally entails representing certain key characteristics or behaviours of a selected physical or abstract system.” – Wikipedia, January 2010.
� In robotics, (sensor-based) simulation is usually an application run on one or more computers that simulate the effect of a robots actions on the environment and compute the resulting sensor readings.
What is simulation?
Typical control loop in a simulator:
repeat
1 compute sensor readings for all robots
2 run robots’ control programs for one cycle
3 robots’ control signals to world physics
4 simulate the world for ∆t
until simulation should end
Why simulation?
� Speeds up development and debugging
� No robotic hardware necessary
� No damage real (expensive) robots
� Allows for experiments in non-existing environments and with non-existing robots� Also allows for experiments with 100s or 1000s of robots.
� Allows for a high degree of automation
- Because of the above points, simulation is almost always necessary when learning is used – such as evolutionary robotics.
Examples of existing
simulators� Webots
� http://www.cyberbotics.com/products/webots/index.html
� Gazebo/Player/Stage� http://playerstage.sourceforge.net/
� Microsoft Robotics Developer Studio� http://msdn.microsoft.com/en-us/robotics/default.aspx
� Blender� http://wiki.blender.org/index.php/Robotics:Index
� Simbad 3D Robot Simulator� http://simbad.sourceforge.net/
Issues in simulation
� Often two different control programs are needed: � one for real hardware
� one for simulation
� Complexity vs. speed� A simple and fast simulation, or
� A complex and more accurate simulation,
� or both?
� Learning: How do we bridge the “reality gap” � How do we ensure that controllers that have been developed or
have been synthesized through learning in simulation work in the real world?
Main requirements for a
simulator?
Main requirements for a
simulator?
� Provide a good overview of the action, usually a 2D or 3D rendering
� Faster than real time
� Easily changeable environments
� Extendable: allow for implementation of new sensor and actuators
� Often is also has to allow for the simulation of multiple, possibly different robots at the same time.
LegoSimBad
� A customization of the Simbad 3D simulator for Lego Mindstorms NXT
� Features:� Written in Java which makes it easy to integrate with
Lejos
� Open Source (GPL)
� Batch simulations
� 3D rendering of simulations
� Works with PicoEvo and PicoNode which are libraries for evolutionary computation and neural networks, respectively.
Main issues to be aware of
� One Control Program, multiple platforms
� Defining the physical characteristics of the
robot and of the environment
� Implemented and missing features
One Control Program, multiple platforms
(real hardware, LegoSimbad, …)
LegoRobotInterface
LegoSimbadImplementationRealRobotImplementation
Control Programs
One control program for both
simulation and real hardware
- incorrect way:
This will not work (why?):
One control program for both
simulation and real hardware
- incorrect way:
This will not work (why?):
The controller should not define the main
The UltrasonicSensor class is
for the real robot only
Sleep will stop the entire simulator (or if each controller
runs in separate threads, prevent the simulator from
running faster than real-time
One control program for both
simulation and real hardware
- the correct way:
One control program for both
simulation and real hardware
- the correct way:
The controller only knows about the LegoRobotInterface
Extends a predefined
Controller class
The robot object gives access
to the particular
implementation of the
LegoRobotInterface
Defining the physical
characteristics of the robot
and of the environment
See source code
Implemented and missing
features
Implemented:- Lego robots interface
- UltrasonicSensor
- Compass
- Motors
- Differential drive kinematics
Missing:- Gyroscopic sensor
- Touch sensor
- Microphone
- Gripper
- …
However, they can all be implemented – Look in the source code and in the non-Lego examples in simbad.demos for ideas on how to implement what you need
Running the simulator
� Download simulator package on the course webpage
� Download and install Java3D 1.5.2� https://java3d.dev.java.net/binary-builds.html, or
� http://www.softpedia.com/get/Programming/Other-Programming-Files/Java-3D.shtml(See the installation instructions online)
� If you have made changes to classes.jar, then make sure that you have Lejos (classes.jar) in the workspace and that the Lejos“classes” project is listed as a dependency in the simulator package.
� Use the commandline to compile a controller for the real robot (see “tips and tricks.txt” in the Eclipse project on how to do that)