How to build a modular robot: 3. Smoother test runs

Tutorial

Stage 3: Improving the test conditions for further modular development

Dates
  • Creation: 10/25/2020
  • Update: 11/29/2020
modular-bot-with-ros0modular-bot-with-ros1modular-bot-with-ros2modular-bot-with-ros3
Objective: Setup a custom car in Gazebo, that drives autonomously through a gate.
Duration: 1.5 weeks. Depends mainly on time spent in prep and setup time.
Learning outcomes: Merging technologies with ROS and the foundations of behaviour planning.
 
STEP 0                 | PREP                                | 2 days
STEP 1                 | SETUP                             | 2 days
STEP 2                 | PROTOTYPE                  | 2 days
STEP 3                 | DEMO                             | 1 day

The final demo is accessible at https://www.youtube.com/watch?v=rdJYIxeUt-o . It incorporates the technologies shown below.



Use resources from https://github.com/ThomasCarstens/cours-de-robotique

STAGE 3: SETTING IT UP FOR A DEMO


LAUNCH FILE FOR ALL SCRIPTS AT ONCE + COMMON LOG FOR ALL SCRIPTS


Learning how to launch different nodes for project launch.

RELOADING THE CAR AS SOON AS IT COLLIDES WITH AN OBJECT

A recap of service calls will be useful.
This requires collision detection.
For respawning the robot, learn how to use Gazebo service calls explained below.


HOW TO STOP THE PYTHON SCRIPT: WRAPPING CODE UP IN AN ACTION SERVER

We’re on the last stage! Finally, a central decision planner is used in preparation for scaling up the network. To do this, a ROS Action Server wraps the actions. Using a mission_state ROS node, you can run a full Python Server that in itself runs an action in its callback.
First make sure you understand how to perform an action. Follow this tutorial. You can later adapt it to your specific action.
Using this server, you can create a custom message within a client that returns the amount of time it takes for the robot before a collision.
Custom actions can deliver specific information to the user once the action has completed!
 


GOING FURTHER (NOT PART OF PROJECT):

USING A STATE MACHINE TO CONTROL THE SEQUENCE

 
Splitting the robot motion into states is a technique to be able to create various robot applications by revisiting states at will.
We make use of a state machine to be our ‘decision-maker’ (state transitions) between the sensor input (callbacks) and specific motions of the bot (actions).
SMACH is a simple Python implementation of state machines, and for the purposes of developing various usecases, you can get up and running easily.
This is the subject of a separate tutorial.