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

mavlink delete MavlinkOrbSubscription and uORB delete unused orb_stat and last update timestamp #14051

Merged
merged 5 commits into from
Mar 14, 2020

Conversation

dagar
Copy link
Member

@dagar dagar commented Jan 28, 2020

This isn't ready yet, but opening it now because it needs quite a lot of review.

This pull request replaces the mavlink module's orb subscription wrapper with direct usage of uORB::Subscriptions per mavlink stream.

On fmu-v4 (3 mavlink instances) this saves ~ 7.8 kB of ram and ~ 2.7% cpu.

nsh> free
              total       used       free    largest
 Umem:       229440     200672      28768      22880  <-- master
 Umem:       229440     192880      36560      34144  <-- PR
  PID COMMAND                   CPU(ms) CPU(%)  USED/STACK PRIO(BASE) STATE FD
    0 Idle Task                   41504 27.872   244/  512   0 (  0)  READY  3  <-- master
    0 Idle Task                   36132 30.538   244/  512   0 (  0)  READY  3  <-- PR

@dagar dagar force-pushed the pr-uorb_delete_orb_stat branch 2 times, most recently from 0232cce to 9dd40e6 Compare January 29, 2020 01:08
@PX4 PX4 deleted a comment from codecov bot Jan 29, 2020
@dagar dagar force-pushed the pr-uorb_delete_orb_stat branch from 9dd40e6 to 480caa6 Compare January 29, 2020 03:11
@PX4 PX4 deleted a comment from codecov bot Jan 31, 2020
@dagar dagar force-pushed the pr-uorb_delete_orb_stat branch from 0c9d718 to 039a7db Compare February 3, 2020 15:20
@PX4 PX4 deleted a comment from codecov bot Feb 3, 2020
@dagar dagar changed the title [WIP] mavlink delete MavlinkOrbSubscription and uORB delete unused orb_stat and last update timestamp mavlink delete MavlinkOrbSubscription and uORB delete unused orb_stat and last update timestamp Feb 3, 2020
@dagar dagar marked this pull request as ready for review February 3, 2020 15:21
@dagar dagar force-pushed the pr-uorb_delete_orb_stat branch from 039a7db to ba32551 Compare February 4, 2020 15:23
@dagar
Copy link
Member Author

dagar commented Feb 6, 2020

I'd like to bring this in after #14106 settles so that we don't have to deal with the mavlink orb subscriptions that require the special "subscribe from beginning" flag.

@dagar dagar changed the title mavlink delete MavlinkOrbSubscription and uORB delete unused orb_stat and last update timestamp [WIP] mavlink delete MavlinkOrbSubscription and uORB delete unused orb_stat and last update timestamp Feb 6, 2020
@dagar dagar force-pushed the pr-uorb_delete_orb_stat branch from ba32551 to 4cd032a Compare February 6, 2020 02:25
@PX4 PX4 deleted a comment from codecov bot Feb 13, 2020
@dagar dagar force-pushed the pr-uorb_delete_orb_stat branch from 4cd032a to d7bb198 Compare February 13, 2020 21:10
@PX4 PX4 deleted a comment from codecov bot Feb 13, 2020
@dagar dagar force-pushed the pr-uorb_delete_orb_stat branch from d7bb198 to 98e36dd Compare March 10, 2020 22:04
@dagar dagar added this to the Release v1.11.0 milestone Mar 10, 2020
@dagar
Copy link
Member Author

dagar commented Mar 11, 2020

#14106 has merged and I've rebased this PR on current master.

@dagar dagar force-pushed the pr-uorb_delete_orb_stat branch from 98e36dd to 6172ed0 Compare March 11, 2020 13:13
@dagar dagar changed the title [WIP] mavlink delete MavlinkOrbSubscription and uORB delete unused orb_stat and last update timestamp mavlink delete MavlinkOrbSubscription and uORB delete unused orb_stat and last update timestamp Mar 11, 2020
@dagar dagar requested a review from julianoes March 11, 2020 14:04
@dagar dagar force-pushed the pr-uorb_delete_orb_stat branch from d7327c6 to 6ec7565 Compare March 12, 2020 13:45
@dagar dagar requested a review from a team March 12, 2020 14:26
@dagar
Copy link
Member Author

