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

AP_RPM: Allow more instances #24645

Merged
merged 1 commit into from
Aug 10, 2024

Conversation

magicrub
Copy link
Contributor

@magicrub magicrub commented Aug 15, 2023

Allow AP_RPM instances RPM_MAX_INSTANCES up to 9

@IamPete1
Copy link
Member

We really should move to instance logging.

@magicrub
Copy link
Contributor Author

We really should move to instance logging.

What do you mean?

@IamPete1
Copy link
Member

What do you mean?

We currently log the first two instances in a single message, we should move to a log with a instance number and also log health.

const struct log_RPM pkt{
LOG_PACKET_HEADER_INIT(LOG_RPM_MSG),
time_us : AP_HAL::micros64(),
rpm1 : rpm1,
rpm2 : rpm2
};

Currently this adds the new inertances, but there not logged and not sent back over MAVLink, so there fairly pointless.

@magicrub
Copy link
Contributor Author

@IamPete1 oh, right. Of course. Well, they're not useless if they're feeding other libraries. I'm not sure if I should adding the logging in this PR or a follow-up. What do you think? It will obviously require some refactoring and such which is quasi-out-of-scope. I'm happy to make follow-up PRs for it. Less excited about rolling it into this one

@magicrub
Copy link
Contributor Author

I initially had a need for this on a periph but now 2 instances are OK. So, other than that no else has asked for this to my knowledge so I'm ok closing it. However, it's still potentially useful for future stuff and follows the pattern of other libraries. Just need to figure out the logging bit of it but in the case of a periph then the usefulness of implementing logging is questionable anyway.

I'll tag for devcall to get a thumbs up/down on if it's worth perusing as-is and/or with logging changes in this/future PR.

@magicrub
Copy link
Contributor Author

the periph use-case I have in mind was a single device/hub that handled 4 of CAN -> PWM_ESCs channels with each having an RPM feedback populating an ESC_Telem feedback message (could also populate voltage/current and temperatures as well)

@IamPete1
Copy link
Member

I have had to add extra RPM instances in the past, I think adding some more is worthwhile, 9 instances might be a bit much, but two additional instances would be useful.

tridge
tridge previously requested changes Aug 21, 2023
Copy link
Contributor

@tridge tridge left a comment

Choose a reason for hiding this comment

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

need to make RPM message an instance with RPM[0].rpm RPM[1].rpm etc

@rmackay9
Copy link
Contributor

Let's make it 4 instances.. that should be enough.

@magicrub
Copy link
Contributor Author

Changed max to 4 instances and updated logger to be instance basec

@rmackay9 rmackay9 dismissed tridge’s stale review August 22, 2023 01:14

Tridge's requests have been addressed.

@rmackay9
Copy link
Contributor

This looks OK to me. It's been tested of course including testing that the logs appear correctly for multiple instances?

@Hwurzburg Hwurzburg added the WikiNeeded needs wiki update label Aug 22, 2023
@magicrub
Copy link
Contributor Author

This looks OK to me. It's been tested of course including testing that the logs appear correctly for multiple instances?

The logging needs testing. I'll report back when I've done that

@magicrub
Copy link
Contributor Author

Would be nice to get another review of this to ensure I correctly implemented the method that was discussed in the last dev call.

Copy link
Contributor

@tridge tridge left a comment

Choose a reason for hiding this comment

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

just needs test

@peterbarker
Copy link
Contributor

... now needs rebase...

@peterbarker
Copy link
Contributor

I've force-pushed this branch after rebasing it on top of Matt's RPM-logging-improvements branch (which I vastly prefer over moving to WriteStreaming!)

@peterbarker
Copy link
Contributor

Tested the logging in SITL. Works fine.

@peterbarker peterbarker merged commit a014bcb into ArduPilot:master Aug 10, 2024
93 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

7 participants