MATLAB and Simulink at the French Robotics Cup
In this post, Jean-Paul Marcade talks about how MathWorks tools are helping teams at La Coupe de France de Robotique and Eurobot robotics competitions. Jean-Paul is in the Engineering Development Group in Cambridge, UK. He participated himself during his university days at INSA Toulouse, so he has some great perspective to provide. Hope you enjoy!
– – –
Coupe de France de Robotique and Eurobot
La Coupe de France de Robotique (the French Robotics cup) and Eurobot robotics competitions gather people with different backgrounds around a theme changing every year. 2019 is the 150th anniversary of the periodic table and thus this year’s theme was called “Atom Factory”.
The French Robotics cup event gathered around 160 teams, mainly university students (from bachelor’s up to PhD) but also high school students and professional engineers. The complete results are online. This year’s winner was Team Sussus Invaders from Paris — see their robot below.
Eurobot is the European version including teams from Canada to Taiwan. It takes place in parallel to the French cup and winners of national events from all over the world come to compete against the winning French teams. This year’s winner was PMG Robotics, a team from Serbia.
Each match takes place on a 2-by-3 m table with up to 4 fully autonomous robots (2 per team). A game lasts 100 seconds and each team must score as many points as possible by picking up and moving pucks on the table.
There is no collaboration between the teams, but the robots must avoid each other.
Find below an illustration of the Atom Factory competition arena and a link to the rulebook.
Atom Factory competition arena. Source: 2019 Rulebook
What Problems are the Students Solving?
It should be no surprise that designing and programming robots for this competitions is not an easy task. Let’s talk about some of the main things we saw the teams work on.
Highly Integrated Systems
Most teams were using an embedded computer (e.g., Raspberry Pi, LattePanda) communicating with microcontrollers (e.g., Arduino, STM32 Nucleo, or custom cards) through protocols like I2C, Ethernet, or CAN. Some of the robots were also communicating between each other and with external sensors (e.g., cameras, lidars).
Implementing an algorithm that is easy to tune and maintain can often be challenging. One approach is to separate the concept from the implementation by testing the controller using a simulation model, and then automatically deploying it to hardware. During the competition we used the Arduino Engineering Kit to present this workflow.
Arduino Engineering Kit self-balancing motorcycle and its Simulink model
Using this kit, we could tune the balancing flywheel PID controller directly from Simulink without having to recompile the model! This rapid prototyping workflow can also be used in a robot to tune controllers, vision algorithms, behavior logic, and more.
We also provide support packages for other hardware boards or microcontrollers. You can check if yours is compatible here! We also provide videos and tutorials to get started with code generation at this page.
Besides hardware, there are several software frameworks built for these complex systems with specialized components. Some teams were using Robot Operating System (ROS) to exchange information between these components. ROS is a software tool for highly integrated systems which is becoming a standard in the robotics industry. To learn more about MATLAB, Simulink, and ROS, refer to this blog post.
Navigation and Control
Having up to 4 robots in a small table is challenging as some of them can move at up to 5 meters/second. Hence navigation and control are critical systems.
- Path planning and navigation: The best teams are combining wheel odometry (also known as dead reckoning) with range-finding sensors (sonar, lidar, etc.), which often requires sensor fusion. These sensors are used both for localization and for avoiding obstacles such as walls and other robots.
Simulated navigation task using probabilistic roadmaps
- Manipulator control: Many of the robots used manipulators with suction grippers to pick up and drop off the pucks in the game field and inside the robots’ own puck storage containers. These usually involved a few degrees of freedom, which require inverse kinematics to place the gripper in the correct location when performing these pick and place operations.
Simulated manipulation task using motion trajectories
- Low-level actuator controls: In both tasks above, there is a need for low-level control of actuators (whether electrical, pneumatic, or other). Designing actuator controllers often benefits from having a mathematical model. These models can be built using datasheets or by collecting response data from the hardware. The model can then be used to design and validate controllers. Brian Douglas describes this in detail in one of his videos on PID control.
Brian Douglas’ PID Tuning Guide [watch video]
The rules are evolving every year towards more actions requiring computer vision, so this was a topic of interest for most teams. However, the required computing power might be difficult to obtain in an embedded environment without cutting-edge technology – especially for deep learning. The good news is MATLAB and Simulink provide functionality and example anywhere between classic image processing and deep neural networks deployed on GPUs!
Below are two examples we were running during the competition. On the left is a color thresholding and blob detection algorithm deployed on a Raspberry Pi. On the right is a deep learning application running on a laptop with a GPU, which is detecting faces and classifying traits such as gender, age, and emotion.
Vision-based examples at our event booth
Strategy and Intelligence
Another challenge is developing the “brains” of the robot. Having 4 robots on such a small table, all with noisy sensors and actuators, can easily lead to traffic jams and other unexpected events. Some teams were able to do dynamic path planning that could recover from obstacles or other failures, as well as a real time adjustment of their strategy to take advantage of the 100 seconds in the match.
A key differentiator of good teams was building this intelligence as a closed-loop system – that is, one that responds to changes in the environment – rather than an open-loop sequence of predefined moves that is not robust to unplanned disturbances.
Stateflow can be helpful here as it can be used it as a high-level tool to implement and test the robot strategy. And as with other types of algorithms we talked about, one can generate standalone code from state machines and download them on hardware!
Simulated robot avoidance logic using Stateflow
To learn more about Stateflow, check out the following videos in order of complexity:
- Stateflow Quick Start for Student Competition Teams
- Testing state machines with simulation: Simulating Mobile Robots with MATLAB and Simulink
- Advanced modelling and logic: Programming Soccer Robot Behavior
Robotics competitions are a great opportunity to learn through project-based learning. They do not only require programming skills but also the following:
- Cross technical skills – these are crucial in highly integrated projects. Team members need to talk to each other to understand the interfaces between the different software modules of the robots. Also, software engineers need to know about hardware (mechanical and electronic), and vice versa.
- “Soft skills” – for example, project management and communication skills. Some of these robots are worth several thousand dollars and as the rules change every year, students need to find sponsors. Some teams even have people specialized in business relations or communications. They also need to create a poster to present the project. Below is one example.
Sample poster from Club Robot INSA Toulouse
How Can MathWorks Help?
MathWorks supports competitions like La Coupe de France de Robotique and Eurobot as we think that project-based learning is a good opportunity for students to understand how theory is used in real-world applications. We provide complimentary software licenses, so if your team is participating in these competitions and would like access to the tools, fill out our software request form.
I would also strongly suggest taking a look at the MATLAB and Simulink Robotics Arena video series. It gathers a lot of interesting videos and tutorials that can help you getting started with many aspects of robotics design using MATLAB and Simulink!
If you have any questions for us, feel free to leave us a comment or email us at firstname.lastname@example.org.
To leave a comment, please click here to sign in to your MathWorks Account or create a new one.