SENS: SF45: Scale the measured distance with pitch and roll#24142
SENS: SF45: Scale the measured distance with pitch and roll#24142
Conversation
bresch
left a comment
There was a problem hiding this comment.
What about extracting this function to a library so we don't have 2 times the exact same implementation?
|
This would be an option, in the long run, i would move away from publishing the obstacle_distance from the sensor, and just publish each measurement with its orientation set as the quaternion, but for this we need a callback based collision prevention map logic, which it is currently not. If its worth it for the time inbetween i cant say, there you would probably know better. |
@bresch, what do you think? |
Now I see where all the hassle is coming from and I agree with you the driver should only publish data and there needs to be a central instance like an obstacle distance manager in CollisionPrevention taking care of maintaining fusion of different sensors, maintaining timeouts and similar. Let's go in steps. |
2b50b61 to
673d58d
Compare
🔎 FLASH Analysispx4_fmu-v5x [Total VM Diff: 96 byte (0 %)]px4_fmu-v6x [Total VM Diff: 80 byte (0 %)]Updated: 2025-01-20T09:45:32 |
src/drivers/distance_sensor/lightware_sf45_serial/lightware_sf45_serial.cpp
Outdated
Show resolved
Hide resolved
eab8e56 to
c850532
Compare
|
Flight tested today with SF45: https://review.px4.io/plot_app?log=8b0933c5-c941-4344-a32f-fea664dca00f No weird behaviour, everything working as expected. Also did a quick bench test with the lightware laser lidar (non rotating) to test that |
…acleMath library. New library created for static and/or repeated code across collision prevention and driver files.
Calls function from ObstacleMath library that accounts for the vehicle's attitude w.r.t the obstacle. Obstacles are assumed to be flat, vertical walls.
87b4d1c to
54f068a
Compare

To prevent oscillations caused by the coupling of pitch and roll, which increase the sensor's measured distance, we account for these effects by introducing scaling based on pitch and roll into the measurements. This adjustment ensures accurate collision prevention.
Issue was solved inside of collision prevention by @mahimayoga in #24107, whereby this implementation is aequivalent.
Pitch
Roll
Solution
Pitch
Roll
Test coverage