Skip to content

MPVehicle: add system_status property - #156

Closed
mrpollo wants to merge 7 commits into
masterfrom
system_status
Closed

mrpollo wants to merge 7 commits into
masterfrom
system_status

Conversation

@mrpollo

@mrpollo mrpollo commented Jun 10, 2015

Copy link
Copy Markdown
Member

exposes the system_status field from the most recently received heartbeat message

handy for checking whether they vehicle is on the ground, flying, in failsafe, etc

possible values:

Field name Description
MAV_STATE_UNINIT Uninitialized system, state is unknown.
MAV_STATE_BOOT System is booting up.
MAV_STATE_CALIBRATING System is calibrating and not flight-ready.
MAV_STATE_STANDBY System is grounded and on standby. It can be launched any time.
MAV_STATE_ACTIVE System is active and might be already airborne. Motors are engaged.
MAV_STATE_CRITICAL System is in a non-normal flight mode. It can however still navigate.
MAV_STATE_EMERGENCY System is in a non-normal flight mode. It lost control over parts or over the whole airframe. It is in mayday and going down.
MAV_STATE_POWEROFF System just initialized its power-down sequence, will shut down now.

@hamishwillee can you update this branch with docs to match this change please?

big thanks to @liamstask for the contribution.

@mrpollo

mrpollo commented Jun 10, 2015

Copy link
Copy Markdown
Member Author

@djnugent can you please review?

Comment thread droneapi/module/api.py Outdated

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Shouldn't 'system_status' be added to the self._on_change()?

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

I think you are right, let me ponder on this for a bit.

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

I think its only use is to have the ability to add an attribute_observer. I think you should add it to keep consistent with the other attributes.

@billbonney

Copy link
Copy Markdown

The thing to remember about mode is that it's quite broad. APM indicates more specifically what is happening in status using the status bits and the custom_mode ie. LAND or RTL indicates probably a failsafe in action.

@hamishwillee

Copy link
Copy Markdown
Contributor

@billbonney Can you point me point me to the status bits documentation? Perhaps we can provide additional states through the API for these. Whatever we do we need to be able to access this information through DroneKit (at the moment since we only have send_message without any way to get/parse a result I don't see how we could get this information).

@billbonney

Copy link
Copy Markdown

On looking I only see status bit as part of the dataflash logs. I was under the impression that the onboard_control_sensors_health bits contained this information i.e. when it's landed. I'll talk with Randy/Tridge if there is some message they are sending.

That said, most states are inferred through information from the telemetry. Send Message is like giving instructions to your kids, you are never sure they have heard you, or going to do what you ask, until you see them doing it. ;)

@hamishwillee

Copy link
Copy Markdown
Contributor

@billbonney Thanks very much - interested to find out what you find out. It may be that we can do some of the "inferring" behind the scenes/within the API.

@hamishwillee

Copy link
Copy Markdown
Contributor

@mrpollo What happens if we lose the heartbeat - will this return NONE?

@hamishwillee

Copy link
Copy Markdown
Contributor

@mrpollo OK, as you can see above, documentation added. This includes updates to the example code, example code doc, guide on setting states. I've tried to make it clear that this is broad information by adding (in reference) that "This attribute provides high-level information about whether the vehicle is on the ground, flying, in failsafe, etc. ". Depending on what @billbonney comes back with we might add a whole separate guide topic on "How to deal with fail safe conditions"

The vehicle_state.py example code adds a function to print out a human-readable string for the different MAV_STATE values. I think this is enough to show how you would use the API.

Ready to pull.

@mrpollo

mrpollo commented Jun 11, 2015

Copy link
Copy Markdown
Member Author

Inspired by the conversation I made some small changes to the value of system_status, this attribute now returns a Class SystemStatus which prints the status description and compares to ints for when we want to do a check against another status.

@hamishwillee would you be able to check the docs I'm not sure that I did it right

@hamishwillee

Copy link
Copy Markdown
Contributor

@mrpollo I updated the docs and then attempted to rebase to master.

Unfortunately I'm not sure I did this right. The file comparison - as though a lot of new content was discovered. However the files themselves look fine. Can you please sanity check?

This was referenced Jul 15, 2015
liamstask and others added 6 commits July 24, 2015 14:03
@tcr3dr
tcr3dr force-pushed the system_status branch 7 times, most recently from d303c28 to 332ea75 Compare July 24, 2015 21:33
@tcr3dr

tcr3dr commented Jul 24, 2015

Copy link
Copy Markdown
Contributor

It appears that the line endings on a few items was incorrect. I fixed them and pushed.

The target of this PR will be the "minor" branch once it's updated. I'll take a look sometime next week.

@tcr3dr tcr3dr added this to the v1.5.0 milestone Jul 24, 2015
@tcr3dr tcr3dr modified the milestones: Minor, v1.5.0 Aug 12, 2015
@tcr3dr

tcr3dr commented Nov 10, 2015

Copy link
Copy Markdown
Contributor

Replaced by #441.

@tcr3dr tcr3dr closed this Nov 10, 2015
@tcr3dr
tcr3dr deleted the system_status branch November 10, 2015 23:12
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.

6 participants