-
Notifications
You must be signed in to change notification settings - Fork 17.9k
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
Plane: tilt quadplane fixes #28960
base: master
Are you sure you want to change the base?
Plane: tilt quadplane fixes #28960
Changes from all commits
600f432
d8c3e2a
c229f66
60c1807
d7bf02b
77f37b1
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change | ||||||
---|---|---|---|---|---|---|---|---|
|
@@ -150,6 +150,8 @@ void Tiltrotor::setup() | |||||||
} | ||||||||
quadplane.transition = transition; | ||||||||
|
||||||||
SRV_Channels::set_range(SRV_Channel::k_throttle_tilt, 100); // match k_throttle | ||||||||
|
||||||||
setup_complete = true; | ||||||||
} | ||||||||
|
||||||||
|
@@ -229,7 +231,9 @@ void Tiltrotor::continuous_update(void) | |||||||
|
||||||||
max_change = tilt_max_change(false); | ||||||||
|
||||||||
float new_throttle = constrain_float(SRV_Channels::get_output_scaled(SRV_Channel::k_throttle)*0.01, 0, 1); | ||||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I was expecting to just be able to change this to |
||||||||
SRV_Channels::set_output_scaled(SRV_Channel::k_throttle_tilt, SRV_Channels::get_output_scaled(SRV_Channel::k_throttle)); | ||||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I think this should constrain to not be negative before the set. Normal throttle can be negative.
Suggested change
|
||||||||
float new_throttle = constrain_float(SRV_Channels::get_slew_limited_output_scaled(SRV_Channel::k_throttle_tilt)*0.01, 0, 1); | ||||||||
|
||||||||
if (current_tilt < get_fully_forward_tilt()) { | ||||||||
current_throttle = constrain_float(new_throttle, | ||||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This constrain could be achieved with the new slew limited function. |
||||||||
current_throttle-max_change, | ||||||||
|
@@ -245,7 +249,7 @@ void Tiltrotor::continuous_update(void) | |||||||
} | ||||||||
if (!quadplane.motor_test.running) { | ||||||||
// the motors are all the way forward, start using them for fwd thrust | ||||||||
const uint16_t mask = is_zero(current_throttle)?0U:tilt_mask.get(); | ||||||||
const uint16_t mask = tilt_mask.get(); | ||||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I think will mean you get spin min in motor test rather than no motors spinning? |
||||||||
motors->output_motor_mask(current_throttle, mask, plane.rudder_dt); | ||||||||
} | ||||||||
return; | ||||||||
|
@@ -363,7 +367,8 @@ void Tiltrotor::binary_update(void) | |||||||
// all the way forward and run them as a forward motor | ||||||||
binary_slew(true); | ||||||||
|
||||||||
float new_throttle = SRV_Channels::get_output_scaled(SRV_Channel::k_throttle)*0.01f; | ||||||||
SRV_Channels::set_output_scaled(SRV_Channel::k_throttle_tilt, SRV_Channels::get_output_scaled(SRV_Channel::k_throttle)); | ||||||||
float new_throttle = constrain_float(SRV_Channels::get_slew_limited_output_scaled(SRV_Channel::k_throttle_tilt)*0.01, 0, 1); | ||||||||
if (current_tilt >= 1) { | ||||||||
const uint16_t mask = is_zero(new_throttle)?0U:tilt_mask.get(); | ||||||||
// the motors are all the way forward, start using them for fwd thrust | ||||||||
|
@@ -489,6 +494,9 @@ void Tiltrotor::tilt_compensate_angle(float *thrust, uint8_t num_motors, float n | |||||||
thrust[i] *= scale; | ||||||||
} | ||||||||
} | ||||||||
if (!fully_fwd()) { | ||||||||
SRV_Channels::set_output_scaled(SRV_Channel::k_throttle_tilt, largest_tilted*100); | ||||||||
} | ||||||||
Comment on lines
+497
to
+499
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I guess this is to make sure the slew starts off in the right place? I would prefer to see it done with the throttle output value from motors. You should be able to use motors thrust linearisation like we do for tailsitter here: ardupilot/ArduPlane/tailsitter.cpp Lines 321 to 323 in 5f8a655
|
||||||||
} | ||||||||
|
||||||||
/* | ||||||||
|
@@ -769,4 +777,15 @@ bool Tiltrotor::tilt_over_max_angle(void) const | |||||||
return (current_tilt > MIN(tilt_threshold, get_forward_flight_tilt())); | ||||||||
} | ||||||||
|
||||||||
/* | ||||||||
get a proportion of how far we are through the 2nd part of a transition | ||||||||
0 means tilt is less than Q_TILT_MAX. 1 means fully forward | ||||||||
*/ | ||||||||
float Tiltrotor::get_tilt_completion() const | ||||||||
{ | ||||||||
const float tilt_threshold = (max_angle_deg/90.0f); | ||||||||
const float completion_tilt = get_forward_flight_tilt(); | ||||||||
return constrain_float((current_tilt - tilt_threshold) / (completion_tilt - tilt_threshold), 0, 1); | ||||||||
} | ||||||||
|
||||||||
#endif // HAL_QUADPLANE_ENABLED |
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -189,6 +189,7 @@ class SRV_Channel { | |
k_rcin15_mapped = 154, | ||
k_rcin16_mapped = 155, | ||
k_lift_release = 156, | ||
k_throttle_tilt = 157, | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Should we enforce that users don't assign this to a actual output? It does not abide by safety state for example (or E-stop). |
||
k_nr_aux_servo_functions ///< This must be the last enum value (only add new values _before_ this one) | ||
} Aux_servo_function_t; | ||
|
||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I really would like to get everything to use a range of 1. But I do see that it would be a bit odd to not match throttle here.