-
Notifications
You must be signed in to change notification settings - Fork 13.6k
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. |
src/drivers/distance_sensor/lightware_sf45_serial/lightware_sf45_serial.cpp
Outdated
Show resolved
Hide resolved
src/drivers/distance_sensor/lightware_sf45_serial/lightware_sf45_serial.cpp
Outdated
Show resolved
Hide resolved
2682f41
to
db67751
Compare
db67751
to
45ec537
Compare
src/drivers/distance_sensor/lightware_sf45_serial/lightware_sf45_serial.cpp
Outdated
Show resolved
Hide resolved
@dirksavage88 |
1f97fe4
to
1e9801d
Compare
🔎 FLASH Analysispx4_fmu-v5x [Total VM Diff: 64 byte (0 %)]
px4_fmu-v6x [Total VM Diff: 56 byte (0 %)]
Updated: 2024-12-13T12:28:50 |
@Claudio-Chies these changes look good, but I have not had a chance to test on the sensor. Also I am not an approving reviewer. Maybe @alexcekay would be willing to since he has looked through this code before. |
another issue i found, which i'll fix in the next commit.
|
Screencast.from.11-22-2024.11.25.34.AM.webmAttached we can see a replay of a log, with low and high angle set to -130, 130 respectively, and at 100hz. |
5151174
to
7f7a4c5
Compare
FLASH Analysispx4_fmu-v5x
px4_fmu-v6x
|
src/drivers/distance_sensor/lightware_sf45_serial/lightware_sf45_serial.cpp
Outdated
Show resolved
Hide resolved
src/drivers/distance_sensor/lightware_sf45_serial/lightware_sf45_serial.cpp
Outdated
Show resolved
Hide resolved
src/drivers/distance_sensor/lightware_sf45_serial/lightware_sf45_serial.cpp
Outdated
Show resolved
Hide resolved
7f7a4c5
to
9b40da5
Compare
1d4dcbf
to
457e67c
Compare
Due to some reports of the driver not starting up in some cases and the update rate being too slow, I have made the following changes:
I did test the changes on the bench
It would be great to test the changes in the field. |
src/drivers/distance_sensor/lightware_sf45_serial/lightware_sf45_serial.cpp
Outdated
Show resolved
Hide resolved
4f757bf
to
5038d17
Compare
Ok, so after having quite some issues with data not getting properly into the collision prevention obstacle map, i figured out the issue is that collision prevention has a sampling rate compared to this driver, causing messages to get lost, and by this some sectors would remain empty. |
Was the SF45 update rate too fast for collision prevention ? I'm also working on an offboard-based ST Lidar array (4 i2c sensors) that publishes over microdds to /fmu/in/obstacle_distance and was experimenting with having each sensor be it's own publisher to the obstacle distance array, and how each sensor publishes to a specific set of bins on the obstacle array (for only it's specific zonal coverage), but not sure if collision prevention can handle the varying bin-filled obstacle messages (depending on the timing and each sensor's FoV) |
I think this is generally a good solution. Because now there is a lot of logic in the sensor (like the timeout logic for the obstacle map) that will most likely be needed by any kind of rotating LIDAR that wants to publish an obstacle map. From my point of view, the whole obstacle map is not really directly usable with a rotating LIDAR. There it might be better to publish the obstacle map directly with only one array entry updated (as before) and have some intermediate module that builds a usable obstacle map for collision detection (and other modules that might need it as input). Or use the DistanceSensor message and its quaternion |
@alexcekay yes, I absolutely agree, some module which updates the internal map of collision prevention which gets called based on new measurements would be ideal, then sending the SF45 Data as Distance_Sensor messages would be the perfect solution. |
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.
Looks generally very clean and reasonable.
Would appreciate if you could update the PR description. I think it's quite outdated, especially with Alex's contributions. Including the release note section.
src/drivers/distance_sensor/lightware_sf45_serial/lightware_sf45_serial_main.cpp
Outdated
Show resolved
Hide resolved
} else { | ||
_parsed_state = 3; | ||
while (restart_flag != true) { | ||
switch (_parsed_state) { |
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.
Could _parsed_state be an enum?
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.
@alexcekay could you maybe help here? I'm not sure what the different states actually are
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.
Parsed state could be an enum yes. The different states are really the different fields of the sf45 packet that px4 receives and performs a crc on the bytes in each field and processes the data bytes in the payload field field (the raw data bytes, which includes distance and direction)
E.g.:
Header | Payload | Checksum
| Start | Flags Low | Flags High | ID | Data 0 .. N | CRC Low | CRC High
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.
@dirksavage88 could you quickly the latest commit to check if that is how you meant bfcb08d
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.
Hi @Claudio-Chies, just a quick note:
This expression SF45_PARSED_STATE::FLG_LOW;
and the similar ones are not assignements, they basically do nothing. You need something of the following type: _parsed_state = <xyz>
, when you want to modify the parsed state.
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.
Ups, that was a Find and Replace mistake... pushed the commit with the fix
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.
The enum looks correct
src/drivers/distance_sensor/lightware_sf45_serial/lightware_sf45_serial.cpp
Outdated
Show resolved
Hide resolved
src/drivers/distance_sensor/lightware_sf45_serial/lightware_sf45_serial.cpp
Outdated
Show resolved
Hide resolved
src/drivers/distance_sensor/lightware_sf45_serial/lightware_sf45_serial.cpp
Show resolved
Hide resolved
src/drivers/distance_sensor/lightware_sf45_serial/lightware_sf45_serial.hpp
Outdated
Show resolved
Hide resolved
bfcb08d
to
34cb900
Compare
… to a publishing per sector design. other minor improvements
…ential out-of-bound access
34cb900
to
cda36c0
Compare
…er, use nonblocking reads
…the lower loop time of CollisionPrevention
cda36c0
to
4eaf27f
Compare
General Improvement to the Sampling Rate and the Data handling of the Driver.
Basic Structure
We updated the internal logic as follows:
Other notable changes:
Important note
During testing we came across some power issues, if you are having boot up issues, make sure to power the Sensor separately. And/or shorten the shipped cable. See docs for more info.
Changelog Entry
For release notes:
Relevant PR's
Test coverage
Note:
If there is a move towards a callback based internal obstacle map in collision prevention, then it would be best to publish a distance_sensor message instead of a obstacle_distance one.
here is a branch where this is already implemented:
https://github.com/PX4/PX4-Autopilot/tree/SF45-Rangefinder_approach