Problem of MC Rate Controller sampling rate

Hello, I’m conducting research on quadcopter using pixhawk Cube Yellow.
Before the flight test, a preliminary check was performed using SiTL (px4_sitl), and it was confirmed that the rate controller operates at 250 Hz.
A flight test was conducted based on this information, but as a result of checking from the log, the rate controller operated at 750 Hz.

So, i have some questions.

  1. According to the px4 user guide, the rate controller appears to operate at 1kHz. Is the above result normal and what’s different? (Controller Diagrams | PX4 User Guide)

  2. Do SiTl and HiTL interact with gazebo and affect the rate controller sampling rate?

  3. To change the controller’s sampling rate, do I need to modify the PX4 code or gazebo?

1 Like

Hi were you able to change the controller’s sampling rate in SITL? i’m stuck with that

In SITL, due to the LockStep, i could not change the controller’s sampling rate.

So, i changed the setting to <enable_lockstep>false</enable_lockstep> in the sdf file.
Then changed the simulation’s sampling time with <max_step_size> and <real_time_update_rate>,
in my case, 0.001sec and 1000 Hz respectively.

lastly, edit rcS file in path ROMFS.
i could change the controller’s sampling time set “param set IMU_GYRO_RATEMAX 0”
“IMU_GYRO_RATEMAX 0” allows the controller’s sampling time to be updated with the simulation sampling time.
for example, if you change the controller’s sampling time to 0.025sec,
set “param set IMU_GYRO_RATEMAX 400”

I don’t know that this procedure is proper, but i can solve some problems

i hope this helps you.

1 Like

Thanks a lot for the answer, i’m able to run the simulation faster disabling the lockstep ,however i’m not sure that this is a proper solution since the lockstep technique guaranties that the simulation and px4 time are the same and works synchronized .
Are you sure that keeping the lockstep there is no way to run the controller faster?