Computing & Information SciencesKansas State University
Cooperative Robotic SimulatorEnvironment Simulator
Cooperative Robotic SimulatorEnvironment Simulator
Masters’ ReportScott J. HarmonMay 12, 2004
Cooperative Robotics Simulator Group
Computing & Information SciencesKansas State University
OutlineOutline
Introduction Overall system Demo
Environment Module Main Loop Map Component Robot and Sensor Components
Module Communications/Major Protocols Robot <--> Environment Viewer<--> Environment
Future Work Network improvements Map improvements Reflection
Computing & Information SciencesKansas State University
Overall System ArchitectureOverall System Architecture
Multiple Modules written in Java: Environment Robot Viewer Control Panel Communications
Computing & Information SciencesKansas State University
Overall System Architecture-2Overall System Architecture-2
[1]
Robot ControlCode
Robot HardwareSimulator
Hardware SimulatorAPI
Environment Simulator
RobotSimulator
EnvironmentControl Panel
SimController
CommunicationsController
EnvironmentBuilding Tool
EnvironmentDesigner
EnvironmentController
EnvironmentModel
3D ViewerUser
Computing & Information SciencesKansas State University
Example DeploymentExample Deployment
Environment
Robot1
Robot2
RobotN
Viewer1
ControlPanel
Messaging
ViewerN
Computing & Information SciencesKansas State University
DemonstrationDemonstration
Computing & Information SciencesKansas State University
System ComponentsSystem Components
«executable»environment::Environment
«executable»robot::HardwareSimulator
«executable»viewer::CRS3DViewer
«executable»controlpanel::ControlPanelClient
ControlPanel Robot
Viewer
communications::CommunicationsSystem
«call»
«send»
«send»
«send»
Computing & Information SciencesKansas State University
Environment ComponentsEnvironment Components
EnvironmentEnvironmentFileLoader
EnvironmentMap
EnvironmentObject
EnvironmentObjectRobot
CollisionDetection
RobotSensor
«call»
«call»
«call»
«call»
«derived»«call»
Computing & Information SciencesKansas State University
Environment ModuleEnvironment Module
Coordinates and drives the simulation Main Loop using time-step based approach
Models the virtual environment Keeps track of positional and state information of all objects in the
virtual environment
Computing & Information SciencesKansas State University
Environment - Main LoopEnvironment - Main Loop
Iterated for each time-step Time-steps size is set at runtime
Drives the simulation
Computing & Information SciencesKansas State University
Environment - Main Loop-2Environment - Main Loop-21 waitForRobots();2 setState(STATE_ROBOTS);3 sendObjectsToVRMLClients();4 currentTime = 0;5 running = true;6 setState(STATE_RUNNING);7 while(running) {8 //get the event for this timestep from each Robot9 //lock the robotqueue10 synchronized(robots) {11 //This double-stepped get allows the stuff to travel here before I block trying to get it.12 for (int i = 0; i < robots.size(); i++) {13 EnvironmentObjectRobot robot = (EnvironmentObjectRobot) robots.get(i);14 robot.prepGetEvents(currentTime);15 }16 for (int i = 0; i < robots.size(); i++) {17 EnvironmentObjectRobot robot = (EnvironmentObjectRobot) robots.get(i);18 robot.queueEvents();19 }20 }21 //process queue from front (top).22 processActionEventQueue();23 //send out sensor readings to robots.24 processSensorEventQueue();25 //add timestep to VRMLUpdates.26 for (int i = 0; i < viewerUpdateQueue.size(); i++) {27 ((ViewerUpdateLocation)viewerUpdateQueue.get(i)).timestep = currentTime;28 }29 //send out VRMLUpdates to the VRML viewer30 sendViewerEvents(viewerUpdateQueue);31 currentTime++;32 try {33 Thread.sleep(steppausetime);34 } catch (InterruptedException e) {}35 }
Computing & Information SciencesKansas State University
Communications between ModulesCommunications between Modules
Java Socket used Each component connects on a pre-determined port to the
Environment. Serializable objects are sent over the Socket connection.
Computing & Information SciencesKansas State University
Robot <--> Environment ProtocolRobot <--> Environment ProtocolEnvironment Robot1
Connect
MyName (String)
Time-Step size (Long)
Timestep (Long)
RobotRequest-1
RobotRequest-2
RobotRequest-N (last message flag set)
RobotSensorResponse-1
RobotSensorResponse-2
RobotSensorResponse-N (last message flag set).
This section repeats forthe life of the simulation.
Message-1 (if messaging is enabled)
Computing & Information SciencesKansas State University
Viewer <--> Environment ProtocolViewer <--> Environment Protocol
Environment Viewer
Connect
ViewerObject-1
ViewerObject-2
ViewerObject-3
ViewerObject-4
ViewerObject-N (last message flag set)
ViewerUpdate-1
ViewerUpdate-3
ViewerUpdate-2
ViewerUpdate-N
This section repeats forthe life of the simulation.
Computing & Information SciencesKansas State University
ConclusionsConclusions
Simulator is distributable because of the modularity
Modules communicate using protocols over a socket connection
Environment module is responsible for orchestrating the simulation and for modeling the virtual environment.
Computing & Information SciencesKansas State University
Future WorkFuture Work
There are three areas in the Environment module to improve: Network Map Reflection
Computing & Information SciencesKansas State University
Future Work – NetworkFuture Work – Network Network is utilized for communications between modules
Enhancements: Optimize by reducing amount of communications Improve latency
Fetch Robot commands in separate threads while previous commands are being evaluated
Computing & Information SciencesKansas State University
Future Work – Network-2Future Work – Network-2 Example Protocol:
Environment EnvironmentObjectRobot1 EnvironmentObjectRobot2
RobotHardware1 RobotHardware2Start
Start
Timestep1
Timestep1Reqest
Reqest2
Reqest3
Request
Request2
Request3
Local Threads
Remote Processes
Timestep2
Timestep2Reqest
Reqest2 Request
Request2
getEvents(timestep)
getEvents(timestep)
EventList
EventList
This section repeats forthe life of the simulation.
Computing & Information SciencesKansas State University
Future Work – Map ComponentFuture Work – Map Component Map Component in charge of modeling the virtual environment
Enhancements: Domain specific Map components
What physics needs to be modeled?
Collision Detection improvementsJava3DGrid World (Change time into space)
DistributeCan we distribute the maintenance of the virtual environment across
multiple system?
Compound objects (grouping)A robot might be made up of more than one geometric shape.
Computing & Information SciencesKansas State University
Future Work – ReflectionFuture Work – Reflection Java Reflection allows the dynamic loading of classes by name
Enhancements: Make all sensors and effectors loaded dynamically by name
Allows us to add sensors and effectors without the need to modify the original code
Different Maps (virtual environment maintainer) loadable by nameAllows “pluggable” components
Computing & Information SciencesKansas State University
ReferencesReferences
[1] The Official Project website, http://www.cis.ksu.edu/~sdeloach/ai/projects/crsim.htm
Computing & Information SciencesKansas State University
AcknowledgementsAcknowledgements
Committee: Dr. DeLoach Dr. Gustafson Dr. Hsu
Teammates: Venkata Prashant Rapaka, Arun Prakash Ganesan, Esteban Guillen,
and Aaron Chavez
Computing & Information SciencesKansas State University
QuestionsQuestions