How to Solve Robotics Assignments Using MATLAB to Build a Stair-Climbing and Shoot Targets
Building a robot that can climb stairs and accurately hit targets is not just an exciting engineering challenge—it’s also a great opportunity for learners to apply their knowledge and complete their robotics assignment with a hands-on, real-world approach. In this blog, we explore the journey of a university team that participated in the prestigious 2023 Robocon event. Their task involved designing and building two cooperative robots—a Rabbit and an Elephant—that could work together to throw colored rings into poles positioned throughout a challenging arena filled with slopes, steps, and other obstacles.
To meet the competition requirements and solve complex design problems, the team relied heavily on MATLAB and Simulink. These tools enabled them to model mechanical systems, simulate dynamic movements, and validate their design concepts virtually before building the physical robots. They used physical modelling for motion analysis, developed a shooting mechanism, and even trained a deep learning model using computer vision for accurate target detection. This integrated approach not only helped them create a functional and efficient robot but also allowed them to fulfill the core learning objectives and complete their robotics assignment with confidence, precision, and innovation—bridging the gap between classroom theory and real-world application.
Introduction to the Challenge
The theme of the competition was “Casting Flowers over Angkor Wat,” a symbolic representation that required two robots, named the Rabbit and the Elephant, to work together and throw colored rings into poles distributed throughout an arena. This required not only a strong understanding of mechanical design but also intelligent control systems, real-time vision processing, and physical modelling. With limited time and resources, the students needed to simulate most of their ideas virtually before fabricating the hardware, and this is where MATLAB and Simulink played a key role.
Physical Modelling and Simulation in MATLAB
The team began with physical modelling to better understand and predict how the components of the robots would behave under different operating conditions. Using Simulink along with Simscape Multibody, they could simulate joint motions, contact forces, dynamics, and control in a virtual environment. For instance, modelling the ring and its interaction with the shooter required accurate physical parameters like mass, shape, and moment of inertia. These parameters were calculated from real-world prototypes and entered into the simulation to match the real behavior as closely as possible.
The ring itself was modelled using a revolved solid block, where the cross-section of the ring was defined as a square. By revolving the profile 360 degrees, a complete ring shape was created. This model was essential for studying the contact dynamics between the ring and the shooting mechanism. The team manually entered the dimensions and inertia properties into the Simscape blocks, enabling precise motion simulation when the ring was pushed or thrown by the robot.
Modelling the Shooting Mechanism
The ring-shooting mechanism was one of the most critical parts of the robot. It consisted of a hollow aluminium square section connected to a rotating shaft powered by a motor. When the motor activated, the rotating shaft would strike the ring placed on a guideway and launch it toward the pole. This system had to be fine-tuned to ensure the ring's trajectory and force were just right.
Through MATLAB, the team conducted various simulations to understand how different link lengths, positions, and ring placements influenced the shooting accuracy. Each simulation gave insights into how minor adjustments affected the results, and eventually, an optimal configuration was identified. Once the simulations showed promising outcomes, this design was manufactured and tested, leading to consistent and precise shooting during the actual competition.
Torque Calculation for Shooting
Calculating the torque required for the shooting motor was another interesting application of MATLAB. Using physics-based equations and energy conservation principles, the students computed the necessary angular velocity and torque values. They began with known values such as the distance to the target (4 meters), height difference (1.2 meters), and a shooting angle of 45 degrees. Using equations of projectile motion, they calculated the ring’s required velocity and time of flight. With these values, the angular velocity of the rotating arm was derived, and from there, torque was estimated using the moment of inertia and angular acceleration.
To ensure reliability, a factor of safety was applied, and the final torque value was converted into units appropriate for motor selection. This ensured the motor could operate under load conditions with consistent performance.
Designing the Robot in Simulink
The Elephant and Rabbit robots were initially designed using SolidWorks. However, importing complex models directly into MATLAB and Simulink can sometimes cause issues with part alignment or performance. To solve this, the students created simplified CAD versions of their robots, focusing only on essential components needed for simulation. These simplified models were exported as STEP files or XML and then imported into Simulink using the smimport function.
The use of simplified models improved simulation speed and allowed the team to perform accurate dynamic analysis. The resulting simulations gave them confidence in the robot’s mechanical design and ensured that all parts would move correctly when actuated by motors and sensors.
Modelling the Bridge Climbing Mechanism
A major challenge in the robot’s design was enabling it to climb a sloped bridge without losing stability. The center of mass for most robots is usually above the ground, which raises the risk of toppling when climbing an incline. To solve this, a detailed physical model of the slope was created in Simulink. The students simulated the climbing action to check if the robot could maintain balance while moving upward.
Through multiple iterations, the team adjusted the robot’s wheel placement, weight distribution, and chassis angle to improve stability. These simulations helped them identify configurations that minimized the risk of tipping and ensured smooth, stable climbing during the actual contest.
Simulating Step Climbing
Just like slopes, steps posed another mobility challenge. The robot needed to handle sudden height changes without external support. A step-climbing model was developed in Simulink to study how the robot interacted with a step’s edge and how its wheels responded. The simulation allowed the team to refine wheel size, motor torque, and the shape of the robot’s underbody to avoid getting stuck or losing grip.
After evaluating multiple configurations, they achieved a stable setup that allowed the robot to climb small steps effectively. This part of the simulation ensured that no part of the robot would snag or get damaged while transitioning across different surfaces.
Pole Detection Using YOLOv2 and Computer Vision
Accurate pole detection was essential for successful ring throwing. The Rabbit robot needed to align precisely with the poles before launching the ring. For this, the team used computer vision and deep learning. They trained a custom object detector using YOLOv2 (You Only Look Once version 2), which offers fast and accurate real-time detection capabilities.
To begin, they captured 800 images of the poles from different angles and lighting conditions to create a diverse dataset. These images were annotated manually using the Image Labeler app in MATLAB. Since YOLOv2 requires uniform input dimensions, all images were resized to 244x244 pixels.
The object detection network was built by combining a ResNet-50 architecture for feature extraction with YOLO’s detection layers. Parameters like input size, number of classes (in this case, just the pole), and anchor boxes were carefully configured to match the dataset. Data augmentation techniques such as contrast adjustment and brightness tuning were also used to improve model generalization.
Training and Deploying the Detector
Training the YOLOv2 detector involved setting batch size, learning rate, and number of epochs. Once the training was complete, the model was evaluated using the average precision metric. The detector achieved a precision score of 0.91, indicating high reliability in detecting poles across varying scenes.
To make the detection system functional in real-time, the model was deployed onto an Nvidia Jetson Nano device. This allowed the Rabbit robot to run the object detection algorithm on the go. The robot could now automatically locate the pole, align itself accurately, and increase the probability of a successful ring throw.
Final Results and Performance
The successful modelling and simulation efforts paid off in the competition. The robots functioned as intended, showing stable movement on slopes, successful step climbing, and accurate ring shooting. The YOLOv2-based vision system worked reliably during live matches, contributing significantly to the team’s success.
One of the key innovations was the creative use of Simulink to simulate physical systems that did not have direct equivalents in Simscape. For example, the ring was not natively available in the Simscape library, but the students managed to replicate its behavior using a custom revolved block.
Their ability to simulate and validate designs before manufacturing not only saved time but also improved reliability. Whether it was tweaking a motor, adjusting a robot’s weight distribution, or aligning vision detection with actuation, MATLAB provided the platform to test and refine every part of the system.
Future Opportunities in Robotics with MATLAB
This project highlights the enormous potential of MATLAB and Simulink in academic robotics. Students can go far beyond just modelling—they can design control systems, integrate sensors, apply AI techniques, and even simulate entire multi-robot systems. As computing power continues to grow and embedded systems become more affordable, combining MATLAB with hardware like Jetson Nano opens doors to even more complex applications like autonomous navigation, simultaneous localization and mapping (SLAM), and multi-object tracking.
Students participating in such competitions not only gain hands-on experience in robotics but also strengthen their collaboration and problem-solving skills. With each iteration, they build systems that are more robust, intelligent, and aligned with real-world engineering needs.
Conclusion
Designing a robot that can climb stairs and shoot targets with precision is a complex engineering task that requires a combination of mechanical design, control systems, and real-time data analysis. Using tools like MATLAB and Simulink, learners can go far beyond basic theory and develop fully functional, simulation-based models that mirror real-world performance. From modelling mechanical components to integrating sensors and applying deep learning for object detection, each phase of the process plays a crucial role in building a robot that performs reliably—even under competition-level pressure.
One of the major advantages of using MATLAB for such projects is its ability to simulate complex behaviors before any physical prototype is built. This not only saves time and resources but also enables students to experiment with multiple configurations, analyze outcomes, and optimize their designs systematically. When learners are tasked with similar real-world challenges in class, having worked on such projects gives them a significant edge in being able to complete their MATLAB assignment with greater confidence and accuracy. Ultimately, this type of robotics project demonstrates how academic learning and practical simulation tools like MATLAB can come together to create impactful solutions—preparing aspiring engineers to take on real-world automation and robotics challenges with innovation and precision.