-
Notifications
You must be signed in to change notification settings - Fork 13.2k
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
Optionally disable SF1xx sensor in forward flight #22369
Conversation
d89e024
to
5cf1d55
Compare
5cf1d55
to
066db11
Compare
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 have two general questions:
- Is it worth to schedule a separate module just to read a parameter and based on its value and the VTOL state publish a completely separate message?
- Do we have a use case and can distinguish all these frequencies
"radio", "microwave", "IR", "light", "UV"
?
I'm asking because that's a lot of overhead to optionally stop distance sensors (or radios?) in fast-forward flight. I would just condense the class into a library that specifically does the required logic and use it in the driver that supports the functionality. This to avoid consuming resources for module, message, strings, second parameter. I'm happy to discuss.
I was going for a more holistic solution rather than a specific patch, since I wanted to decouple the state detection (VTOL<->forward flight) from the actual restriction, so that it is easier to extend to other states and drivers as well.
No, currently only IR restrictions are implemented. I can remove the rest if you want. However, I think this mask is a good starting point for future expansion. I don't really see how disabling IR, but not light emissions, is going to be useful for example.
I wanted the emcon module to be optional via Kconfig, I wasn't sure how to do that for libraries (just… not depend on them? but how do I configure that then?).
Yes, therefore I used the macros to remove the uORB subscription from the drivers when the EMCON module is not used. Resource Usage with these changes:
Resource Usage with these changes, but
(2057265 - 2057225 = 40B increase) Resource Usage without these changes:
so a 2060213 - 2057225 = 2988B flash increase. Not that great. |
066db11
to
3c3bcb6
Compare
I've quickly moved the emission control logic into the driver itself just to see how much overhead it is at minimum.
So minimum overhead is 2057633 - 2057225 = 408B. If you like this more, then I can polish and test it. |
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.
Yes, thank you! That's much better in my eyes. I know it's conceptually not future proof but I'd build out the more generic approach as soon as there are use cases. Sorry for that. Be sure to run make format
and possibly add the pre-commit hook for style checks.
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
3c3bcb6
to
710d7cf
Compare
710d7cf
to
1d7135e
Compare
Ok, now this solution is also tested and formatted properly. |
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.
Some nit-picking. Otherwise it looks good.
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
src/drivers/distance_sensor/lightware_laser_i2c/lightware_laser_i2c.cpp
Outdated
Show resolved
Hide resolved
d8a5031
to
491379c
Compare
Updated |
0f72268
to
851a086
Compare
Unfortunately I didn't find a camera without an IR filter for 900nm, but I did add the laser control command to turn off the laser. I tested this by allowing the collection to continue while the laser is disabled to check the return value, which was -1 when the laser was disabled.
|
851a086
to
1196930
Compare
1196930
to
e101473
Compare
Adds a parameter
SF1XX_MODE
that controls if the SF1xx distance sensor will disable automatically in forward flight after a commander transition.Test coverage
Tested in hardware via NSH commands
commander transition
andparam set
.Context
Example Behavior
Changelog Entry
For release notes: