usarsim 3d simulator gabriele randelli - daniele calisi @dis.uniroma1.it sapienza università di...

31
USARSim 3D Simulator Gabriele Randelli - Daniele Calisi <lastname>@dis.uniroma1.it Sapienza Università di Roma Dipartimento di Informatica e Sistemistica OpenRDK Workshop, Sapienza Università di Roma 16th March 2009

Post on 18-Dec-2015

215 views

Category:

Documents


0 download

TRANSCRIPT

Page 1: USARSim 3D Simulator Gabriele Randelli - Daniele Calisi @dis.uniroma1.it Sapienza Università di Roma Dipartimento di Informatica e Sistemistica OpenRDK

USARSim 3D Simulator

Gabriele Randelli - Daniele Calisi<lastname>@dis.uniroma1.it

Sapienza Università di RomaDipartimento di Informatica e Sistemistica

OpenRDK Workshop, Sapienza Università di Roma16th March 2009

Page 2: USARSim 3D Simulator Gabriele Randelli - Daniele Calisi @dis.uniroma1.it Sapienza Università di Roma Dipartimento di Informatica e Sistemistica OpenRDK

PART 1: USARSimUnified System for Automation and Robot Simulation

• Developed by the Carnegie Mellon University and the University of Pittsburgh

• Maintained by the National Institute of Standards and Technology (NIST)

• Available at http://sourceforge.net/projects/usarsim

• Based on Unreal Tournament 2004 game engine

• Adopted in robotic competitions (e.g. RoboCup, DARPA Challenge, IEEE Virtual Manufacturing)

Page 3: USARSim 3D Simulator Gabriele Randelli - Daniele Calisi @dis.uniroma1.it Sapienza Università di Roma Dipartimento di Informatica e Sistemistica OpenRDK

Supported sensors and robots

Robots: P2AT, Telemax, AirRobot, AIBO, Forklift, Hummer, Talon, Tarantula, Zerg,...

Sensors: Range Sensor, Range Scanner, Odometry, INS, GPS, RFID, Bumpers, Acoustic, Gripper, Victim Sensor, Camera,...

Page 4: USARSim 3D Simulator Gabriele Randelli - Daniele Calisi @dis.uniroma1.it Sapienza Università di Roma Dipartimento di Informatica e Sistemistica OpenRDK

USARSim Architecture (1/2)

Page 5: USARSim 3D Simulator Gabriele Randelli - Daniele Calisi @dis.uniroma1.it Sapienza Università di Roma Dipartimento di Informatica e Sistemistica OpenRDK

USARSim Architecture (2/2)

1) Unreal Engine (UE) Embeds the Karma Physics Engine Simulation of the environment, but no rendering

1) Unreal Client (UC) Rendering of the scene

1) Gamebots Communication interface to bridge our controller

application directly with the UE, thus bypassing the UC

1) Controller Application1)Our robotic system

Page 6: USARSim 3D Simulator Gabriele Randelli - Daniele Calisi @dis.uniroma1.it Sapienza Università di Roma Dipartimento di Informatica e Sistemistica OpenRDK

Running a USARSim Map

We will always start the simulator via UC (Client Mode).– USAR_Maps_Files/RunClientOnly folder contains the .bat files

to load the maps

• Mouse-left-click switches the point of view to the robot’s camera

• Further left clicks iterate through all cameras

• Right click brings you back to the general viewpoint

TIPS to control the view within the environment:

Page 7: USARSim 3D Simulator Gabriele Randelli - Daniele Calisi @dis.uniroma1.it Sapienza Università di Roma Dipartimento di Informatica e Sistemistica OpenRDK

Example 1: Running USARSim

Page 8: USARSim 3D Simulator Gabriele Randelli - Daniele Calisi @dis.uniroma1.it Sapienza Università di Roma Dipartimento di Informatica e Sistemistica OpenRDK

Configuring a Robot in USARSim

Robot models are selected and configured in USARBot.ini file (located in <UT2004_HOME>/System dir)

For each robot model, we can configure:

Mobility

Mission Packages (defined in UsarMisPkg.ini)

Sensors

Effectors

Page 9: USARSim 3D Simulator Gabriele Randelli - Daniele Calisi @dis.uniroma1.it Sapienza Università di Roma Dipartimento di Informatica e Sistemistica OpenRDK

Example 2: Configuring a RobotBase Step: Robot Model Selection (Chassis)

[USARBot.ATRVJr]bDebug=FalseWeight=50Payload=25ChassisMass=2.000000MotorTorque=100.0MaxTorque=150.0bMountByUU=False

Page 10: USARSim 3D Simulator Gabriele Randelli - Daniele Calisi @dis.uniroma1.it Sapienza Università di Roma Dipartimento di Informatica e Sistemistica OpenRDK

