TensorSwarm: A Framework for Reinforcement Learning of Robot Swarms

Aug 11, 2021 | Data Science

Welcome to the exciting world of robotic swarms! TensorSwarm is an open-source framework that brings reinforcement learning to the realm of multiple robotic agents working together effectively. In this article, we will explore how to set up and run TensorSwarm, its features, and some troubleshooting tips to keep your project on track.

What is TensorSwarm?

TensorSwarm connects the open-source robot swarm simulation Argos 3 to either OpenAI’s PPO or TensorForce using ROS. Each robot operates under a shared behavior policy, leveraging neural networks for decision-making. This framework supports a variety of simulation environments and is designed for flexibility and efficiency.

Features

  • Train up to 100 robots in various simulation environments.
  • ROS service for smooth communication between simulation and learning environments.
  • Support for multiple simultaneous simulation environments for effective CPU utilization.
  • Includes out-of-the-box examples for immediate experimentation and code building.

Installation

Installing TensorSwarm involves setting up several dependencies. Here’s how to get started:

Dependencies

Argos 3

Install Argos 3 from this link. This modified version includes a laser scanner essential for your simulation.

ROS

Ensure you have installed ROS Kinetic.

Python Dependencies

Note that ROS currently does not support Python 3, so install all Python dependencies for Python 2:

pip install tensorflow-gpu

If you wish to integrate TensorForce, install it as described here.

Setup TensorSwarm

TensorSwarm is delivered as a ROS package. Simply clone it into your catkin workspace. Here’s how to run the framework:

Running TensorSwarm

Running TensorSwarm involves four crucial steps:

  1. Setting up the environment.
  2. Starting roscore.
  3. Launching Argos 3 simulation instances.
  4. Executing the Python script for action generation and learning.

There are two experiments included:

  • 8 Robots navigating a 4-way intersection.
  • 8 Robots maneuvering through an L-curve.

Variants of TensorSwarm

OpenAI PPO

This is a true multi-agent PPO implementation ideal for advanced users. Successful training has been done with over 100 robots. Start with fewer robots and gradually increase as models mature. Execute the following commands in your catkin workspace:

src/tensorswarm/run_4_way_run_ppo.bash
src/tensorswarm/run_l_curve_run_ppo.bash

TensorForce

Due to current limitations, TensorForce only supports training one agent at a time, making it less efficient for multi-agent setups. However, it is an excellent choice for beginners interested in experimenting with alternative deep learning algorithms. You can train up to 4 robots using this variant:

src/tensorswarm/run_4_way_run_tforce.bash

Starting the Simulation

Each simulation window will start paused by default. To initiate the simulations, simply hit the FastForward button!

Troubleshooting

If you encounter issues, here are some quick troubleshooting ideas:

  • Ensure that all dependencies are correctly installed, especially Argos 3 and ROS.
  • Check if the versions of Python and TensorFlow are compatible.
  • If simulations do not start, double-check that all instances are running and that you have hit the FastForward button.

For more insights, updates, or to collaborate on AI development projects, stay connected with fxis.ai.

At fxis.ai, we believe that such advancements are crucial for the future of AI, as they enable more comprehensive and effective solutions. Our team is continually exploring new methodologies to push the envelope in artificial intelligence, ensuring that our clients benefit from the latest technological innovations.

With TensorSwarm at your fingertips, you’re ready to immerse yourself in the innovative landscape of robotic swarms and reinforcement learning!

Stay Informed with the Newest F(x) Insights and Blogs

Tech News and Blog Highlights, Straight to Your Inbox