-
Notifications
You must be signed in to change notification settings - Fork 13.5k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
SENS: SF45: Improved Datahandling and fixes #23918
base: main
Are you sure you want to change the base?
Conversation
acac357
to
7622b2a
Compare
@dirksavage88 Would be nice if you could also do a quick review. |
_obstacle_map_msg.max_distance = 5000; | ||
_obstacle_map_msg.angle_offset = 0; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This should be non-zero. There has to be some offset since the obstacle distance array element 0 starts and moves clockwise, however with an increment of 10 degrees there won't be coverage immediately to the left of the actual obstacle distance data
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It's a bit of a question on the definition of the angle offset.
as the original algorithm was the Vector Field Histogram, I assumed that the angle was also defined the same way, meaning the corresponding angle is in the centre of the bin.
Which would also make sense as on 1D distance sensor pointed to the front with a fov of zero, gets only mapped to the bin with index zero.
I mean, we can agree on a definition here, and then also properly document it in the message.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Maybe a better test of this is a 1D sensor 20 degree field of view sensor forward facing. If 20 degrees is split down the middle would the bins occupied be 0, 1 and 71, 72? (assuming 5 degree increment).
I guess this could be changed and defined to include that wrapping effect: the angle offset is super non-intuitive to most users, specifically to those implementing new drivers where there is sparse info on the sign of the angle and what it means.
It doesn't make a huge difference on the rotating lidars since the degree resolution is small, but would make a difference on 1D lidars with a significant field of view.
_obstacle_map_msg.angle_offset = 2.5; | ||
_obstacle_map_msg.min_distance = UINT16_MAX; | ||
_obstacle_map_msg.sensor_type = obstacle_distance_s::MAV_DISTANCE_SENSOR_LASER; | ||
_obstacle_map_msg.increment = 10; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There's some confusion as to how the resolution of collision prevention can be used. I think in collision prevention code it's assumed to be an increment of 10, however the obstacle distance array can support an increment set to a minimum of 5 deg for the "resolution", which works out to 360 degree resolution coverage wrapped in 72 bins (should be default imo).
This was probably done this way since the original collision prevention impl leveraged point-lidars and the point-sample resolution was in the 10's of degrees: https://discuss.px4.io/t/question-on-distances-array-in-obstacle-distance/12911
In the case of the SF45: https://support.lightware.co.za/sf45b/#/specs
TLDR; setting it to 10 is not taking full advantage of the sensor's resolution, and we should probably change it in collision prevention as well
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yea, as we discussed in the CP PR, let's switch here to 5° Degrees.
I also discussed with Matthias yesterday that if computation is not the limitation, it should also be possible to decrease the internal resolution to 1 deg, then we could publish distance_sensor messages with orientation set via the quaternion which would result in even better resolution. Maybe something to consider in the future if there is need for that.
2682f41
to
db67751
Compare
…nprevention changed the increment to be 5
db67751
to
45ec537
Compare
@@ -91,16 +94,12 @@ SF45LaserSerial::~SF45LaserSerial() | |||
|
|||
int SF45LaserSerial::init() | |||
{ | |||
|
|||
param_get(param_find("SF45_UPDATE_CFG"), &_update_rate); | |||
param_get(param_find("SF45_ORIENT_CFG"), &_orient_cfg); | |||
param_get(param_find("SF45_YAW_CFG"), &_yaw_cfg); | |||
|
|||
/* SF45/B (50M) */ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We can remove the "/* SF45/B (50M) */" comment now that the rangefinder min/max values are no longer relevant
0: Rotation upward | ||
1: Rotation downward | ||
24: Rotation upward | ||
25: Rotation downward |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I never actually had the chance to test these on the bench. The non-standard Yaw cfg as well.
Changes:
Moved to the MAV_SENSOR_ORIENTATION ENUM to be consistent with the orientations used in DistanceSensor.msg
Removed the publishing to distance_sensor.
The data in each bin is now the smallest measured value, and not the last measured value.
Added
obstacle_distance_fused
anddistance_sensor
to the loggedvision and avoidance
topicsChangelog Entry
For release notes:
Alternatives
for the distance sensor, we could also calculate a quaternion for each measurement, and then set the orientation quaternion, via that. Then we could remove the obstacle_distance publishing.
This would add some complexity in the driver here, but offload all data handling to Collision prevention.
As the obstacle_distance publishing was already in place, i opted to stay with this approach.
Relevant PR's
Test coverage