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

Control/UAV/Ardupilot: make loiter radius for GUIDED Goto a parameter #204

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 15 additions & 2 deletions src/Control/UAV/Ardupilot/Task.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -132,6 +132,8 @@ namespace Control
float alt;
//! LoiterHere (default) radius
float lradius;
//! Radius sent to AP during Goto, to come close
float lradius_min;
//! Loitering tolerance
int ltolerance;
//! Has Power Module
Expand Down Expand Up @@ -313,6 +315,11 @@ namespace Control
.units(Units::Meter)
.description("Loiter radius used in LoiterHere (idle)");

param("Minimum loiter radius", m_args.lradius_min)
.defaultValue("3")
.units(Units::Meter)
.description("Radius sent to AP during Goto, to come close");

param("Loitering tolerance", m_args.ltolerance)
.defaultValue("10")
.units(Units::Meter)
Expand Down Expand Up @@ -975,17 +982,23 @@ namespace Control
//! Setting loiter radius parameter
if (m_vehicle_type != VEHICLE_COPTER)
{
//Set WP_LOITER_RAD to the desired radius if we are loitering
//if not, set it small so we will come close to the WP (before AP will start a loiter)
m_desired_radius = path->lradius ? (path->flags & DesiredPath::FL_CCLOCKW ? (-1 * path->lradius) : (path->lradius)) : m_args.lradius_min;
mavlink_msg_param_set_pack(255, 0, &msg,
m_sysid, //! target_system System ID
0, //! target_component Component ID
"WP_LOITER_RAD", //! Parameter name
path->lradius ? (path->flags & DesiredPath::FL_CCLOCKW ? (-1 * path->lradius) : (path->lradius)) : 10, //! Parameter value
m_desired_radius, //! Parameter value
MAV_PARAM_TYPE_INT16); //! Parameter type

n = mavlink_msg_to_send_buffer(buf, &msg);
sendData(buf, n);
}
m_desired_radius = (uint16_t) path->lradius;
else
{
m_desired_radius = (uint16_t) path->lradius;
}

float alt = (path->end_z_units & IMC::Z_NONE) ? m_args.alt : (float)path->end_z;

Expand Down