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
b5731e0c
Commit
b5731e0c
authored
6 years ago
by
Dennis Mannhart
Committed by
Lorenz Meier
6 years ago
Browse files
Options
Downloads
Patches
Plain Diff
FlightTaskOffboard: only start task if control mode flags are met
parent
bf4ac7a9
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/FlightTaskOffboard.cpp
+2
-1
2 additions, 1 deletion
src/lib/FlightTasks/tasks/FlightTaskOffboard.cpp
src/modules/mc_pos_control/mc_pos_control_main.cpp
+9
-3
9 additions, 3 deletions
src/modules/mc_pos_control/mc_pos_control_main.cpp
with
11 additions
and
4 deletions
src/lib/FlightTasks/tasks/FlightTaskOffboard.cpp
+
2
−
1
View file @
b5731e0c
...
...
@@ -55,6 +55,8 @@ bool FlightTaskOffboard::initializeSubscriptions(SubscriptionArray &subscription
bool
FlightTaskOffboard
::
updateInitialize
()
{
bool
ret
=
FlightTask
::
updateInitialize
();
// require a valid triplet
ret
=
ret
&&
_sub_triplet_setpoint
->
get
().
current
.
valid
;
// require valid position / velocity in xy
return
ret
&&
PX4_ISFINITE
(
_position
(
0
))
&&
PX4_ISFINITE
(
_position
(
1
))
...
...
@@ -245,5 +247,4 @@ bool FlightTaskOffboard::update()
}
return
true
;
}
This diff is collapsed.
Click to expand it.
src/modules/mc_pos_control/mc_pos_control_main.cpp
+
9
−
3
View file @
b5731e0c
...
...
@@ -519,7 +519,7 @@ MulticopterPositionControl::task_main()
setDt
(
dt
);
if
(
_control_mode
.
flag_armed
)
{
// as soon vehicle is armed
, start
flighttask
// as soon vehicle is armed
check for
flighttask
start_flight_task
();
// arm hysteresis prevents vehicle to takeoff
// before propeller reached idle speed.
...
...
@@ -646,7 +646,7 @@ MulticopterPositionControl::task_main()
// publish attitude setpoint
// Note: this requires review. The reason for not sending
// an attitude setpoint is because for non
e
-flighttask modes
// an attitude setpoint is because for non-flighttask modes
// the attitude septoint should come from another source, otherwise
// they might conflict with each other such as in offboard attitude control.
publish_attitude
();
...
...
@@ -678,7 +678,13 @@ MulticopterPositionControl::start_flight_task()
bool
task_failure
=
false
;
// offboard
if
(
_vehicle_status
.
nav_state
==
vehicle_status_s
::
NAVIGATION_STATE_OFFBOARD
)
{
if
(
_vehicle_status
.
nav_state
==
vehicle_status_s
::
NAVIGATION_STATE_OFFBOARD
&&
(
_control_mode
.
flag_control_altitude_enabled
||
_control_mode
.
flag_control_position_enabled
||
_control_mode
.
flag_control_climb_rate_enabled
||
_control_mode
.
flag_control_velocity_enabled
||
_control_mode
.
flag_control_acceleration_enabled
))
{
int
error
=
_flight_tasks
.
switchTask
(
FlightTaskIndex
::
Offboard
);
if
(
error
!=
0
)
{
...
...
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