Example 2: Configuring a RobotStep 1: Mobility

JointParts=(PartName="RightFWheel",PartClass=class'USARModels.AtrvRTire',DrawScale3D=(X=1.0,Y=1.0,Z=1.0),bSteeringLocked=True,bSuspensionLocked=true,Parent="",JointClass=class'KCarWheelJoint',ParentPos=(Y=0.2559997,X=0.1939998,Z=0.1919998),ParentAxis=(Z=1.0),ParentAxis2=(Y=1.0),SelfPos=(Z=-0.0),SelfAxis=(Z=1.0),SelfAxis2=(Y=1.0))JointParts=(PartName="LeftFWheel",PartClass=class'USARModels.AtrvLTire',DrawScale3D=(X=1.0,Y=1.0,Z=1.0),bSteeringLocked=True,bSuspensionLocked=true,Parent="",JointClass=class'KCarWheelJoint',ParentPos=(Y=-0.2559997,X=0.1939998,Z=0.1919998),ParentAxis=(Z=1.0),ParentAxis2=(Y=1.0),SelfPos=(Z=-0.0),SelfAxis=(Z=1.0),SelfAxis2=(Y=1.0))JointParts=(PartName="RightRWheel",...)JointParts=(PartName="LeftRWheel",...)

Page 11: USARSim 3D Simulator Gabriele Randelli - Daniele Calisi @dis.uniroma1.it Sapienza Università di Roma Dipartimento di Informatica e Sistemistica OpenRDK

Example 2: Configuring a RobotStep 2: Mission Packages

MisPkgs=(PkgName="CameraPanTilt",Location=(Y=0.0,X=0.12799986,Z=-0.21599978),PkgClass=Class'USARMisPkg.CameraPanTilt')

Page 12: USARSim 3D Simulator Gabriele Randelli - Daniele Calisi @dis.uniroma1.it Sapienza Università di Roma Dipartimento di Informatica e Sistemistica OpenRDK

Example 2: Configuring a RobotStep 3: Sensors

Sensors=(ItemClass=class'USARModels.SICKLMS',ItemName="Scanner1",Position=(X=0.14399984,Y=0.0,Z=-0.0919999),Direction=(Y=0.0,Z=0.0,X=0.0))

Page 13: USARSim 3D Simulator Gabriele Randelli - Daniele Calisi @dis.uniroma1.it Sapienza Università di Roma Dipartimento di Informatica e Sistemistica OpenRDK

Example 2: Configuring a RobotStep 4: Effectors

Effecters=(ItemClass=class'USARModels.UnitLoaderTableEffecter',ItemName="Roller",Parent="UnitLoaderTop_Link1",Position=(Y=0.0,X=0.0,Z=-0.0),Direction=(Y=0,Z=0.0,X=0.0))

Page 14: USARSim 3D Simulator Gabriele Randelli - Daniele Calisi @dis.uniroma1.it Sapienza Università di Roma Dipartimento di Informatica e Sistemistica OpenRDK

Additional Components: UPIShttp://athiri.cimds.ri.cmu.edu/twiki/bin/view/UsarSim/WebHome

• UPIS is an image server which captures from any of the cameras that are being used inside the environment

• Useful when the controller application requires video feedback

Edit and execute the run.bat file within the UPIS folder

Page 15: USARSim 3D Simulator Gabriele Randelli - Daniele Calisi @dis.uniroma1.it Sapienza Università di Roma Dipartimento di Informatica e Sistemistica OpenRDK

Extending USARSim

Sometimes configuring is not enough... let's extend USARSim!!!

– New environments

– New robot models

– New sensors

– New effectors

NOTE In order to develop new components for USARSim, the file ut2004.ini must be modified (cfr. USARSim Documentation)

Page 16: USARSim 3D Simulator Gabriele Randelli - Daniele Calisi @dis.uniroma1.it Sapienza Università di Roma Dipartimento di Informatica e Sistemistica OpenRDK

UnrealScript

UnrealScript is an object oriented scripting language to allow the developers to build new objects.

Unreal Engine Core (C++)UnrealScript Virtual Machine

Object 1

(US)

Object 2

(US)

Object N

(US)

. . . . .

Most of the times, the developed objects are mutators, that is, actors designed to modify smaller aspects of the game, without changing the game rules.

US Reference: http://udn.epicgames.com/Two/UnrealScriptReference.htmlUS WiKi: http://wiki.beyondunreal.com/wiki/UnrealScriptUS Tutorials: http://wiki.beyondunreal.com/Legacy:UnrealScript_Lessons

Page 17: USARSim 3D Simulator Gabriele Randelli - Daniele Calisi @dis.uniroma1.it Sapienza Università di Roma Dipartimento di Informatica e Sistemistica OpenRDK

Unreal Editor (UEd3)Sometimes UnrealScript programming can be frustrating...

