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

Copter, QuadPlane, Sub: navigation using s-curves #15896

Merged
merged 39 commits into from Apr 3, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
39 commits
Select commit Hold shift + click to select a range
d6e035e
AP_InternalError: added invalid_arguments failure
rmackay9 Feb 5, 2021
749004d
AP_Math: add update_pos_vel_accel to control
lthall Jan 20, 2021
f7a3d6b
AP_Math: Vector2,3 get limit_length methods
rmackay9 Mar 11, 2021
fe66ffc
AP_Math: remove control's limit_vector_length
rmackay9 Mar 11, 2021
914c042
AP_Math: add SCurve library
lthall Jan 4, 2020
39e4440
AP_Math: add SplineCurve library
rmackay9 Jan 19, 2021
02fd07d
AC_PID: library update and additional functions
lthall Jan 4, 2020
8a01dcf
AC_AttitudeControl: support for feedforward rate in angle request for…
lthall Jan 4, 2020
9708db4
AC_AttitudeControl: minor optimisation and comment fixes
rmackay9 Mar 11, 2021
e7668c8
AP_Logger: support for position controller logging
lthall Jan 4, 2020
3bcdc55
AP_Mission: Mission_Command struct gets comparison operators
rmackay9 Mar 4, 2021
336de94
AP_Mission: add restart_current_nav_cmd
rmackay9 Mar 6, 2021
58ebb85
AC PosControl: fix position error get functions
lthall Dec 13, 2020
666c6db
AC_PosControl: remove unused sqrt_controller_3D
lthall Dec 15, 2020
386823e
AC_PosControl: alt hold controller update
lthall Jan 4, 2020
9796847
AC_PosControl: use Vector limit_length and formatting fixes
rmackay9 Mar 11, 2021
225c1f0
AC_PosControl_Sub: update for new position controller changes
lthall Jan 4, 2020
0b3700c
AC_WPNav: support for SCurve navigation
lthall Jan 4, 2020
67331b7
AC_WPNav: fix get_wp_destination_loc
rmackay9 Jan 27, 2021
1fd63d3
AC_WPNav: renames and comment fixes
rmackay9 Mar 12, 2021
137c028
AC_Circle: fix references to position error
lthall Jan 19, 2021
193a7d9
AC_Loiter: fix references to position error
lthall Jan 19, 2021
74a4648
AP_SmartRTL: peek_point method peeks at next point
rmackay9 Jan 8, 2020
5863c80
Copter: mode_smart_rtl uses peek_point
rmackay9 Jan 8, 2020
325ca34
Copter: support for SCurves and position controller changes
lthall Jan 20, 2021
bc0891e
Copter: smart-rtl fix for final point altitude
rmackay9 Feb 9, 2021
2db037b
Copter: rtl passes speed to wpnav::init
rmackay9 Oct 8, 2020
1e7b4f3
Copter: fix references to position error
lthall Dec 13, 2020
661a0dc
Copter: position control PID logging
lthall Jan 20, 2021
67dd917
Copter: auto's wp_start skips submode change on terrain failsafe
rmackay9 Jan 29, 2021
971af82
Copter: auto detects mission changes
rmackay9 Mar 4, 2021
4630122
Copter: add comments to smartRTL
rmackay9 Mar 11, 2021
1b7f5c0
Copter: integrate AC_WPNav::get_yaw_rate_cds rename
rmackay9 Mar 12, 2021
5c78516
Plane: update tuning to integrate poscon changes
rmackay9 Jan 8, 2020
4cb177e
Sub: integrate s-curves, remove spline support
rmackay9 Jun 10, 2020
40102cc
Sub: auto-yaw-correct-xtract uses target velocity instead of position…
rmackay9 Mar 26, 2021
7f2b703
Tools: extend copter NavDelay test by 80sec
rmackay9 Oct 5, 2020
bfed946
Tools: Copter.RTLSpeed gets increased speed tolerance
rmackay9 Nov 4, 2020
d27f24a
Tools: Copter.fly_square descends more quickly
rmackay9 Nov 5, 2020
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
4 changes: 4 additions & 0 deletions ArduCopter/Log.cpp
Expand Up @@ -76,6 +76,10 @@ void Copter::Log_Write_Attitude()
logger.Write_PID(LOG_PIDP_MSG, attitude_control->get_rate_pitch_pid().get_pid_info());
logger.Write_PID(LOG_PIDY_MSG, attitude_control->get_rate_yaw_pid().get_pid_info());
logger.Write_PID(LOG_PIDA_MSG, pos_control->get_accel_z_pid().get_pid_info() );
if (should_log(MASK_LOG_NTUN) && (flightmode->requires_GPS() || landing_with_GPS())) {
rmackay9 marked this conversation as resolved.
Show resolved Hide resolved
logger.Write_PID(LOG_PIDN_MSG, pos_control->get_vel_xy_pid().get_pid_info_x());
logger.Write_PID(LOG_PIDE_MSG, pos_control->get_vel_xy_pid().get_pid_info_y());
}
}
}

