Simulating Collaborative Robots in A Massive Multi-Agent Game Environment (SCRIMMAGE)
Simulating Collaborative Robots in A Massive Multi-Agent Game Environment (SCRIMMAGE)
1 INTRODUCTION
The high-cost of testing robotic systems in the field has led to the development
of a number of simulators for autonomous systems. A well-designed simulator al-
lows robotics researchers to debug and test their algorithms and data pipelines
in a controlled environment before deploying to a physical system where the
cost of failure is significantly higher. However, many robotics simulators have
been developed primarily for ground-based systems, with a focus on high-fidelity
multi-body physics models. This has made simulating large numbers (hundreds
or thousands) of aerial vehicles infeasible due to the computational complexity of
mesh collision detection and multi-body physics simulation. In many use cases for
2 Kevin DeMarco et al.
the data, and calculate a score both for individuals and teams. SCRIMMAGE
will then save log information to a summary csv file and calculate an overall
score by aggregating the results of individual metrics plugins. After the sim-
ulation runs are completed, SCRIMMAGE provides tools that can aggregate
the results from the simulation runs and provide statistical results. If a robotics
developer requires advanced statistical processing, the developer can leverage
SCRIMMAGE’s Python bindings, which allow the developer to directly parse
the trajectories from simulation runs.
2 RELATED WORK
The authors required a simulator that provided (1) scalability to a large num-
ber of robots for swarm applications, (2) support for the aerial domain, (3) a
minimal-effort path for simulator code to arrive on a physical system, and (4)
an open source license. Several simulators were considered for this task, and
SCRIMMAGE leverages lessons learned from the advantages and disadvantages
presented in the following existing simulation environments.
The Player/Stage Project provides an architecture to control and simulate
multiple ground-based robotic systems. However, its lack of 3D motion mod-
els makes it unusable for aerial robotics research. While Stage version 3 has
improved the degree to which swarm robotics can be scaled [25], it does not na-
tively support aerial robot flight dynamics models because it focuses on ground
robots. Similar to Stage in fidelity of simulation is the NetLogo simulator [22].
While NetLogo can be used to simulate 100’s of interacting agents, NetLogo
models are not written in C++, but NetLogo’s own programming language.
This could make deployment to physical robots cumbersome.
A simulator related to Stage, Gazebo, provides dynamic 3D multi-robotic
worlds that can be rich in complexity [13]. Gazebo’s development has been
tightly integrated with the Robot Operating System (ROS), which has led to its
widespread acceptance by the robotics community. Gazebo is capable of work-
ing with SolidWorks to provide closed kinematic chains to highly complex CAD
models [2]. However, the Gazebo simulator does not scale well when simulating
hundreds of robotic systems on a single machine due to the high-cost of precise
collision detection. Gazebo depends on a collision detection package such as the
Bullet Collision Detection library or the Open Dynamics Engine (ODE) in or-
der to operate. A major advantage of SCRIMMAGE is that it can leverage a
full collision detection library or it can utilize lower-fidelity collision detection
methods in order to meet the researcher’s needs. Similar to Gazebo in fidelity of
simulation is the V-REP robot simulator [21]. V-REP provides an open source
license for academic use, but a non open source license for companies, research
institutes, and non-profit organizations. The authors of this paper cannot use
V-REP’s open source version since they work at a research institute.
A need for a large number of aerial robots acting together in a virtual envi-
ronment led SCRIMMAGE developers to look to multi-agent based simulators.
Simulators such as MASON, FLAME, and Repast focus on agents interacting to-
4 Kevin DeMarco et al.
3 DESIGN GUIDELINES
in a ROS node because other asynchronous nodes in the system will continue
to process and publish data even though the node that the developer is de-
bugging has paused. Thus, a second design guideline for SCRIMMAGE was to
ensure that the entire simulation could be paused and stepped in a lockstep
fashion. This allows a plugin developer to run SCRIMMAGE in a debugger,
such as gdb, or print debug information to the terminal without affecting the
simulation results. Part of the lockstep implementation includes not using any
form of TCP/UDP network messaging in SCRIMMAGE or its plugins. However,
SCRIMMAGE does provide a simple shared-memory publish/subscribe system
that does not use the system’s networking layer to pass messages between plug-
ins. Additionally, SCRIMMAGE can provide the simulation clock to ROS, which
allows it to “step” ROS nodes.
A third design guideline for SCRIMMAGE is that motion model plugin de-
velopers should be allowed to describe their robot motion models using explicit
state transition equations of the form, ẋ = f (x, u). This is different from how mo-
tion models are described in multi-body physics simulators like ODE in Gazebo,
where a model is used to describe the transformations between the robot’s base
link, wheels, sensors, etc. While the transformation-based model description is
useful for robot manipulation tasks, it is not the canonical form used by control
engineers and mobile robot planners. This can lead to inconsistencies between a
planner’s expected model of the state transition equations and the actual motion
model’s state transition equations. This is not an issue when using planners in
SCRIMMAGE because the motion model used during simulation can be directly
used during planning, as shown in Fig. 2. In this case, an autonomy plugin cre-
Fig. 2: The resulting trajectory of a motion planner shown in white. The blue
sphere is the goal location, the red spheres are obstacles, and the rectangular
meshes are obstacles.
ates an instance of the motion model plugin and uses it during the Open Motion
Planning Library’s propagation step [23]. Since SCRIMMAGE guarantees de-
terminism and lockstep execution, it can guarantee than the planned path that
was generated with a motion model is the exact path that is followed by the
same motion model.
6 Kevin DeMarco et al.
SCRIMMAGE makes use of C++14 and open source packages such as Boost,
Eigen, GeographicLib, JSBSim, and CMake. SCRIMMAGE is hosted publicly
on GitHub5 and is distributed under the GNU Lesser General Public License
v3.0. It is the intention of the SCRIMMAGE authors for all code changes made
to the core SCRIMMAGE project to be made available to the original project.
However, third-party plugin developers can designate their own licenses for their
individual plugins. This allows individuals to retain the intellectual property
rights for their SCRIMMAGE plugins.
4 PLUGIN ARCHITECTURE
To facilitate flexibility in simulation fidelity, SCRIMMAGE implements several
plugin interfaces. A SCRIMMAGE entity is an agent in the simulation that is
composed of one or more plugins. Each entity can have multiple sensor, auton-
omy, and controller plugins, but only a single motion model plugin. The flow of
information through an entity’s plugin interfaces is shown in Fig. 3. An auton-
omy plugin queries the entity’s sensors and/or the environment’s ground truth
to make a decision. The types of information that an autonomy plugin could
reason over might be the positions of other robots, obstacle detections, map
data, etc. The autonomy plugin generates a desired state, which includes po-
sition, velocity, and/or orientation information. The purpose of the controller
plugin is to consume the desired state and produce actuator commands for the
motion model plugin. Finally, the motion model plugin takes the entity’s cur-
rent state and the control outputs from the controller plugin to generate a new
state for the entity in global coordinates. SCRIMMAGE also provides a novel
communications network plugin interface. The purpose of this plugin interface
is to simulate the effects of the communications network on message transmis-
sion between entities. SCRIMMAGE provides three default network plugins: the
5
The SCRIMMAGE source code is publicly available at
https://github.com/gtri/scrimmage.
SCRIMMAGE 7
LocalNetwork for simulating messages being sent between processes on the same
physical platform, the SphereNetwork for simulating messages being sent across
a radio network, and the GlobalNetwork for the transmission of simulation-
specific messages that will always be delivered. Without a dedicated network
plugin interface, other simulators require the researcher to setup intermediate
message topics in order to simulate the effects of the network on message delivery.
Collision detection and interaction between entities is abstracted through
the entity interaction plugin interface. An entity interaction plugin can wrap
a collision detection library, such as Bullet, or it can perform simple collision
detection based on the ranges between entities, such as with SCRIMMAGE’s
SimpleCollision plugin. A complete tutorial for creating SCRIMMAGE plug-
ins is available on the official SCRIMMAGE website. 6
5 INTEGRATIONS
While SCRIMMAGE can be used in isolation to develop and test novel auton-
omy and controller algorithms, SCRIMMAGE can interface with other software
packages used by the robotics community. SCRIMMAGE has utilities and plu-
gins that interface with ROS, MOOS, and OpenAI Gym [19, 16, 5].
5.1 ROS
There are two methods of interfacing SCRIMMAGE with ROS. The first method
uses SCRIMMAGE utilities to abstractly construct publishers, subscribers, and
services, such that the plugin uses SCRIMMAGE’s API when being simulated
in SCRIMMAGE or the plugin uses ROS’ API when being executed in a ROS
node. The second method emulates the Stage simulator’s ROS API, which allows
SCRIMMAGE to be a drop-in replacement for Stage when working with the ROS
2D navigation stack.
After writing and verifying algorithms in simulation it is a simple step to
integrate with ROS as fundamental concepts in the latter map directly to the
former. In particular, ROS nodes map to SCRIMMAGE plugins, ROS services
are functions provided by one plugin and called by another, and ROS pub-
lishers/subscribers map to SCRIMMAGE network devices. Similar to the ROS
interface, data is loosely coupled in the form of a publish-subscribe system.
SCRIMMAGE also has the ability to emulate Stage’s interface to ROS through
the ROSAutonomy plugin. The ROSAutonomy plugin publishes sensor information
to ROS over the odom and base scan topics and it accepts commanded veloci-
ties over the cmd vel topic. SCRIMMAGE can convert the same maps used by
Stage to 3D wall barriers and uses the Bullet Physics Engine’s ray tracing fea-
ture to simulate a LIDAR sensor. A screenshot of two simulated ground robots
in SCRIMMAGE being controlled by the ROS 2D navigation stack is shown in
Fig. 4a.
6
The SCRIMMAGE website is located at http://www.scrimmagesim.org.
8 Kevin DeMarco et al.
5.2 MOOS
The Mission Oriented Operating Suite (MOOS) is a publish-and-subscribe sys-
tem for robotic platforms and MOOS-IvP (MOOS Interval Programming) is an
autonomy behavior fusion engine that is commonly used on autonomous mar-
itime vessels [16, 4]. SCRIMMAGE’s MOOSAutonomy plugin converts the SCRIM-
MAGE entities into the appropriate MOOS data structure and publishes them
to the MOOS community. MOOS-IvP then generates a desired heading and a
desired speed and publishes them to the MOOSAutonomy plugin.
SCRIMMAGE provides a number of motion models that can be used with most
autonomy plugins: simple car, simple aircraft, double integrator, single integra-
tor, high-fidelity JSBSim model, etc. The Boids flocking model demonstrates
the desired performance when using motion models that are similar to unicycle
dynamics. However, since we wish to demonstrate SCRIMMAGE’s 3D capabili-
ties, we extended the 2D unicycle model to a 3D version by adding pitch to the
unicycle state, as shown in (1).
ẋ = us cos(ψ) cos(θ)
ẏ = us cos(ψ) sin(θ)
ż = us sin(ψ) (1)
θ̇ = uω
ψ̇ = uφ
10 Kevin DeMarco et al.
The 3D unicycle state consists of a 3D position, (x, y, z), its heading, θ, and its
pitch, ψ. Inputs to the motion model are the forward speed, us , yaw rate, uω ,
and pitch rate, uφ . Not shown in (1) are the limits on pitch rate and yaw rate.
The predator behavior can be decomposed into two primary tasks: selecting the
prey to capture and constructing a trajectory to capture the prey. In differential
game theory, it has been shown that a pure pursuit strategy in pursuer/evader
games is the optimal strategy for the pursuer [10]. Thus, the pure pursuit strategy
was used to construct a trajectory to capture the prey. To compute the control
inputs required to achieve pure pursuit, the predator first computes the desired
velocity vector normalized by its maximum speed, smax , pointing from its own
position, pown , to the prey’s position, pprey .
pprey − pown
v = smax (2)
kpprey − pown k
The desired heading, θd , and desired pitch, ψd , can be computed with (3).
−1 vy
θd = tan (3)
vx
vz
ψd = tan−1 q
vx2 + vy2
Finally, these desired orientations can be converted into control inputs by setting
the desired speed to the maximum speed and implementing simple proportional
controllers.
How a predator should select the prey is less obvious than how it should
construct its capture trajectory. A greedy strategy will first be employed, where
the predator selects the prey based on a distance metric. The predator will se-
lect the prey that is closest to it in 3D space. How often the predator chooses
its next prey also has to be determined. Should the predator select the closest
prey at every decision time-step or should it select a prey one time and pursue
the prey until it has been captured? This is the question that this SCRIM-
MAGE simulation will answer in a statistical fashion. One team of predators
(Team 2) will perform a one-time selection of its prey and the other group of
predators (Team 3) will be allowed to select the closest prey at every decision
time-step. The predator’s autonomy plugin was parameterized with a boolean
variable called allow prey switching that switches the selection behavior of
the predator, which facilitates running the same plugin with different parame-
ters in the same simulation. It is hypothesized that the predator team that is
allowed to switch prey will capture more prey because the predators will be able
to opportunistically catch prey that happen to fly nearby.
SCRIMMAGE 11
The collision avoidance behavior that keeps the prey away from predators has a
larger value for dmin than the behavior that keeps prey away from other prey.
However, both behaviors have the same values for S. Likewise, the weight for the
predator collision avoidance behavior is larger than the other behavior weights.
The SCRIMMAGE plugin interface provides the plugin developer with an R-tree
data structure for fast computation of nearest neighbors, which simulates com-
municating state information based on a maximum range [3]. The generation of
the R-tree is more computationally expensive than a single nearest neighbors
search, but queries on the R-tree are more efficient than a nearest neighbors
search. The SCRIMMAGE simulation controller computes a single R-tree in-
stance for all agents at each time-step, which is more efficient than each agent
executing its own nearest neighbors search.
varies. Table 1 shows the ratio of simulation to actual time for running the
predator / prey simulation as a function of the number of total agents in the
simulation for three motion model plugins of increasing fidelity.
The results in Table 1 indicate that using a unicycle model does not signif-
icantly reduce run-time while moving to a six degrees-of-freedom model with
JSBSim significantly reduces run-time. These results highlight the importance
of being able to scale the fidelity of motion model plugins to allow the researcher
to focus on the aspect of the simulation that is of most concern.
7 CONCLUSION
A motivating example for the use of SCRIMMAGE in simulating large num-
bers of autonomous agents was presented in the form of a predator/prey game.
SCRIMMAGE was originally developed due to the lack of open source, com-
putationally efficient, multi-agent, aerial robot simulators. SCRIMMAGE was
also designed with batch processing in mind; thus, its plugin architecture can
compute metrics and aggregate results across large batches of simulations. This
allows SCRIMMAGE to be used as a platform for experimentation, comparing
robot behaviors, and comparing swarm strategies. SCRIMMAGE provides plu-
gin interfaces for ROS, MOOS, and OpenAI. In future work, SCRIMMAGE will
be leveraged for multi-agent deep learning due to its low computational over-
head and its OpenAI interface. SCRIMMAGE will continue to improve as it is
used on more research programs and its open source nature allows the robotics
community to provide feedback.
References
1. Arkin, R.: Motor schema based navigation for a mobile robot: An approach to
programming by behavior. In: Robotics and Automation. Proceedings. 1987 IEEE
International Conference on. vol. 4, pp. 264–271. IEEE (1987)
2. Bailey, M., Gebis, K., Zefran, M.: Simulation of Closed Kinematic Chains in Real-
istic Environments Using Gazebo. Springer International Publishing, Cham (2016)
3. Beckmann, N., Kriegel, H.P., Schneider, R., Seeger, B.: The r*-tree: an efficient and
robust access method for points and rectangles. In: Acm Sigmod Record. vol. 19,
pp. 322–331. Acm (1990)
4. Benjamin, M.R., Leonard, J.J., Schmidt, H., Newman, P.M.: An overview of moos-
ivp and a brief users guide to the ivp helm autonomy software (2009)
5. Brockman, G., Cheung, V., Pettersson, L., Schneider, J., Schulman, J., Tang, J.,
Zaremba, W.: OpenAI gym. arXiv preprint arXiv:1606.01540 (2016)
6. Collier, N.: Repast: An extensible framework for agent simulation. The University
of Chicagos Social Science Research 36, 2003 (2003)
7. Fiorini, P., Shiller, Z.: Motion planning in dynamic environments using velocity
obstacles. The International Journal of Robotics Research 17(7), 760–772 (1998)
8. Forrester, A., Keane, A., et al.: Engineering design via surrogate modelling: a
practical guide. John Wiley & Sons (2008)
9. Gerkey, B., Vaughan, R.T., Howard, A.: The player/stage project: Tools for multi-
robot and distributed sensor systems. In: Proceedings of the 11th international
conference on advanced robotics. vol. 1, pp. 317–323 (2003)
10. Isaacs, R.: Differential Games: A Mathematical Theory with Applications to War-
fare and Pursuit, Control and Optimization, vol. 1. Dover Publications, Inc. (1965)
14 Kevin DeMarco et al.
11. Jakob, W., Rhinelander, J., Moldovan, D.: pybind11 – seamless operability between
c++11 and python (2017), https://github.com/pybind/pybind11
12. Kiran, M., Richmond, P., Holcombe, M., Chin, L.S., Worth, D., Greenough, C.:
Flame: simulating large populations of agents on parallel hardware architectures.
In: Proceedings of the 9th International Conference on Autonomous Agents and
Multiagent Systems: volume 1-Volume 1. pp. 1633–1636. International Foundation
for Autonomous Agents and Multiagent Systems (2010)
13. Koenig, N., Howard, A.: Design and use paradigms for gazebo, an open-source
multi-robot simulator. In: Intelligent Robots and Systems, 2004.(IROS 2004). Pro-
ceedings. 2004 IEEE/RSJ International Conference on. vol. 3, pp. 2149–2154. IEEE
(2004)
14. Luke, S., Cioffi-Revilla, C., Panait, L., Sullivan, K., Balan, G.: MASON: A multi-
agent simulation environment. Simulation 81(7), 517–527 (2005)
15. Martinez, J.M., Collette, Y., Baudin, M., Christopoulou, M., Baudin, M., et al.: py-
DOE: The experimental design package for Python (2009–), https://pythonhosted.
org/pyDOE/, [Online; accessed 2017-09-07]
16. Newman, P., MOOS, A.: A mission oriented operating suite. Tech. rep., Technical
Report OE2007-07. MIT Department of Ocean Engineering (2003)
17. Nishimura, S.I., Ikegami, T.: Emergence of collective strategies in a prey-predator
game model. Artificial Life 3(4), 243–260 (1997)
18. Pinciroli, C., Trianni, V., O’Grady, R., Pini, G., Brutschy, A., Brambilla, M., Math-
ews, N., Ferrante, E., Di Caro, G., Ducatelle, F., et al.: ARGoS: a modular, multi-
engine simulator for heterogeneous swarm robotics. In: Intelligent Robots and Sys-
tems (IROS), 2011 IEEE/RSJ International Conference on. pp. 5027–5034. IEEE
(2011)
19. Quigley, M., Conley, K., Gerkey, B., Faust, J., Foote, T., Leibs, J., Wheeler, R.,
Ng, A.Y.: ROS: an open-source robot operating system. In: ICRA workshop on
open source software. vol. 3, p. 5. Kobe (2009)
20. Reynolds, C.W.: Flocks, herds and schools: A distributed behavioral model. ACM
SIGGRAPH computer graphics 21(4), 25–34 (1987)
21. Rohmer, E., Singh, S.P., Freese, M.: V-rep: A versatile and scalable robot sim-
ulation framework. In: Intelligent Robots and Systems (IROS), 2013 IEEE/RSJ
International Conference on. pp. 1321–1326. IEEE (2013)
22. Sklar, E.: Netlogo, a multi-agent simulation environment (2007)
23. Şucan, I.A., Moll, M., Kavraki, L.E.: The Open Motion Planning Library. IEEE
Robotics & Automation Magazine 19(4), 72–82 (December 2012), http://ompl.
kavrakilab.org
24. Sutton, R.S., Barto, A.G.: Reinforcement learning: An introduction, vol. 1. MIT
press Cambridge (1998)
25. Vaughan, R.: Massively multi-robot simulation in stage. Swarm intelligence 2(2),
189–208 (2008)