Back to all posts

Simulating robotics- Capturing simulation data for Digital Twin Computing -Part II

Posted on Feb 23, 2024 in Engineering
Roshan Singh
Roshan Singh
R&D Engineer, Scurid
Simulated Digital Twin
Simulated Digital Twin

Overview

This is the second blog of our 3 blog series on data capture with Scurid Edge Agent from simulated robotics for digital twin computing. In the previous blog, we introduced the Digital Twin computing in the industrial IoT, its application and challenges.

This blog covers the following:

  1. Architecture of Argos3 simulator.
  2. Installation of Argos3 simulator.
  3. Writing robot controller and configuration file for the scenario.

Argos3

ARGoS3 is a multithreaded physics-based simulator designed to simulate large-scale robot swarms. Benchmark results show that Argos can perform physics-accurate simulations involving thousands of robots in a fraction of real-time.

Architecture of ARGoS3
Architecture of ARGoS3

The ARGoS 3 simulator expects

  1. An XML configuration file, typically with extension .argos
  2. User code compiled into one or more libraries.
  3. A robot controller.

The controller file has four main high level methods namely:-

  1. init: Is invoked at the start of the simulation.
  2. step: The simulation proceeds in steps. For each step the step method is invoked.
  3. reset: Resets the simulation to the initial state.
  4. destroy: Destroys the simulation.

All the user defined methods are called inside step method.

The configuration file contains all the information to set up the arena, the robots, the physics engines, the controllers, etc. User code includes robot controllers and, optionally, hook functions to be executed in various parts of ARGoS to interact with the running experiment.

Installing ARGoS 3

Download the binary package of ARGoS from ARGoS. Alternatively, we can download the development sources through git. In our case we are going to build it from source. The instructions provided for building ARGoS 3 in this blog is for macOS, for other operating systems the instructions can be found here

Step 1:Download ARGoS 3

git clone https://github.com/ilpincy/argos3.git argos3

Step 2:Download dependencies

brew install pkg-config cmake libpng freeimage lua qt
docbook asciidoc graphviz doxygen

Step 3: Build ARGoS 3

cd argos3 mkdir build_simulator cd build_simulator cmake ../src make

Robot controller and configuration file for the scenario

We are going to use Footbot robots for our experiment. Footbot robots are mainly used in swarm robotics. The foot-bot has a differential drive system that uses a combination of tracks and wheels to provide mobility on rough terrain. They have LED communication ring which are used for sending messages. These RGB coloured signals are detectable by the onboard cameras of other foot-bots.

A Footbot robot
A Footbot robot

Argos3 supports several programming language such as Java, C++, Lua to write the robot controller. In our case we will be writing the robot controller code in Lua. Lua is an efficient, lightweight, embeddable scripting language.

Our robot controller code allows the robot to move randomly on the multicolored grid, sense the color value and report the color detected along with other parameters. The code for our experiment is available under scurid-inc/sample-apps/robotics Pull the repository inside the directory where we built the argos3 binary.

Now, we are all set to start the simulation. To run the simulation we need to execute the following command from the terminal.

argos3 -c robotics/robots.argos

This will launch the simulation window:

Simulation view
Simulation view

We can now start the simulation by clicking the Start icon on the simulation window. Once the simulation starts we can see logs from the robots in the terminal console as below:-

Logs from the Simulation
Logs from the Simulation

What's next

In this blog we have set up the ARGoS 3 simulator. Wrote the configuration and the controller for the robots and executed the simulation. In the simulation we were able to read sensor data fetched from the robots and their co-ordinate position. In the next blog we will see how we can securely process and store the robot data with Scurid.

An established platform for your IoT devices and data. Ready for production.

With Scurid’s easy-to-use API-based platform for hardware, sensors, and applications we want to enable the adoption of secure autonomous systems. Scurid is already trusted in production, helping our users achieve a faster and safer go-to-market.

Get started