Page 18: USARSim 3D Simulator Gabriele Randelli - Daniele Calisi @dis.uniroma1.it Sapienza Università di Roma Dipartimento di Informatica e Sistemistica OpenRDK

Map Building with UEd3

UEd3 deals with USARSim maps allowing to:

– Build or modify the map geometric model

– Add special effects (exploding stuff, windows, fans, cyclones, sounds, liquids,...)

– Add objects (e.g. obstacles, moving parts, victims,...)

UEd3 References:http://www.unrealwiki.com/Legacy:Mapping_Lessonshttp://www.icecreamyou.com/ut2004.html

http://architectonic.planetunreal.gamespy.com/first_level.html

UEd3 supports both CSG operations and static meshes

Page 19: USARSim 3D Simulator Gabriele Randelli - Daniele Calisi @dis.uniroma1.it Sapienza Università di Roma Dipartimento di Informatica e Sistemistica OpenRDK

CSG Operations and Static Meshes

Constructive Solid Geometry is a procedural modeling technique used in 3D graphics:

• Objects are composed using boolean operators (union, intersection, difference)

Static Meshes are polygon meshes with information about the texture, the shape and a collision model

• Create meshes with a modeling tool (e.g. 3D Studio Max) and then import them within UEd3

Page 20: USARSim 3D Simulator Gabriele Randelli - Daniele Calisi @dis.uniroma1.it Sapienza Università di Roma Dipartimento di Informatica e Sistemistica OpenRDK

A PlayerStart marks a spot where a robot can be spawned.

1. Select Actor/NavigationPoint/Small NavigationPoint/PlayerStart from the Actor Browser

2. Right-click on the location you want to place the PlayerStart in the 3D view

3. Select "add PlayerStart Here"

4.Double-click on it to open the properties windows and write “Workshop” into the Events/Tag field

5. Rebuild the map clicking on Build All (Cube)

We will use our PlayerStart later!!!

Example 3: Adding a PlayerStart Pose

Page 21: USARSim 3D Simulator Gabriele Randelli - Daniele Calisi @dis.uniroma1.it Sapienza Università di Roma Dipartimento di Informatica e Sistemistica OpenRDK

PART 2: OpenRDK and USARSim

Example 4: Spawning a robot within the USARSim environment

1. Start a USARSim map

2. Retrieve the available map starting points for the robot

3. Add the OpenRDK module USARSimClientModule to your robot configuration file

4. Edit the file to configure this module

5. Execute the configuration file to spawn your robot!

Page 22: USARSim 3D Simulator Gabriele Randelli - Daniele Calisi @dis.uniroma1.it Sapienza Università di Roma Dipartimento di Informatica e Sistemistica OpenRDK

Starting PosesA robot must be spawned in an empty place within the environment. Map creators can provide starting poses, that is safe places where to spawn the robot.

• Select manually the coordinates

• Use the OpenRDK tool rdk-usgetstartposes to retrieve all the available starting poses for the executing USARSim map

rdk-usgetstartposes <usarsim_host> <usarsim_port>

Connected to server at 192.168.0.240:3000Poses in the map (RDK reference system: meters and degrees)

PlayerStart: (x, y, z) = 0.75,7.28,0.44; (roll, pitch, yaw) = 0.00,-0.00,-0.00robot1: (x, y, z) = 3.63,-10.80,0.18; (roll, pitch, yaw) = 0.00,-0.00,91.10robot2: (x, y, z) = 1.91,-10.00,0.18; (roll, pitch, yaw) = 0.00,-0.00,-0.00Robot3: (x, y, z) = 3.85,-9.17,0.18; (roll, pitch, yaw) = 0.00,-0.00,-95.11Workshop: (x, y, z) = 5.31,-6.18,0.11; (roll, pitch, yaw) = 0.00,-0.00,-0.00

Page 23: USARSim 3D Simulator Gabriele Randelli - Daniele Calisi @dis.uniroma1.it Sapienza Università di Roma Dipartimento di Informatica e Sistemistica OpenRDK

USARSimClientModule

USARSimClientModule is the OpenRDK module which interacts with USARSim to manage a robot:

• Spawns a robot in the given position

• Receives robot sensors perceptions

• Forwards commands to the robot effectors

Page 24: USARSim 3D Simulator Gabriele Randelli - Daniele Calisi @dis.uniroma1.it Sapienza Università di Roma Dipartimento di Informatica e Sistemistica OpenRDK

Add USARSimClientModule to a Config FileGiven an existing configuration file named rqra-randomExploration.config, we will modify it for USARSim. Type:

rconsoleqt –e ra-randomExploration.config

RConsole runs in editing mode and you can see the list of included modules:

The configuration file now contains the following modules:1 mapper (library rdkram_simplemappermodule)2 dptm (library rdkram_dptmmodule)3 ectMotionPlanner (library rdkram_ectmotionplannermodule)

To add the USARSimClientModule, enter a, then type the name of the module (rdkram_usarsimclientmodule), and choose a name (e.g robot).

The configuration file now contains the following modules:1 mapper (library rdkram_simplemappermodule)2 dptm (library rdkram_dptmmodule)3 ectMotionPlanner (library rdkram_ectmotionplannermodule)4 robot (library rdkram_usarsimclientmodule)

Finally, enter “s rqra-usar-randomExploration.config” to save the configuration in a new file, followed by q to exit.

Page 25: USARSim 3D Simulator Gabriele Randelli - Daniele Calisi @dis.uniroma1.it Sapienza Università di Roma Dipartimento di Informatica e Sistemistica OpenRDK

Configuring USARSimClientModuleIt’s time to edit our new config file, using whatever editor we like. We divide this process into two steps:

• Configuring the USARSimClientModule section

• Linking the other modules to USARSimClientModule properties

<rdk:object class="ModuleConfig" version="2"> <rdk:string name="moduleName">robot</rdk:string> <rdk:string name="library">rdkram_usarsimclientmodule</rdk:string>

…params/robotClass=USARBot.P2AT

params/startPose/name=Workshop # Insert here the selected starting pose params/startPose/pitch=0.00 params/startPose/roll=0.00 params/startPose/x=4.90 params/startPose/y=1.90. params/startPose/yaw=0.00 params/startPose/z=1.80

params/usarsimAddress=192.168.0.240 params/usarsimPort=3000

… </rdk:object>

Page 26: USARSim 3D Simulator Gabriele Randelli - Daniele Calisi @dis.uniroma1.it Sapienza Università di Roma Dipartimento di Informatica e Sistemistica OpenRDK

Modules Linking <rdk:string name="library">rdkram_poseinterpolatormodule</rdk:string>

in/poseQueue=@/robot/dataQueue

<rdk:string name="library">rdkram_twolevelnavigatormodule</rdk:string>targetPose=@/robot/targetPose

<rdk:string name="library">rdkram_dptmmodule</rdk:string>laserData=@/robot/laserData

<rdk:string name="library">rdkram_ectmotionplannermodule</rdk:string>in/laserData=@/robot/laserData

out/desiredJog=@/robot/desiredJog out/desiredSpeed=@/robot/desiredSpeed

<rdk:string name="library">rdkram_simplemappermodule</rdk:string>in/robotPose=@/robot/estimatedPose

<rdk:string name="library">rdkram_randomexplorationmodule</rdk:string>in/estimatedPose=@/robot/estimatedPose

Page 27: USARSim 3D Simulator Gabriele Randelli - Daniele Calisi @dis.uniroma1.it Sapienza Università di Roma Dipartimento di Informatica e Sistemistica OpenRDK

Spawn it!rconsoleqt –c rqra-usar-randomExploration.config

Page 28: USARSim 3D Simulator Gabriele Randelli - Daniele Calisi @dis.uniroma1.it Sapienza Università di Roma Dipartimento di Informatica e Sistemistica OpenRDK

OpenRDK and UPIS

Example 5: Spawning a robot within the USARSim environment and acquiring video feedback via the UPIS Image Server

1. Start a USARSim map using through UPIS

2. Add the module USARImageClientModule to your robot configuration file

3. Edit the file to configure this module

4. Execute the configuration file to spawn your robot and acquire video feedback!

Page 29: USARSim 3D Simulator Gabriele Randelli - Daniele Calisi @dis.uniroma1.it Sapienza Università di Roma Dipartimento di Informatica e Sistemistica OpenRDK

We assume the first two steps are already done and the config file is called rqra-usar-image-randomExploration.config

Configuring USARImageClientModule

<rdk:object class="ModuleConfig" version="2"> <rdk:string name="moduleName">imageClient</rdk:string> <rdk:string name="library">rdkram_usarimageclientmodule</rdk:string>

… desiredFPS=2

fileExtension=jpg filePath=./ imageServerAddr=192.168.0.240 imageServerPort=5003 params/multiview/enabled=No

takeScreenshot=No …

</rdk:object>

Page 30: USARSim 3D Simulator Gabriele Randelli - Daniele Calisi @dis.uniroma1.it Sapienza Università di Roma Dipartimento di Informatica e Sistemistica OpenRDK

See it!rconsoleqt –c rqra-usar-image-randomExploration.config

Page 31: USARSim 3D Simulator Gabriele Randelli - Daniele Calisi @dis.uniroma1.it Sapienza Università di Roma Dipartimento di Informatica e Sistemistica OpenRDK

Thanks for Thanks for youryourattention!!! attention!!! Questions?Questions?

Most of the images are courtesy of the NIST