dagar commented Mar 12, 2020

I was surprised by how much memory this saved, but so far the behavior appears to be consistent with master.

Master mavlink status

Screenshot from 2020-03-12 11-03-30

PR mavlink status

Screenshot from 2020-03-12 11-04-08

@Junkim3DR
Copy link

Tested on NXP FMUK66 v3

Indoor test flight.
Mode tested

  • Stabilized

Procedure

  • Takeoff and landing in Stabilized

Note

  • No issue noted.

Log
https://review.px4.io/plot_app?log=60f88527-a901-4200-b87b-8000c67709bd

Tested on NXP FMUK66 v3

Indoor test flight.
Mode tested

  • Stabilized

Procedure

  • Takeoff and landing in Stabilized

Note

  • No issue noted.

Log
https://review.px4.io/plot_app?log=bc50f150-e44b-496c-91ce-283cccda0478

@jorge789
Copy link

Tested on PixRacer V4

Indoor Flight Test
Modes Tested
Stabilized Mode: Good.

Procedure
Arm and Take off in stabilized mode.

Notes
No issues noted, good flight in general.

Log https://review.px4.io/plot_app?log=d95b3692-baa7-44e3-b280-664bd4588415

Tested on CUAV nano V5

Indoor Flight Test
Modes Tested
Stabilized Mode: Good.

Procedure
Arm and Take off in stabilized mode.

Notes
No issues noted, good flight in general.

Log https://review.px4.io/plot_app?log=97d9125c-a7ef-4691-ad0b-8101be666576

Copy link
Contributor

@julianoes julianoes left a comment

Choose a reason for hiding this comment

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

So much nicer! Online one question, other than that it looks correct.


} else {
return _odom_sub.advertised() ? MAVLINK_MSG_ID_ODOMETRY_LEN + MAVLINK_NUM_NON_PAYLOAD_BYTES : 0;
}
Copy link
Contributor

Choose a reason for hiding this comment

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

Nice catch!

{}

bool send(const hrt_abstime t) override
{
position_controller_status_s pos_ctrl_status = {};
tecs_status_s tecs_status = {};
if (_pos_ctrl_status_sub.updated()) {
Copy link
Contributor

Choose a reason for hiding this comment

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

I suppose this change of functionality is intended? It is now only triggered on pos_ctrl_status updated and not on tecs_status anymore.

Copy link
Member Author

Choose a reason for hiding this comment

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

Yes, the MC position controller publishes a (partially populated) position_controller_status now.

@dagar dagar force-pushed the pr-uorb_delete_orb_stat branch from b6bf8ef to 27bc5f0 Compare March 14, 2020 15:53
@dagar
Copy link
Member Author

dagar commented Mar 14, 2020

Comparison with master (px4_fmu-v5_default on bench).

  • found GPS2_RAW regression and fixed
  • UTM_GLBOAL_POSITION only stream if global available (very small bug in master)

Master

Screenshot from 2020-03-14 11-36-11

PR

Screenshot from 2020-03-14 12-39-04

@dagar
Copy link
Member Author

dagar commented Mar 14, 2020

Comparison with master (gazebo iris after takeoff).

Master

Screenshot from 2020-03-14 12-46-04

PR

Screenshot from 2020-03-14 12-42-46

@dagar
Copy link
Member Author

dagar commented Mar 14, 2020

Note for later, streams set to 0.5 Hz seem to jump between 0.2 Hz and 0.8 Hz (both master and the PR).

@dagar dagar merged commit 5fcd793 into master Mar 14, 2020
@dagar dagar deleted the pr-uorb_delete_orb_stat branch March 14, 2020 16:52
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants