How can I read the rotor velocities in the PX4 read block in Simulink?
11 次查看(过去 30 天)
显示 更早的评论
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 个评论
Arun Mathamkode
2023-5-23
Can you please clarify how are you injecting the rotor velocities ? Are you using any uORB write blocks?
采纳的回答
Shaik
2023-5-16
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
更多回答(0 个)
另请参阅
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!