Student Lounge

Sharing technical and real-life examples of how students can use MATLAB and Simulink in their everyday projects #studentsuccess

Robot Programming Insights from VEX-U Competition Finalists

For this week’s blog post we have invited a VEX University team from the Technical University of Altamira in Mexico to share their journey towards becoming a national finalist for the VEX U Robotics competition. As always if you are a part of the VEX community and would like to use MATLAB and Simulink for your robots, please visit our VEX Robotics page or contact us at MathWorks is immensely proud of their achievements and we hope you also find their insights useful! With that, I will hand it over to Jeus Hiram Almiray and Manuel Alejandro Lopez from TAL Robotics.


Our university had been part of the VEX Robotics Competition – VEX University league for several years now, but for the last 2 years we decided to make several changes in our development process. One of these changes was using MATLAB & Simulink as our programming environment for the development of our robots. Throughout these last two years, our performance in the competition improved compared to past seasons. Using Simulink, we quickly developed a great amount of efficient autonomous and driver controllers for our robots, where each button was programmed to perform specific tasks. We found that using a model-based design approach greatly saved us programming and debugging time that we could then invest in improving other aspects of our designs to make our robots more competitive. In this blog, we will go over some of our robot designs and explain the tools we found useful to program different types of robot behaviors.

Our Team – TAL Robotics – Tecnológico de Altamira

photograph of team

TAL Robotics Team

At the start of the season, our team analyzed different strategies, mechanisms, motors, and sensor configurations we were interested in incorporating in our design. This helped us estimate the amount of effort required to finish the development of a competitive robot at least three weeks before the first season events. We started working in the 2019-2020 Tower Takeover season in September 2019 and became finalists at the VEX U Mexican National event in 2020. Our two robots were built by teams of 5 students each and the members had specific roles such as programming, designing, building, and driving. The teams also included a mix of students from different engineering disciplines.

Our Robot

Our first robot was a big 24x24x24 inch robot that started life as a double reverse four bar robot with pneumatic intake. The first robot’s main task was to collect 4 cubes at once, with the objective of stacking over the 15-inch tray robot’s towers in the alliance goal. Throughout the season the design changed to a 24-inch tray robot that was able to gather up to 12 cubes in the tray, and at its final form was composed of the following:

  • 6 Motors 200 rpm 1:1 Drivetrain
  • 1 Motor 100 rpm 1:5 Arm
  • 2 Motor 100 rpm 1.5:1 Intake rollers
  • 1 Motor 200 rpm 1:12 Tray
  • 1 Pneumatic piston Cube lock

photograph of robots

TAL Robotics 24in and 15in Robots

The aim of the robot was to balance power and efficiency; what we needed was to be able to pick up as much as we could without straining the engines too much.

Our second smaller robot was the 15x15x15 inch robot that both started and ended as a little tray robot. It was able to pick up 8 cubes and stack them in a corner without any problems. To be able to collect those cubes, at the beginning of every match it started as a perfect 15-inch cube and then expanded to reach its full-length real form. This robot was only made using the following:

  • 4 motor 200 rpm 1:1 Drive
  • 1 motor 200 rpm 1:12 Tray
  • 2 motor 200 rpm 1:1 Intake rollers

Robot Controls

The gamepad programming design for both the autonomous and driver control modes was an iterative prototype built using the VEX V5 support package for Simulink. These algorithms included all the autonomous and semi-autonomous behaviors that could be controlled by the driver.

Simulink model

Simulink Model for Driver Control

We implemented Stateflow charts to program task autonomy controlled by the gamepad buttons during the driver control period. The diagram-based approach in Stateflow made it easy to keep track of switching logic such as valve activation.

Stateflow screenshot

Stateflow Diagram for Arm Control

For the autonomous period of the competition, we also used Stateflow charts since they allowed us to easily program in wait times and transitions between consecutive functions. Using different operating states was useful when carrying out tasks continuously that consider dynamic conditions like the weight of the robot or sensors disturbances. In the end, avoiding writing long lines of code and instead organizing behaviors into diagrams made quite a difference in saving programming time and allowing us to be more competitive.

Stateflow screenshot

Sequential Autonomous Mode Algorithm in Stateflow

As we gained more experience using MATLAB, we changed our autonomous implementation to a MATLAB function block since we were programming mostly sequence of tasks without parallel algorithms. However, we kept the Stateflow charts for automating specific joystick tasks with switching behaviors. This is how we arrived at our final prototype that used the function block and a combination of cases to perform the tasks in a closed loop by using several sensors. The algorithm could detect the field conditions and decide on the next movement; the result was better performance in the autonomous part, completing the tasks in the time imposed on the competition.

Simulink and MATLAB screenshot

Autonomous Control Combining Simulink and MATLAB

As a summary, our autonomous routine consisted of collecting the largest number of cubes in less than 45 seconds and placing them on the designated part of the court. This is all handled by the MATLAB function block; closing the control loop using the position was a very important element to leave the blocks at the points assigned for the towers. The function block gave us a practical way of integrating our desired code while maintaining the real time execution we were looking for without adding any delays or lowering performance.

photograph of robot

Robot in action

The VEX-U Mexican Nationals

Finally, the day came where all the hours of hard work put into the robot—not only programming but also designing, building, and driving—were put to the test. We managed to win 9 out of 10 matches within the two days of competition. It was an indescribable feeling and all our efforts were able to place us proudly in the podium of the Mexican national championship at second place.

As a team, we worked together for a common goal helping each other and gaining experience along the process. In the end, we proved to be even more than a team, we became a family. Spending time together showed us that no matter what, we could face any obstacle placed in front of us, with good communication and listening from all team members. The perfect word that described our team was “enjoyment.” Always enjoy the moment one hundred percent, that is how we are, and our team always learnt from all experiences, either good or bad.

In our eyes, the VEX-U final and overall the whole competition was just a lot of fun. We stepped together through all the competition cycles enjoying the experience and being proud of our work, and we hope you will as well.

– Tecnológico de Altamira – VEX University Team – Jeus Hiram Almiray Hernández – Manuel Alejandro Lopez Flores

photograph of robot

  • print


To leave a comment, please click here to sign in to your MathWorks Account or create a new one.