Skip to content

Commit

Permalink
ArduPlane: Make set position tgt depend on ext ctrl
Browse files Browse the repository at this point in the history
* Set position target used to just be used in scripting, now it's used
  by DDS in external control

Signed-off-by: Ryan Friedman <[email protected]>
  • Loading branch information
Ryanf55 authored and IamPete1 committed Dec 20, 2023
1 parent faa8ac0 commit 2e393bb
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 3 deletions.
6 changes: 4 additions & 2 deletions ArduPlane/ArduPlane.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -798,8 +798,8 @@ bool Plane::get_wp_crosstrack_error_m(float &xtrack_error) const
return true;
}

#if AP_SCRIPTING_ENABLED
// set target location (for use by scripting)
#if AP_SCRIPTING_ENABLED || AP_EXTERNAL_CONTROL_ENABLED
// set target location (for use by external control and scripting)
bool Plane::set_target_location(const Location &target_loc)
{
Location loc{target_loc};
Expand All @@ -816,7 +816,9 @@ bool Plane::set_target_location(const Location &target_loc)
plane.set_guided_WP(loc);
return true;
}
#endif //AP_SCRIPTING_ENABLED || AP_EXTERNAL_CONTROL_ENABLED

#if AP_SCRIPTING_ENABLED
// set target location (for use by scripting)
bool Plane::get_target_location(Location& target_loc)
{
Expand Down
4 changes: 3 additions & 1 deletion ArduPlane/Plane.h
Original file line number Diff line number Diff line change
Expand Up @@ -1245,8 +1245,10 @@ class Plane : public AP_Vehicle {
void failsafe_check(void);
bool is_landing() const override;
bool is_taking_off() const override;
#if AP_SCRIPTING_ENABLED
#if AP_SCRIPTING_ENABLED || AP_EXTERNAL_CONTROL_ENABLED
bool set_target_location(const Location& target_loc) override;
#endif //AP_SCRIPTING_ENABLED || AP_EXTERNAL_CONTROL_ENABLED
#if AP_SCRIPTING_ENABLED
bool get_target_location(Location& target_loc) override;
bool update_target_location(const Location &old_loc, const Location &new_loc) override;
bool set_velocity_match(const Vector2f &velocity) override;
Expand Down

0 comments on commit 2e393bb

Please sign in to comment.