Expand Down
15 changes: 14 additions & 1 deletion ArduCopter/autoyaw.cpp
Expand Up @@ -215,8 +215,21 @@ float Mode::AutoYaw::yaw()
// messages (positive is clockwise, negative is counter clockwise)
float Mode::AutoYaw::rate_cds() const
{
if (_mode == AUTO_YAW_RATE) {
switch (_mode) {

case AUTO_YAW_HOLD:
case AUTO_YAW_ROI:
case AUTO_YAW_FIXED:
case AUTO_YAW_LOOK_AHEAD:
case AUTO_YAW_RESETTOARMEDYAW:
case AUTO_YAW_CIRCLE:
return 0.0f;

case AUTO_YAW_RATE:
return _rate_cds;

case AUTO_YAW_LOOK_AT_NEXT_WP:
return copter.wp_nav->get_yaw_rate_cds();
}

// return zero turn rate (this should never happen)
Expand Down
1 change: 0 additions & 1 deletion ArduCopter/defines.h
Expand Up @@ -91,7 +91,6 @@ enum AutoMode {
Auto_RTL,
Auto_CircleMoveToEdge,
Auto_Circle,
Auto_Spline,
Auto_NavGuided,
Auto_Loiter,
Auto_LoiterToAlt,
Expand Down
2 changes: 1 addition & 1 deletion ArduCopter/mode.cpp
Expand Up @@ -564,7 +564,7 @@ void Mode::land_run_vertical_control(bool pause_descent)
const float precland_min_descent_speed = 10.0f;

float max_descent_speed = abs(g.land_speed)*0.5f;
float land_slowdown = MAX(0.0f, pos_control->get_horizontal_error()*(max_descent_speed/precland_acceptable_error));
float land_slowdown = MAX(0.0f, pos_control->get_pos_error_xy()*(max_descent_speed/precland_acceptable_error));
cmb_rate = MIN(-precland_min_descent_speed, -max_descent_speed+land_slowdown);
}
#endif
Expand Down
18 changes: 14 additions & 4 deletions ArduCopter/mode.h
Expand Up @@ -369,8 +369,6 @@ class ModeAuto : public Mode {
void land_start(const Vector3f& destination);
void circle_movetoedge_start(const Location &circle_center, float radius_m);
void circle_start();
void spline_start(const Vector3f& destination, bool stopped_at_start, AC_WPNav::spline_segment_end_type seg_end_type, const Vector3f& next_spline_destination);
void spline_start(const Location& destination, bool stopped_at_start, AC_WPNav::spline_segment_end_type seg_end_type, const Location& next_destination);
void nav_guided_start();

bool is_landing() const override;
Expand Down Expand Up @@ -417,17 +415,18 @@ class ModeAuto : public Mode {
bool verify_command(const AP_Mission::Mission_Command& cmd);
void exit_mission();

bool check_for_mission_change(); // detect external changes to mission

void takeoff_run();
void wp_run();
void spline_run();
void land_run();
void rtl_run();
void circle_run();
void nav_guided_run();
void loiter_run();
void loiter_to_alt_run();

Location loc_from_cmd(const AP_Mission::Mission_Command& cmd) const;
Location loc_from_cmd(const AP_Mission::Mission_Command& cmd, const Location& default_loc) const;

void payload_place_start(const Vector3f& destination);
void payload_place_run();
Expand All @@ -442,12 +441,14 @@ class ModeAuto : public Mode {

void do_takeoff(const AP_Mission::Mission_Command& cmd);
void do_nav_wp(const AP_Mission::Mission_Command& cmd);
bool set_next_wp(const AP_Mission::Mission_Command& current_cmd, const Location &default_loc);
void do_land(const AP_Mission::Mission_Command& cmd);
void do_loiter_unlimited(const AP_Mission::Mission_Command& cmd);
void do_circle(const AP_Mission::Mission_Command& cmd);
void do_loiter_time(const AP_Mission::Mission_Command& cmd);
void do_loiter_to_alt(const AP_Mission::Mission_Command& cmd);
void do_spline_wp(const AP_Mission::Mission_Command& cmd);
void get_spline_from_cmd(const AP_Mission::Mission_Command& cmd, const Location& default_loc, Location& dest_loc, Location& next_dest_loc, bool& next_dest_loc_is_spline);
#if NAV_GUIDED == ENABLED
void do_nav_guided_enable(const AP_Mission::Mission_Command& cmd);
void do_guided_limits(const AP_Mission::Mission_Command& cmd);
Expand Down Expand Up @@ -525,6 +526,15 @@ class ModeAuto : public Mode {
} nav_payload_place;

bool waiting_to_start; // true if waiting for vehicle to be armed or EKF origin before starting mission

// variables to detect mission changes
static const uint8_t mis_change_detect_cmd_max = 3;
struct {
uint32_t last_change_time_ms; // local copy of last time mission was changed
uint16_t curr_cmd_index; // local copy of AP_Mission's current command index
uint8_t cmd_count; // number of commands in the cmd array
AP_Mission::Mission_Command cmd[mis_change_detect_cmd_max]; // local copy of the next few mission commands
} mis_change_detect = {};
};

#if AUTOTUNE_ENABLED == ENABLED
Expand Down