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
573dd89c
Commit
573dd89c
authored
6 years ago
by
Matthias Grob
Browse files
Options
Downloads
Patches
Plain Diff
PositionControl: addess @bkueng 's comment in #11056
parent
f9ec0cd5
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/modules/mc_pos_control/PositionControl.cpp
+6
-13
6 additions, 13 deletions
src/modules/mc_pos_control/PositionControl.cpp
src/modules/mc_pos_control/PositionControl.hpp
+1
-2
1 addition, 2 deletions
src/modules/mc_pos_control/PositionControl.hpp
with
7 additions
and
15 deletions
src/modules/mc_pos_control/PositionControl.cpp
+
6
−
13
View file @
573dd89c
...
...
@@ -55,24 +55,17 @@ void PositionControl::updateState(const PositionControlStates &states)
_vel_dot
=
states
.
acceleration
;
}
void
PositionControl
::
_setCtrlFlag
Tr
ue
(
)
void
PositionControl
::
_setCtrlFlag
(
bool
val
ue
)
{
for
(
int
i
=
0
;
i
<=
2
;
i
++
)
{
_ctrl_pos
[
i
]
=
_ctrl_vel
[
i
]
=
true
;
}
}
void
PositionControl
::
_setCtrlFlagFalse
()
{
for
(
int
i
=
0
;
i
<=
2
;
i
++
)
{
_ctrl_pos
[
i
]
=
_ctrl_vel
[
i
]
=
false
;
_ctrl_pos
[
i
]
=
_ctrl_vel
[
i
]
=
value
;
}
}
bool
PositionControl
::
updateSetpoint
(
const
vehicle_local_position_setpoint_s
&
setpoint
)
{
//
Only for logging purpose:
by default we use the entire position-velocity control-loop pipeline
_setCtrlFlag
T
rue
(
);
// by default we use the entire position-velocity control-loop pipeline
(flag only for logging purpose)
_setCtrlFlag
(
t
rue
);
_pos_sp
=
Vector3f
(
setpoint
.
x
,
setpoint
.
y
,
setpoint
.
z
);
_vel_sp
=
Vector3f
(
setpoint
.
vx
,
setpoint
.
vy
,
setpoint
.
vz
);
...
...
@@ -212,8 +205,8 @@ bool PositionControl::_interfaceMapping()
// throttle down such that vehicle goes down with
// 70% of throttle range between min and hover
_thr_sp
(
2
)
=
-
(
MPC_THR_MIN
.
get
()
+
(
MPC_THR_HOVER
.
get
()
-
MPC_THR_MIN
.
get
())
*
0.7
f
);
// position and velocity control-loop is
not
used (
note:
only for logging purpose)
_setCtrlFlag
F
alse
(
);
// position/velocity control-loop is not used
// position and velocity control-loop is
currently un
used (
flag
only for logging purpose)
_setCtrlFlag
(
f
alse
);
}
return
!
(
failsafe
);
...
...
This diff is collapsed.
Click to expand it.
src/modules/mc_pos_control/PositionControl.hpp
+
1
−
2
View file @
573dd89c
...
...
@@ -204,8 +204,7 @@ private:
void
_positionController
();
/** applies the P-position-controller */
void
_velocityController
(
const
float
&
dt
);
/** applies the PID-velocity-controller */
void
_setCtrlFlagTrue
();
/**< set control-loop flags to true (only required for logging) */
void
_setCtrlFlagFalse
();
/**< set control-loop flags to false (only required for logging) */
void
_setCtrlFlag
(
bool
value
);
/**< set control-loop flags (only required for logging) */
matrix
::
Vector3f
_pos
{};
/**< MC position */
matrix
::
Vector3f
_vel
{};
/**< MC velocity */
...
...
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