Skip to content
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

SITL: add System Power Simulator to simulate SystemPower.msg #24138

Open
wants to merge 3 commits into
base: main
Choose a base branch
from

Conversation

sfuhrer
Copy link
Contributor

@sfuhrer sfuhrer commented Dec 19, 2024

Solved Problem

I got annoyed that every time I want to test something battery related, I have to manually unset CBRK_SUPPLY_CHK - which is set by default for all SITLs due to us not simulating the SystemPower.msg.

Solution

Add new module (only sim) to simulate and publish SystemPower.msg. Doesn't do anything fancy atm, just sends "all good" such that Commander doesn't freak out also without CBRK_SUPPLY_CHK set.
Maybe there would have been a more light-weight solution than adding a whole new module, but it's also nice to have the system_power simulation on the same level as the sensors (in the end it's also just a sensor)

Changelog Entry

For release notes:

Feature: SITL: add System Power Simulator to simulate SystemPower.msg

Alternatives

I find it wrong that CBRK_SUPPLY_CHK does two things: set if you don't care about battery info AND about system power. Given that they have different sources (different sensors) I would propose splitting it up. And then we could for all our SITLs set it such that "don't care about system power, do care about battery info".

The simulated battery is published by the regular battery class.

Signed-off-by: Silvan Fuhrer <[email protected]>
This allows us to run battery failsafe tests again in SITL
wihtout having to change params first.

Signed-off-by: Silvan Fuhrer <[email protected]>
@sfuhrer sfuhrer requested review from dagar and MaEtUgR December 19, 2024 19:46
Copy link
Member

@MaEtUgR MaEtUgR left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice! That also annoyed me recently and I feel guilty because I added back the battery under the power circuit breaker. It was in there but I think the system power checks were skipped hardcoded before which was good to remove.

I find it wrong that CBRK_SUPPLY_CHK does two things: set if you don't care about battery info AND about system power.

I totally agree, that's why I planned to split the circuit breakers instead of simulating the system power topic 🏃

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants