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
c15b114c
Commit
c15b114c
authored
7 years ago
by
Dennis Mannhart
Committed by
Beat Küng
6 years ago
Browse files
Options
Downloads
Patches
Plain Diff
FlightTaskManualAltitude: remove member setpoints and update method
parent
4b49b0ed
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/FlightTaskManualAltitude.cpp
+13
-24
13 additions, 24 deletions
src/lib/FlightTasks/tasks/FlightTaskManualAltitude.cpp
src/lib/FlightTasks/tasks/FlightTaskManualAltitude.hpp
+6
-11
6 additions, 11 deletions
src/lib/FlightTasks/tasks/FlightTaskManualAltitude.hpp
with
19 additions
and
35 deletions
src/lib/FlightTasks/tasks/FlightTaskManualAltitude.cpp
+
13
−
24
View file @
c15b114c
...
...
@@ -50,9 +50,9 @@ FlightTaskManualAltitude::FlightTaskManualAltitude(control::SuperBlock *parent,
bool
FlightTaskManualAltitude
::
activate
()
{
_pos_sp_z
=
NAN
;
_vel_sp
_z
=
0.0
f
;
return
FlightTaskManualStabilized
::
activate
()
;
bool
ret
=
FlightTaskManualStabilized
::
activate
()
;
_vel_sp
(
2
)
=
0.0
f
;
return
ret
;
}
void
FlightTaskManualAltitude
::
_scaleSticks
()
...
...
@@ -62,7 +62,7 @@ void FlightTaskManualAltitude::_scaleSticks()
/* Scale horizontal velocity with expo curve stick input*/
const
float
vel_max_z
=
(
_sticks
(
2
)
>
0.0
f
)
?
_vel_max_down
.
get
()
:
_vel_max_up
.
get
();
_vel_sp
_z
=
vel_max_z
*
_sticks_expo
(
2
);
_vel_sp
(
2
)
=
vel_max_z
*
_sticks_expo
(
2
);
}
void
FlightTaskManualAltitude
::
_updateAltitudeLock
()
...
...
@@ -72,20 +72,23 @@ void FlightTaskManualAltitude::_updateAltitudeLock()
*/
/* handle position and altitude hold */
const
bool
apply_brake_z
=
fabsf
(
_vel_sp
_z
)
<=
FLT_EPSILON
;
const
bool
apply_brake_z
=
fabsf
(
_vel_sp
(
2
)
)
<=
FLT_EPSILON
;
const
bool
stopped_z
=
(
_vel_hold_thr_z
.
get
()
<
FLT_EPSILON
||
fabsf
(
_velocity
(
2
))
<
_vel_hold_thr_z
.
get
());
if
(
apply_brake_z
&&
stopped_z
&&
!
PX4_ISFINITE
(
_pos_sp
_z
))
{
_pos_sp
_z
=
_position
(
2
);
if
(
apply_brake_z
&&
stopped_z
&&
!
PX4_ISFINITE
(
_pos_sp
(
2
)
))
{
_pos_sp
(
2
)
=
_position
(
2
);
}
else
if
(
!
apply_brake_z
)
{
_pos_sp
_z
=
NAN
;
_pos_sp
(
2
)
=
NAN
;
}
}
void
FlightTaskManualAltitude
::
_updateSetpoints
()
{
FlightTaskManualStabilized
::
_updateSetpoints
();
// get yaw setpoint
FlightTaskManualStabilized
::
_updateSetpoints
();
// get yaw and thrust setpoints
_thr_sp
*=
NAN
;
// Don't need thrust setpoint from Stabilized mode.
/* Thrust in xy are extracted directly from stick inputs. A magnitude of
* 1 means that maximum thrust along xy is required. A magnitude of 0 means no
* thrust along xy is required. The maximum thrust along xy depends on the thrust
...
...
@@ -101,19 +104,5 @@ void FlightTaskManualAltitude::_updateSetpoints()
_thr_sp
(
0
)
=
sp
(
0
);
_thr_sp
(
1
)
=
sp
(
1
);
_updateAltitudeLock
();
// get z setpoints
}
bool
FlightTaskManualAltitude
::
update
()
{
_scaleSticks
();
_updateSetpoints
();
_setPositionSetpoint
(
Vector3f
(
NAN
,
NAN
,
_pos_sp_z
));
_setVelocitySetpoint
(
Vector3f
(
NAN
,
NAN
,
_vel_sp_z
));
_setYawSetpoint
(
_yaw_sp
);
_setYawspeedSetpoint
(
_yaw_rate_sp
);
_setThrustSetpoint
(
Vector3f
(
_thr_sp
(
0
),
_thr_sp
(
1
),
NAN
));
return
true
;
_updateAltitudeLock
();
}
This diff is collapsed.
Click to expand it.
src/lib/FlightTasks/tasks/FlightTaskManualAltitude.hpp
+
6
−
11
View file @
c15b114c
/****************************************************************************
*
* Copyright (c) 201
7
PX4 Development Team. All rights reserved.
* Copyright (c) 201
8
PX4 Development Team. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
...
...
@@ -50,18 +50,13 @@ public:
bool
activate
()
override
;
bool
update
()
override
;
protected:
float
_vel_sp_z
{};
/**< Scaled velocity from stick. During altitude lock it is equal to NAN. */
float
_pos_sp_z
{};
/**< Setpoint in z during lock. Otherwise NAN. */
control
::
BlockParamFloat
_vel_max_down
;
/**< Maximum speed allowed to go up. */
control
::
BlockParamFloat
_vel_max_up
;
/**< Maximum speed allowed to go down. */
control
::
BlockParamFloat
_vel_max_down
;
/**< maximum speed allowed to go up */
control
::
BlockParamFloat
_vel_max_up
;
/**< maximum speed allowed to go down */
control
::
BlockParamFloat
_vel_hold_thr_z
;
/**< velocity threshold to switch back into vertical position hold */
void
_updateAltitudeLock
();
/**<
C
hecks for position lock
.
*/
void
_updateSetpoints
()
override
;
/**<
U
pdates all setpoints
.
*/
void
_scaleSticks
()
override
;
/**<
S
cales sticks to velocity in z
.
*/
void
_updateAltitudeLock
();
/**<
c
hecks for position lock */
void
_updateSetpoints
()
override
;
/**<
u
pdates all setpoints */
void
_scaleSticks
()
override
;
/**<
s
cales sticks to velocity in z */
};
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