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

PositionControl: skip controller only if adjusted thrust setpoint are… #11056

Merged
merged 1 commit into from
Jan 8, 2019

Conversation

Stifael
Copy link
Contributor

@Stifael Stifael commented Dec 17, 2018

  • consider landed if not armed
  • vehicle_local_position_setpiont publication: follow the logic here to improve logging analysis
  • do not publish the adjusted thrust setpoint from ground-contact/maybe-landed to simplify landed/maybe-landed analysis
  • initialize the landed-structure with safe values

@Stifael Stifael requested a review from MaEtUgR December 17, 2018 11:11
… not finite

PositionControl: update comment about the order of thrust and position

mc_pos_control: reset setpoints to NAN if required

MulticopterLandDetector: consider to be landed if vehicle is not armed

mc_pos_control: initialize landing struct with landed

mc-pos-ctrl: adjust thrust-setpoint and yaw during ground-contact/maybe-landed without capturing
that information within vehicle-local-position-setpoint topic because that information
does not belong to user intention

PositionControl: set local position/velocity setpoint to NAN if not used in the control pipeline

mc-pos-ctrl: Fill vehicle_local_position_setpoint_s structure as follow:
The message contains setpoints where each type of setpoint is either the input to the PositionController
or was generated by the PositionController and therefore corresponds to the PositioControl internal states (states that were generated by P-PID).
Example:
If the desired setpoint is position-setpoint, _local_pos_sp will contain
position-, velocity- and thrust-setpoint where the velocity- and thrust-setpoint were generated by the PositionControlller.
If the desired setpoint has a velocity-setpoint only, then _local_pos_sp will contain valid velocity- and thrust-setpoint, but the position-setpoint
will remain NAN. Given that the PositionController cannot generate a position-setpoint, this type of setpoint is always equal to the input to the
PositionController.

mc_pos_control: switch to designated initializer for landed

It's less error prone because it produces an error on every discrepancy.
@MaEtUgR MaEtUgR force-pushed the position-ctrl-vehicle-local-pos-improvement branch from 88e3775 to a1a2c2f Compare December 19, 2018 17:42
@MaEtUgR
Copy link
Member

MaEtUgR commented Dec 19, 2018

rebased for the fmu-v2 savings and hopefully CI passing

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.

LGTM
@Stifael Was the small hickup in manual downwards position flight during our tests related to this? If not I think we can merge if yes we should first investigate and fix it.

@Stifael
Copy link
Contributor Author

Stifael commented Dec 20, 2018

@MaEtUgR, not related.

@bkueng, with this change the vehicle_local_position_setpoint.x/y will be NAN during manual-position control and fast forward flight. As discussed, this would require to adjust Flightreview, otherwise there will be a bunch of NANs

bkueng added a commit to PX4/flight_review that referenced this pull request Jan 7, 2019
NaN is now used to indicate velocity-control only.
See PX4/PX4-Autopilot#11056
Copy link
Member

@bkueng bkueng left a comment

Choose a reason for hiding this comment

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

Looks good. Flight Review is updated: PX4/flight_review@2ba9648.

@PX4/testflights can you test this?

@@ -55,8 +55,25 @@ void PositionControl::updateState(const PositionControlStates &states)
_vel_dot = states.acceleration;
}

void PositionControl::_setCtrlFlagTrue()
Copy link
Member

Choose a reason for hiding this comment

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

How about void PositionControl::_setCtrlFlag(bool value)?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

true. not sure what I was thinking

Copy link
Contributor Author

Choose a reason for hiding this comment

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

@MaEtUgR will do the change. thanks

@Stifael Stifael merged commit 5887a23 into master Jan 8, 2019
@MaEtUgR
Copy link
Member

MaEtUgR commented Jan 8, 2019

Thanks to @bkueng! The review comment will be addressed in my follow up pr.

@MaEtUgR MaEtUgR deleted the position-ctrl-vehicle-local-pos-improvement branch January 8, 2019 14:37
MaEtUgR added a commit that referenced this pull request Jan 8, 2019
@bramsvs
Copy link
Contributor

bramsvs commented Jan 8, 2019

* do not publish the adjusted thrust setpoint from ground-contact/maybe-landed to simplify landed/maybe-landed analysis

@Stifael Quick post-merge question... How exactly does this PR simplify landed/maybe-landed analysis?

I'm asking because I just had a case where ground-contact was detected inadvertently, causing the xy thrust set to zero resulting in a crash. If the thrust is logged unchanged this will be even harder to debug..(?)

@Stifael
Copy link
Contributor Author

Stifael commented Jan 9, 2019

@bramsvs with this PR vehicle_local_position_setpoint now always agrees with the logic here, even during landing. However, that does not change anything in terms of landing behavior. It is to note, that the vehicle_local_position_setpoint topic is so far only used to detect vehicle intention (upwards or downards motion). The vehicle_local_position_setpoint.thrust[0..2] is only used for logging. This means that when you look at vehicle_local_position_setpoint topic, the different messages should now agree with what the controller is using and spits out.
The actual thrust used in the system and sent to the attitude-controller is vehicle_attitude_setpoint.thrust. The actuator_control.thrust msg (thats the message before entering the mixer), is used in the land-detector. Hence, if you want to see if the thrust is actually at zero during ground-contact, then you should look at actuator_control topic

@julianoes
Copy link
Contributor

Found a regression: #11197

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.

5 participants