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
e7e49d5b
Commit
e7e49d5b
authored
6 years ago
by
Dennis Mannhart
Browse files
Options
Downloads
Patches
Plain Diff
FlightTask don't require vehicle-local-positiion topic
parent
d3b54c35
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/FlightTask/FlightTask.cpp
+9
-24
9 additions, 24 deletions
src/lib/FlightTasks/tasks/FlightTask/FlightTask.cpp
src/lib/FlightTasks/tasks/FlightTask/FlightTask.hpp
+1
-1
1 addition, 1 deletion
src/lib/FlightTasks/tasks/FlightTask/FlightTask.hpp
with
10 additions
and
25 deletions
src/lib/FlightTasks/tasks/FlightTask/FlightTask.cpp
+
9
−
24
View file @
e7e49d5b
...
...
@@ -44,7 +44,8 @@ bool FlightTask::updateInitialize()
_time
=
(
_time_stamp_current
-
_time_stamp_activate
)
/
1e6
f
;
_deltatime
=
math
::
min
((
_time_stamp_current
-
_time_stamp_last
),
_timeout
)
/
1e6
f
;
_time_stamp_last
=
_time_stamp_current
;
return
_evaluateVehicleLocalPosition
();
_evaluateVehicleLocalPosition
();
return
true
;
}
const
vehicle_local_position_setpoint_s
FlightTask
::
getPositionSetpoint
()
...
...
@@ -82,48 +83,40 @@ void FlightTask::_resetSetpoints()
_desired_waypoint
=
FlightTask
::
empty_trajectory_waypoint
;
}
bool
FlightTask
::
_evaluateVehicleLocalPosition
()
void
FlightTask
::
_evaluateVehicleLocalPosition
()
{
_position
.
setAll
(
NAN
);
_velocity
.
setAll
(
NAN
);
_yaw
=
NAN
;
_dist_to_bottom
=
NAN
;
// Only use vehicle-local-position topic fields if the topic is received within a certain timestamp
if
((
_time_stamp_current
-
_sub_vehicle_local_position
->
get
().
timestamp
)
<
_timeout
)
{
// position
if
(
_sub_vehicle_local_position
->
get
().
xy_valid
)
{
_position
(
0
)
=
_sub_vehicle_local_position
->
get
().
x
;
_position
(
1
)
=
_sub_vehicle_local_position
->
get
().
y
;
}
else
{
_position
(
0
)
=
_position
(
1
)
=
NAN
;
}
if
(
_sub_vehicle_local_position
->
get
().
z_valid
)
{
_position
(
2
)
=
_sub_vehicle_local_position
->
get
().
z
;
}
else
{
_position
(
2
)
=
NAN
;
}
// velocity
if
(
_sub_vehicle_local_position
->
get
().
v_xy_valid
)
{
_velocity
(
0
)
=
_sub_vehicle_local_position
->
get
().
vx
;
_velocity
(
1
)
=
_sub_vehicle_local_position
->
get
().
vy
;
}
else
{
_velocity
(
0
)
=
_velocity
(
1
)
=
NAN
;
}
if
(
_sub_vehicle_local_position
->
get
().
v_z_valid
)
{
_velocity
(
2
)
=
_sub_vehicle_local_position
->
get
().
vz
;
}
else
{
_velocity
(
2
)
=
NAN
;
}
// yaw
_yaw
=
_sub_vehicle_local_position
->
get
().
yaw
;
// distance to bottom
_dist_to_bottom
=
NAN
;
if
(
_sub_vehicle_local_position
->
get
().
dist_bottom_valid
&&
PX4_ISFINITE
(
_sub_vehicle_local_position
->
get
().
dist_bottom
))
{
_dist_to_bottom
=
_sub_vehicle_local_position
->
get
().
dist_bottom
;
...
...
@@ -134,14 +127,6 @@ bool FlightTask::_evaluateVehicleLocalPosition()
globallocalconverter_init
(
_sub_vehicle_local_position
->
get
().
ref_lat
,
_sub_vehicle_local_position
->
get
().
ref_lon
,
_sub_vehicle_local_position
->
get
().
ref_alt
,
_sub_vehicle_local_position
->
get
().
ref_timestamp
);
}
// We don't check here if states are valid or not.
// Validity checks are done in the sub-classes.
return
true
;
}
else
{
_resetSetpoints
();
return
false
;
}
}
...
...
This diff is collapsed.
Click to expand it.
src/lib/FlightTasks/tasks/FlightTask/FlightTask.hpp
+
1
−
1
View file @
e7e49d5b
...
...
@@ -161,7 +161,7 @@ protected:
/*
* Check and update local position
*/
bool
_evaluateVehicleLocalPosition
();
void
_evaluateVehicleLocalPosition
();
/**
* Set constraints to default values
...
...
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