How can I read the rotor velocities in the PX4 read block in Simulink?
11 vues (au cours des 30 derniers jours)
Afficher commentaires plus anciens
Salvatore Matteo Mennea
le 16 Mai 2023
Modifié(e) : Salvatore Matteo Mennea
le 23 Mai 2023
I'm developing an open loop system for a quadrotor in Simulink using PX4 toolbox, simulating on jMAVsim. I'm injecting the rotor velocities and I have to read and plot the vehicle odometry(positions,velocities,euler angles etc...). I'm doing this thanks to the PX4 read block on the vehicle_odometry message that contains all this info, but I do not know how to read the rotor velocities in order to check if they are equals to the injected ones. How can I do? Which message do I have to use?
2 commentaires
Arun Mathamkode
le 23 Mai 2023
Can you please clarify how are you injecting the rotor velocities ? Are you using any uORB write blocks?
Réponse acceptée
Shaik
le 16 Mai 2023
Hi Salvatore,
To read the rotor velocities of a quadrotor in PX4 using the PX4 toolbox in Simulink, you can use the vehicle_motor_speed message. This message provides information about the motor speeds or rotor velocities of the quadrotor.
Here's how you can read and plot the rotor velocities using the PX4 toolbox:
- Add a PX4 read block to your Simulink model.
- Configure the PX4 read block to use the vehicle_motor_speed message type.
- Connect the output of the PX4 read block to a MATLAB Function block or a Scope block.
- Inside the MATLAB Function block, you can access the rotor velocities by using the output signal of the PX4 read block.
- To plot the rotor velocities, you can use the MATLAB plotting functions, such as plot or stairs.
Here's an example of how the Simulink model could be structured:
+------------------+
| PX4 Read Block |
+------------------+
|
| vehicle_motor_speed
|
+------------------+
| MATLAB Func |
+------------------+
|
| rotor_velocities
|
+------------------+
| Scope Block |
+------------------+
function rotorVelocities = fcn(vehicle_motor_speed)
% Read rotor velocities
rotorVelocities = vehicle_motor_speed.RPMs;
end
Plus de réponses (0)
Voir également
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!