MB1242 / Pixracer /Collision Prevention

Hello there,

Currently, I just apply the MB1242 sonar sensor on my drone for collision prevention of PX4. But, I met some wired flight behavior when I’m flying my drone.

The collision prevention mechanism is actually work, but when there are no any other object in the front of drone (like flying straight forward), the drone is somehow go and stop instead of moving directly smoothly. Besides, when I’m flying on any other direction such as backward, it doesn’t hanppen.

I have tested on both generic multicopter and standard VTOL airframe, both happened. The most wired things is that the log file show that the distance sensor doesn’t detect anythings or even detected but not enough to trigger the collision prevention.

So, I want to ask is there any parameter of configure could help me deal with this problem. Or the actual reason cause this happen (such as EMI, vibration or setup of sonar sensor).

The flight reviews and video are attached here for reference.

Any help is appreciated.


First, the sonar sensor and collision prevention settings are listed below:

  • There are only one sonar sensor mounted at the front of drone and facing forward.
  • The parameter modified
    • sensor sens_en_mb12xx
    • collision prevention: cp_dist = 1, cp_go_no_data = enabled, cp_guide_ang = 0 deg
    • ekf2_rng_aid = disabled
    • mpc_pos_mode = smooth position control.
  • All testing are in the position mode

The hardware and firmware I use are listed below.

Here, I connect the sonar sensor to the GPS component through the I2C bus and then connect the GPS to Pixracer through the indicated port (the sonar sensor is not connected to the flight controller directly)