Skip to content

Commit

Permalink
[REBASE!] [FIX] tracking of single channel for landing
Browse files Browse the repository at this point in the history
  • Loading branch information
mascheiber committed Oct 20, 2023
1 parent df1ce4a commit 9016d64
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 8 deletions.
3 changes: 2 additions & 1 deletion include/autonomy_core/autonomy_options.h
Original file line number Diff line number Diff line change
Expand Up @@ -110,7 +110,8 @@ struct autonomyOptions
<< " - Landing detection: " << getStringfromBool(activate_landing_detection) << '\n'
<< " - In-flight sensors init: " << getStringfromBool(inflight_sensors_init_service) << '\n'
<< " - Hover after mission completion: " << getStringfromBool(hover_after_mission_completion) << '\n'
<< " - Sequence multiple in-flight: " << getStringfromBool(sequence_multiple_in_flight) << '\n';
<< " - Sequence multiple in-flight: " << getStringfromBool(sequence_multiple_in_flight) << '\n'
<< " - Register RC AUX channels: " << getStringfromBool(register_aux) << '\n';

if (!activate_user_interface)
{
Expand Down
16 changes: 10 additions & 6 deletions src/autonomy_core/autonomy.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1137,10 +1137,13 @@ void Autonomy::rcCallback(const mavros_msgs::RCInConstPtr& msg)
}
}

if (aux_registered_ && !register_aux_)
if (aux_registered_ && register_aux_)
{
// Check for changes with tollerance of 50
for (size_t id = 0; id < msg->channels.size(); ++id)
// for (size_t id = 0; id < msg->channels.size(); ++id)
// {
size_t id = opts_->landing_aux_channel;
if (msg->channels.size() >= id)
{
if (std::abs(msg->channels.at(id) - aux_.getValue(id)) > 50)
{
Expand All @@ -1151,14 +1154,15 @@ void Autonomy::rcCallback(const mavros_msgs::RCInConstPtr& msg)
aux_.setValue(id, msg->channels.at(id));

// Check if landing aux changed
if (id == opts_->landing_aux_channel)
{
stateTransition("land");
}
// if (id == opts_->landing_aux_channel)
// {
stateTransition("land");
// }

// Manage other aux
}
}
// }
}
}

Expand Down
3 changes: 2 additions & 1 deletion src/state_machine/states/initialization.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,8 @@ void Initialization::onEntry(Autonomy& autonomy)
autonomy.stateTransition("nominal");
}
}
else if (autonomy.opts_->register_aux)

if (autonomy.opts_->register_aux)
{
if (!autonomy.registerRCAux())
{
Expand Down

0 comments on commit 9016d64

Please sign in to comment.