Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
F
Firmware
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Terms and privacy
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Alberto Ruiz Garcia
Firmware
Commits
c12dcb4e
Commit
c12dcb4e
authored
6 years ago
by
Dennis Mannhart
Committed by
Lorenz Meier
6 years ago
Browse files
Options
Downloads
Patches
Plain Diff
FlightTaskAuto: take care of case when triplet.lat/lon are invalid, which corresponds
to position lock.
parent
65ad6eda
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
src/lib/FlightTasks/tasks/FlightTaskAuto.cpp
+21
-3
21 additions, 3 deletions
src/lib/FlightTasks/tasks/FlightTaskAuto.cpp
src/lib/FlightTasks/tasks/FlightTaskAuto.hpp
+2
-0
2 additions, 0 deletions
src/lib/FlightTasks/tasks/FlightTaskAuto.hpp
with
23 additions
and
3 deletions
src/lib/FlightTasks/tasks/FlightTaskAuto.cpp
+
21
−
3
View file @
c12dcb4e
...
...
@@ -95,7 +95,8 @@ bool FlightTaskAuto::_evaluateTriplets()
// such as land and takeoff. The navigator should use for auto takeoff/land with flow the position in xy at the moment the
// takeoff/land was initiated. Until then we do this kind of logic here.
if
(
!
_sub_triplet_setpoint
->
get
().
current
.
valid
&&
!
_isFinite
(
_sub_triplet_setpoint
->
get
().
current
))
{
// Check if triplet is valid. There must be at least a valid altitude.
if
(
!
_sub_triplet_setpoint
->
get
().
current
.
valid
||
!
PX4_ISFINITE
(
_sub_triplet_setpoint
->
get
().
current
.
alt
))
{
// best we can do is to just set all waypoints to current state and return false
_prev_prev_wp
=
_prev_wp
=
_target
=
_next_wp
=
_position
;
_type
=
WaypointType
::
position
;
...
...
@@ -114,8 +115,25 @@ bool FlightTaskAuto::_evaluateTriplets()
// get target waypoint.
matrix
::
Vector3f
target
;
map_projection_project
(
&
_reference_position
,
_sub_triplet_setpoint
->
get
().
current
.
lat
,
_sub_triplet_setpoint
->
get
().
current
.
lon
,
&
target
(
0
),
&
target
(
1
));
if
(
!
PX4_ISFINITE
(
_sub_triplet_setpoint
->
get
().
current
.
lat
)
||
!
PX4_ISFINITE
(
_sub_triplet_setpoint
->
get
().
current
.
lon
))
{
// No position provided in xy. Lock position
if
(
!
PX4_ISFINITE
(
_lock_position_xy
(
0
)))
{
target
(
0
)
=
_lock_position_xy
(
0
)
=
_position
(
0
);
target
(
1
)
=
_lock_position_xy
(
1
)
=
_position
(
1
);
}
else
{
target
(
0
)
=
_lock_position_xy
(
0
);
target
(
1
)
=
_lock_position_xy
(
1
);
}
}
else
{
// Convert from global to local frame.
map_projection_project
(
&
_reference_position
,
_sub_triplet_setpoint
->
get
().
current
.
lat
,
_sub_triplet_setpoint
->
get
().
current
.
lon
,
&
target
(
0
),
&
target
(
1
));
}
target
(
2
)
=
-
(
_sub_triplet_setpoint
->
get
().
current
.
alt
-
_reference_altitude
);
// check if target is valid
...
...
This diff is collapsed.
Click to expand it.
src/lib/FlightTasks/tasks/FlightTaskAuto.hpp
+
2
−
0
View file @
c12dcb4e
...
...
@@ -85,6 +85,8 @@ protected:
uORB
::
Subscription
<
home_position_s
>
*
_sub_home_position
{
nullptr
};
private
:
matrix
::
Vector2f
_lock_position_xy
{};
uORB
::
Subscription
<
position_setpoint_triplet_s
>
*
_sub_triplet_setpoint
{
nullptr
};
DEFINE_PARAMETERS_CUSTOM_PARENT
(
FlightTask
,
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment