USARSim Tutorial - PowerPoint PPT Presentation

1 / 15
About This Presentation
Title:

USARSim Tutorial

Description:

the smallest unit of time in which all actors in a level are updated. States ... var Quat Quaternion; var KRBVec LinVel; var KRBVec AngVel; 14 // for state maintaining ... – PowerPoint PPT presentation

Number of Views:81
Avg rating:3.0/5.0
Slides: 16
Provided by: jijun
Category:

less

Transcript and Presenter's Notes

Title: USARSim Tutorial


1
USARSim Tutorial
Advanced Session
2
Programming Unreal
  • The Unreal Virtual Machine
  • Similar to Java Virtual Machine
  • Components
  • server, client, rendering engine, and the engine
    support code.
  • Language Unreal Script
  • The Tick
  • the smallest unit of time in which all actors in
    a level are updated
  • States
  • Objects behaviors management
  • Program state machine at language lever

3
Programming Unreal (cont.)
  • Network Programming
  • Replication
  • The way to communicate between server and client
  • Types actors, variables, functions
  • Quality reliable or unreliable
  • Method conditional replication
  • Only replicate data to the relevance actors
  • Simulated function
  • Function runs both on server and client
  • Similar to the fork() function in C
  • Reference
  • Unreal Networking Architecture http//unreal.epicg
    ames.com/Network.htm
  • UnrealWiki--Replication http//wiki.beyondunreal.c
    om/wiki/Replication

4
Unreal Script
Actor -
AimedAttachment? - Brush
- Volume gtgt - Controller
- AIController -
PlayerController - DamageType gtgt
- Effects
  • Object oriented language
  • Language Reference
  • Unreal Script Reference
  • http//udn.epicgames.com/Two/UnrealScriptReferenc
    e
  • UnrealScript Lessons
  • http//wiki.beyondunreal.com/wiki/UnrealScript_Le
    ssons
  • Compile
  • Compiling With UCC http//wiki.beyondunreal.com/w
    iki/Compiling_With_UCC
  • Edit ut2003.ini file
  • Delete you .u file, then run ucc make
  • Debug
  • UnrealScript Debugger http//udn.epicgames.com/Two
    /UnrealScriptDebugger
  • Print out the information you want

5
Sensor
  • Overview
  • How sensor works
  • Calculate based on the ground truth database
  • Add noise and distortion
  • Build sensor class
  • Based on Sensor class
  • Provide sensor
  • data in plain text

6
Sensor (cont.)
  • The Sensor Class
  • Attributes
  • Name type
  • Noise distortion
  • Mounting info.
  • Others
  • Static mesh
  • Scale
  • Hidden sensor
  • Methods
  • Initialize
  • setName and mounting
  • Data
  • sensor data, sensor type sensors configuration

Attributes var string SenName // the sensor
name var string SenType // the sensor type
var config bool HiddenSensor // variable
indicts whether show the sensor in Unreal var
config InterpCurve OutputCurve // the distortion
curve var config float Noise // the random
noise amount var vector myPosition // the
mounting position var rotator myDirection //
the mounting direction Methods function
SetName(String SName) // set the sensor name
function Init(String SName, Actor parent, vector
position, rotator
direction) // mounting the sensor function
String GetData() // the interface that send
sensor data to robot function String GetType()
// return the sensor type function String
GetConf() // return the sensor configuration
7
Sensor (cont.)
  • Build Sensor
  • Extend from sensor class
  • Specify properties (you may add your own
    attributes)
  • Type
  • Noise distortion curve (the input-output curve)
  • Static mash, scale and whether display the mesh
    etc.
  • Provide sensor data
  • Fill the GetData() function
  • Calculate data
  • Add noise
  • Interpolate the input-output curve to distort
    data
  • Fill the GetConf() function
  • Compile the class

8
Sensor (cont.)
  • Example (range finder)

function float GetRange() local vector
HitLocation,HitNormal local float range
if (Trace(HitLocation, HitNormal, Location
MaxRangeve else rangeVSize(HitLocation-Loca
tion) if (OutputCurve.Points.lengthgt0)
rangeInterpCurveEval(OutputCurve, range)
range RandRange(-Noise,Noise)range if
(rangegtMaxRange) rangeMaxRange if
(rangeltMinRange) rangeMinRange return
range function String GetData()
local string outstring curRotRotation
outstring"Name "SenName" Range
"GetRange()"" return outstring
Calculate data
Distort data
Add noise
Provide sensor data in plain text
9
Command
  • The mechanism (Gamebots)
  • BotConnection
  • Receive data
  • Parser data
  • Transfer command
  • to RemoteBot
  • RemoteBot
  • Store commands into variables
  • Robot
  • Check the RemoteBots variables every tick
  • Make response to the variable

10
Command (cont.)
  • Add a command
  • In RemoteBot
  • Define variable(s) to store the command
  • Ex. var int speed
  • In BotConnection
  • theBot the RemoteBot possesses the BotConnection
  • Add parsing codes in ProcessAction()
  • Check data type
  • Parse data
  • GetArgVal() get the value of an argument
  • ParseVector(), ParseRot() get vector and
    rotation
  • Set the variable of thebot (RemoteBot)
  • Ex. theBot.speed

11
Command (cont.)
  • In Robot class
  • Controller the RemoteBot of the robot
  • Get the command through the controller
  • Ex. speedCommand RemoteBot(Controller).speed
  • Example

BotConnection function ProcessAction(string
cmdType) case "CAMERA" if
(GetArgVal("Rotation")!"") ParseRot(r)
theBot.myCameraRotation.Rollr.Roll .
RemoteBot var rotator myCameraRotation
Define
Parse
Set var.
Read
P2AT if (RemoteBot(Controller).myCameraRotatio
n.roll!0) RemoteBot(Controller).myCameraRotat
ion.roll -1
Write
12
Robot
  • The workflow

Tick ProcessCarInput() // Process
command PackState() // Pack vehicle state //
joint control // camera, headlight control //
flip control
Timer //Send out sensor data
13
Robot (cont.)
  • Maintain chassis state
  • Method
  • Tick function PackState()
  • Server packs chassis state
  • Event VehicleStateReceived()
  • Unpack and calculate chassis state
  • Event KUpdateState()
  • Commit chassis state
  • Chassis state (rigid body state)
  • Position
  • Direction
  • Liner velocity
  • Angular velocity

struct KRigidBodyState var KRBVec Position
var Quat Quaternion var KRBVec
LinVel var KRBVec AngVel
14
Robot (cont.)
  • Control part(s)
  • Method
  • Tick function PackState()
  • Server packs parts state
  • Server and client update joints parameter
  • torque, max speed, steering angle etc.
  • Event VehicleStateReceived()
  • Unpack and calculate parts state
  • Unpack joints parameters
  • Tick function set joints control parameters
  • Joint control

struct JointControl var byte state // 1
new command var float steer // steer
angle var byte order // control order
var float value // spin parameter
// for state maintaining var float
angle // desired spinning angle var int
startAng // the start angle var byte
lastCommandId // sequence number
15
Robot (cont.)
  • Strategy
  • Absolute control vs. relative control
  • Position control vs. speed control vs. torque
    control
  • State package replication vs. simple variable
    replication
  • Example
  • Chassis state maintain
  • Rover Differential() KUpdateState()
    replication expQ
  • Part state maintain
  • P2DX Tick() replication steerAng
  • Part control
  • P2AT ProcessCarInput()
Write a Comment
User Comments (0)
About PowerShow.com