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

Add support for parsing CBAT message #24088

Draft
wants to merge 6 commits into
base: main
Choose a base branch
from

Conversation

sdomoszlai13
Copy link

@sdomoszlai13 sdomoszlai13 commented Dec 10, 2024

Adding support for parsing CUAV's CBAT message in order to read serial numbers of certain smart batteries (e.g. Tattu).

Solved Problem

When trying to read the serial number of a Tattu smart battery, I found that the battery sends a CBAT message that contains valuable info about it (e.g., the serial number) but isn't parsed currently in PX4. To get the info in the message, the pasing logic is added in this PR.

Fixes #{Github issue ID}

Solution

  • Add ... for ...
  • Refactor ...

Changelog Entry

For release notes:

Feature/Bugfix XYZ
New parameter: XYZ_Z
Documentation: Need to clarify page ... / done, read docs.px4.io/...

Alternatives

We could also ...

Test coverage

Context

Related links, screenshot before/after, video

@sdomoszlai13 sdomoszlai13 changed the title Copy callback function structure for parsing CBAT message Add support for parsing CBAT message Dec 10, 2024
#include <px4_platform_common/log.h>
#include <px4_platform_common/tasks.h>
#include <px4_platform_common/
#include <px4_platform_common/tasks.h>log.h>
Copy link
Author

Choose a reason for hiding this comment

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

Fix

bool connected # Whether or not a battery is connected, based on a voltage threshold
float32 voltage_v # Battery voltage in volts, 0 if unknown
float32 current_a # Battery current in amperes, -1 if unknown
float32 current_average_a # Battery current average in amperes (for FW average in level flight), -1 if unknown
float32 current_average_a # Battery current average in amperes (for FW average in level flight), -1 if unknown ?
Copy link
Author

Choose a reason for hiding this comment

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

Fix

uint16 max_error # max error, expected margin of error in % in the state-of-charge calculation with a range of 1 to 100%
uint8 id # ID number of a battery. Should be unique and consistent for the lifetime of a vehicle. 1-indexed.
uint16 interface_error # interface error counter
uint8 priority # Zero based priority is the connection on the Power Controller V1..Vn AKA BrickN-1 ?
Copy link
Author

Choose a reason for hiding this comment

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

Fix


float32[14] voltage_cell_v # Battery individual cell voltages, 0 if unknown
float32 max_cell_voltage_delta # Max difference between individual cell voltages

bool is_powering_off # Power off event imminent indication, false if unknown
bool is_required # Set if the battery is explicitly required before arming

uint8 MAX_INSTANCES = 4
Copy link
Author

Choose a reason for hiding this comment

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

Change to 3

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.

1 participant