Conversation
bresch
left a comment
There was a problem hiding this comment.
This looks ok, but there is a more efficient way to do this without passing by euler angles. You can compensate for a tilt by taking the last element of
PX4-Autopilot/src/lib/matrix/matrix/Quaternion.hpp
Lines 521 to 541 in 4db55cd
Thanks! I am having a look now, but it's not intuitive to me how I could use this. I don't know if I am misinterpreting it but: Say I have a forward facing sensor, and I compute the quaternion of the rotated sensor (from the vehicle attitude) w.r.t the initial vehicle frame (FRD). Then taking the last element of |
🔎 FLASH Analysispx4_fmu-v5x [Total VM Diff: -88 byte (-0 %)]px4_fmu-v6x [Total VM Diff: -96 byte (-0 %)]Updated: 2024-12-20T13:33:24 |
|
https://review.px4.io/plot_app?log=777e5193-7f40-40f5-a52d-d4f6fb519eba Log for flight test today with 45 degree mounted sensor, everything seems to work fine, no weird behaviour. @bresch is this ok to merge into main? |
src/drivers/distance_sensor/lightware_laser_i2c/lightware_laser_i2c.cpp
Outdated
Show resolved
Hide resolved
src/drivers/distance_sensor/lightware_laser_i2c/lightware_laser_i2c.cpp
Outdated
Show resolved
Hide resolved
src/drivers/distance_sensor/lightware_laser_i2c/lightware_laser_i2c.cpp
Outdated
Show resolved
Hide resolved
|
…or varying sensor orientations (PX4#24107)


Solved Problem
Scaling of distance_reading to an obstacle was done under the assumption that the sensor was always mounted facing forward, so distance_reading was only scaled for pitch.
Solution
Orientation of sensor w.r.t vehicle body frame is taken into account, and the relevant vehicle attitude angles (pitch and/or roll) are used to scale the outputted distance.
Changelog Entry
For release notes:
Alternatives
We could also ...
Test coverage
Simulation/hardware testing logs: (Indoor, giving pitch/roll input manually for different sensor orientations @ fixed distance to flat wall)
Front facing:


Left facing (270 deg):
Roll scaling not super accurate in the 45deg case, probably because the placement of the sensor wasn't very exact. Can see it works well in the Left facing scenario.