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
67c08460
Commit
67c08460
authored
6 years ago
by
bresch
Committed by
Roman Bapst
6 years ago
Browse files
Options
Downloads
Patches
Plain Diff
Vel smooth - Improve position lock/unlock detection
parent
d9edcfdc
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
src/lib/FlightTasks/tasks/ManualPositionSmoothVel/FlightTaskManualPositionSmoothVel.cpp
+8
-11
8 additions, 11 deletions
...alPositionSmoothVel/FlightTaskManualPositionSmoothVel.cpp
with
8 additions
and
11 deletions
src/lib/FlightTasks/tasks/ManualPositionSmoothVel/FlightTaskManualPositionSmoothVel.cpp
+
8
−
11
View file @
67c08460
...
...
@@ -75,7 +75,6 @@ void FlightTaskManualPositionSmoothVel::_updateSetpoints()
}
Vector2f
vel_xy_sp
=
Vector2f
(
&
_velocity_setpoint
(
0
));
Vector2f
vel_xy_sp_smooth
=
Vector2f
(
&
_vel_sp_smooth
(
0
));
float
jerk
[
3
]
=
{
_jerk_max
.
get
(),
_jerk_max
.
get
(),
_jerk_max
.
get
()};
float
jerk_xy
=
_jerk_max
.
get
();
...
...
@@ -126,22 +125,20 @@ void FlightTaskManualPositionSmoothVel::_updateSetpoints()
Vector3f
accel_sp_smooth
;
for
(
int
i
=
0
;
i
<
3
;
++
i
)
{
_smoothing
[
i
].
setCurrentPosition
(
_position
(
i
));
if
(
!
_position_lock_xy_active
)
{
_smoothing
[
i
].
setCurrentPosition
(
_position
(
i
));
}
_smoothing
[
i
].
integrate
(
accel_sp_smooth
(
i
),
_vel_sp_smooth
(
i
),
pos_sp_smooth
(
i
));
_velocity_setpoint
(
i
)
=
_vel_sp_smooth
(
i
);
// Feedforward
}
// Check for position lock transition
Vector2f
accel_setpoint_xy_smooth
=
Vector2f
(
&
accel_sp_smooth
(
0
));
if
(
vel_xy_sp_smooth
.
length
()
<
0.002
f
&&
accel_setpoint_xy_smooth
.
length
()
<
.2
f
&&
if
(
Vector2f
(
_vel_sp_smooth
).
length
()
<
0.01
f
&&
Vector2f
(
accel_sp_smooth
).
length
()
<
.2
f
&&
sticks_expo_xy
.
length
()
<=
FLT_EPSILON
)
{
if
(
!
_position_lock_xy_active
)
{
_position_setpoint_xy_locked
(
0
)
=
pos_sp_smooth
(
0
);
_position_setpoint_xy_locked
(
1
)
=
pos_sp_smooth
(
1
);
}
_position_setpoint_xy_locked
(
0
)
=
pos_sp_smooth
(
0
);
_position_setpoint_xy_locked
(
1
)
=
pos_sp_smooth
(
1
);
_position_lock_xy_active
=
true
;
}
...
...
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