In today’s blog post Jose Avendano Arbelaez, who already blogged in the racing lounge will introduce you to a video series of training materials that will enable your team to get started with designing and simulating common mobile robotics algorithms in MATLAB and Simulink.
MathWorks supports many different types of student competitions. Students constantly impress us by building and programming cars, robots, boats, drones, and everything in between. One of the common trends in robotics competitions is that regardless of the hardware, designs often must complete tasks by themselves or autonomously. Knowledge of mobile robotics has transitioned from being an exclusive advantage to becoming an essential skillset. In real life, mobile robotics represents the building blocks of autonomous driving, swarm robotics, and industrial automation. To get started programming mobile robots, you have to understand some robot dynamics and how to pair them with suitable logic operations and sensors. These are exactly the types of lessons that you will find in the complimentary Mobile Robotics Online Training created by the MathWorks Student Competition team. Everything necessary to understand how to program robots to orient themselves, follow lines, avoid obstacles and transition between different modes of operation. Here is how we got to program a smart robot like the one below.
Sensor Signals – and what to do with these
Depending on the competition, you will be loading up your robot with a different variety of sensors. You will likely need to get a sense of the robot position so that you use reference points to navigate through a course or environment. When you move your robot with respect to its previous position in space, this is called dead reckoning. To perform dead reckoning you need to measure your displacement, and this often requires encoder sensors. These tell you how many rotations a motor shaft or a wheel has performed. This can really help to determine the robot’s position in space. Encoders can lead to odometry systems that will give you enough information to position your robot or navigate through reference points. Our student competitions mobile robotics training goes into detail on how to process encoder data to become useful odometry such as distanced traveled and robot orientation. Other common sensors are distance sensors, color sensors and line sensors. In a basic implementation, the information obtained from these sensors will be used in conjunction with logical statements to achieve some desired motion. Once you become a more advance roboticist you might also start using 3D scanners and lidars. Nevertheless, if you want to make sure your robot is efficient and accurate, your robot will need to make smarter choices than enclosing your decisions in IF and ELSE statements. This is where you might have heard the term “PID Controller” get tossed around in conversation.
The PID Controller – and why it is so popular.
Robots must handle changing conditions and dynamic environments, combine this uncertainty with sensor tolerances and the error derived makes it necessary to implement control theory to program your robot to improve the robustness and response time of your robot. PID stands for Proportional Integral and Derivative controller, and it is one of the most popular control approaches since it can achieve excellent results with some simple tuning. You will find this type of controller anywhere from machinery automation, aircraft control, and complex robotic systems such as humanoid robots. In fact, this type of controller is so versatile that it can be used for both low and high-level control of a system. All these applications make it incredibly important to make sure you understand the basics of this type of controller and build proficiency with its usage. In the student competitions training you will find an extensive video lesson walking you from how to setup PID algorithms according to your hardware and requirements, to the significance of each of the control parameters. To make it easier, the mobile robotics training is accompanied by the Mobile Robotics Training Toolbox which includes a robot simulator and sensors that enable you to immediately follow along with exercises and understand the effects on robot motion when implementing various types of control algorithms.
Combining Sensors and Controls to Close the Loop
Once you have mastered working with sensors and setting up controllers for basic robot behavior, you will find yourself having to piece together information and controller actions. Perhaps your robot needs to reach a location first, and then complete a task. Maybe it should also move to a different location afterwards. Conceptually it can become a little confusing how this sequence of events should unfold, it is always useful to draw diagrams to organize all the different actions. Stateflow is a great tool for prototyping complex robot behavior. It allows you to organize your logic and get instant debugging insight into your simulations. Take the obstacle detection example from the picture below, you can immediately relate the distance to an obstacle and the current execution state of the robot. Imagine piecing together multiple of these simple tasks, and suddenly being able to track the code executed in real-time becomes a great time saving tool.Once you have mastered working with sensors and setting up controllers for basic robot behavior, you will find yourself having to piece together information and controller actions. Perhaps your robot needs to reach a location first, and then complete a task. Maybe it should also move to a different location afterwards. Conceptually it can become a little confusing how this sequence of events should unfold, it is always useful to draw diagrams to organize all the different actions. Stateflow is a great tool for prototyping complex robot behavior. It allows you to organize your logic and get instant debugging insight into your simulations. Take the obstacle detection example from the picture below, you can immediately relate the distance to an obstacle and the current execution state of the robot. Imagine piecing together multiple of these simple tasks, and suddenly being able to track the code executed in real-time becomes a great time saving tool.
Stateflow is also a plug and play platform for any control algorithms that you develop using Simulink. It makes it seamless to call and integrate your PID algorithms to operate within the larger tasks that your robot should achieve. Specifically, if you want to get hands-on experience on how to piece together multiple tasks, the mobile robotics training has self-paced lessons that will not only explain how to implement Simulink models on both VEX and LEGO based robots, but also cover how to program control algorithms for common competition challenges such as:
- Dead reckoning
- Obstacle avoidance
- Line following
- Path navigation
- Combinations of all the above
Putting It All Together
Getting started programming mobile robots can be a daunting task. Making sure that you have the right knowledge and a wide array of tools at your disposal can make the difference between qualifying for a competition or even finishing up a robotics project on time. Make sure you understand the design of your robot and include the necessary sensors depending on the intent of your build. Use simulations to verify your programmed algorithms behave as intended before moving to a trial and error approach on your hardware. Take advantage of tried and true pre-packaged algorithms such as PID controllers to improve the performance of your robots. Make sure you can understand and implement proficiently all the above to save development time and rise to the top of competition rankings. You can always sign up for the complimentary mobile robotics training provided by the student competitions team. This can serve you both as a compliment to your current robotics skills and a place to get started with robot simulations, or as a starting point for untethering your robots from human input and remote controls.
Looking forward to seeing what type of robots you can unleash – let us know about your ideas!
To leave a comment, please click here to sign in to your MathWorks Account or create a new one.