Dive into the Water: Design a PX4 based Underwater Robot with MATLAB
In today’s post, Liping from the Student programs team will share how a student team used MATLAB and the PX4 platform to design an underwater robot and won the China Graduate Electronic Design Contest (GEDC) in 2022. Over to you, Liping…
As a judge of the MathWorks awards in GEDC, one of the most famous competitions for graduate students in China, I was happy to see a lot of innovative work from students every year.
Last year, among more than 900 entries, I was very impressed by the work of a team from Southwest Petroleum University, where three graduate students Yujie Huang, Lixiao Liu, and Youwen Zhang used MATLAB to design and develop an underwater robot, and won the 1st prize of the MathWorks Awards in GEDC 2022. Let us see how their robot works.
What a fantastic underwater robot, right? It has a new type of vectorial propulsion system composed of three spherical magnetic coupling vector thrusters. The team used MATLAB for algorithm simulation and development. Let us see the details of their work!
Algorithm design
Traditional underwater robots usually use multiple fixed thrusters to achieve multi-Degree-of-Freedom (DOF) propulsion. Compared with fixed thrusters, vector thrusters have the advantages of more degrees of freedom, less parasitic thrust, and higher efficiency.
However, with multiple vector thrusters, how to set up the thrusters’ layout and allocate the desired thrust among the thrusters should be well designed.
To find a proper configuration of the thrusters’ layout so that the maximum 6-DoF decoupled generalized thrust can be achieved, the team designed a genetic-based algorithm to optimize the installation positions and the angles of the three vector thrusters as follows.
Architecture of the Thrusters’ Layout Configuration Algorithm
With the optimal thrusters’ layout, the next problem is how to allocate the desired 6-DOF generalized thrust to the three reconfigurable thrusters.
The team formalized the problem into a convex optimization problem where the objective is to minimize the sum of the error and the energy consumption considering the optimal thrusters’ layout and the angle and the thrust limits of the magnetically coupled thrusters. They used the traditional Lagrange method to solve the problem and find the optimal control allocation in real-time.
Convex Optimization for Control allocation
For motion control, the team used the backstepping method on the horizontal plane to stabilize the tracking error based on the Lyapunov function, and the PID algorithm to control the depth on the vertical plane. Moreover, they used the RBF network to compensate for the saturation output of the vector thrusters.
Simulation
The team implemented the algorithms in MATLAB and built Simulink models for simulations, so the team can tune, test, and verify the designed algorithms without doing experiments on a prototype, thus saving time and cost. The Simulink model they built consists of three main modules: controller, control allocation, and robot dynamics.
Simulink model of the Underwater Robot
Each module was built with models provided by the Simulink Library and a few handwritten MATLAB functions. For instance, the following figure shows their robot dynamic model in Simulink.
Robot Dynamics in Simulink
The following figure shows the result from the Trajectory Tracking simulation, where you can see the Backstepping Control Algorithm works very well.
Result of Trajectory Tracking Simulation
Development
Then the team developed the underwater robot with a modular and bus-based design, where they used the Holybro Pixhawk 4, an open-source hardware based on the Pixhawk FMUv5 project as the communication and control computing platform.
Modular and Bus-based design of the Underwater Robot
PX4 is an open-source platform that is widely used for developing autonomous systems, especially drones. It was initially developed by Lorenz Meier in 2011 and has grown into a large open-source community now.
The team used the MATLAB coder to automatically generate the control allocation algorithm into C code and then deployed the code to the PX4 controller with slight changes. Code generation using the MATLAB coder saved their developing time and effort.
Experiment
Finally, the team did some experiments to test the performance of the prototype. The following figure shows the result of an experiment when the underwater robot was set to autonomously track a trajectory in a pool.
Result from a Trajectory Tracking Experiment
Due to their innovative design and productive results, the team won not only the 1st prize of the MathWorks Awards but also the overall 2nd prize in GEDC 2022! Congratulations to the team members, and also their tutor Associate Professor Yu Wang from Southwest Petroleum University in China!
To help the team promote their excellent work, we invited them to present the underwater robot in CN MATLAB EXPO 2023 EDU Demo Booth, which was held in Beijing on June 8th, 2023. During the event, they received a lot of interest and praise from the participants from the academy and the industry.
Team Presented the Robot in CN MATLAB EXPO
For future work, the team could learn more about the UAV Toolbox Support Package for PX4® Autopilots. With the support package, they can directly access autopilot peripherals from MATLAB and Simulink. With the support package and the Embedded Coder, they can automatically generate C/C++ code and use the PX4 toolchain to build and deploy algorithms tailored specifically for not only Pixhawk but also Pixracer Flight Management Units (FMUs). This will help them adopt Model-Based Design, an advanced development workflow that is widely used in the industry, to achieve a more efficient design and deployment in the future.
Finally, wish the students’ experience, knowledge, and MATLAB skills would help them have a brilliant future! Look forward to more outstanding entries in GEDC 2023!
- カテゴリ:
- Code Generation,
- MATLAB,
- Robotics
コメント
コメントを残すには、ここ をクリックして MathWorks アカウントにサインインするか新しい MathWorks アカウントを作成します。