Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
M
MicroCART
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Deploy
Releases
Model registry
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Distributed Autonomous Networked Control Lab
MicroCART
Commits
406da3bc
Commit
406da3bc
authored
7 years ago
by
dawehr
Browse files
Options
Downloads
Patches
Plain Diff
Low pass filtering flow at 7Hz.
parent
750fdb2e
No related branches found
No related tags found
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
quad/src/quad_app/sensor_processing.c
+12
-9
12 additions, 9 deletions
quad/src/quad_app/sensor_processing.c
with
12 additions
and
9 deletions
quad/src/quad_app/sensor_processing.c
+
12
−
9
View file @
406da3bc
...
...
@@ -24,11 +24,11 @@ int sensor_processing_init(sensor_t* sensor_struct) {
sensor_struct
->
accel_x_filt
=
filter_make_state
(
a0
,
a1
,
a2
,
b1
,
b2
);
sensor_struct
->
accel_y_filt
=
filter_make_state
(
a0
,
a1
,
a2
,
b1
,
b2
);
sensor_struct
->
accel_z_filt
=
filter_make_state
(
a0
,
a1
,
a2
,
b1
,
b2
);
float
vel_a0
=
0
.
0
4125344
;
float
vel_a1
=
0
.
0
8250688
;
float
vel_a2
=
0
.
0
4125344
;
float
vel_b1
=
-
1
.
348964
6
;
float
vel_b2
=
0
.
51397836
;
float
vel_a0
=
0
.
0
0
98
;
float
vel_a1
=
0
.
0
1
95
;
float
vel_a2
=
0
.
0
0
98
;
float
vel_b1
=
-
1
.
581
6
;
float
vel_b2
=
0
.
6853
;
sensor_struct
->
flow_x_filt
=
filter_make_state
(
vel_a0
,
vel_a1
,
vel_a2
,
vel_b1
,
vel_b2
);
sensor_struct
->
flow_y_filt
=
filter_make_state
(
vel_a0
,
vel_a1
,
vel_a2
,
vel_b1
,
vel_b2
);
return
0
;
...
...
@@ -41,8 +41,11 @@ int sensor_processing_init(sensor_t* sensor_struct) {
// Focal length in mm = 16
static
float
focal_length_px
=
16
.
0
/
(
4
.
0
f
*
6
.
0
f
)
*
1000
.
0
f
;
//original focal lenght: 12mm pixelsize: 6um, binning 4 enabled
void
flow_to_vel
(
px4flow_t
*
flow_data
,
double
distance
)
{
flow_data
->
xVel
=
distance
*
-
flow_data
->
flowX
/
focal_length_px
/
get_last_loop_time
();
flow_data
->
yVel
=
distance
*
-
flow_data
->
flowY
/
focal_length_px
/
get_last_loop_time
();
double
loop_time
=
get_last_loop_time
();
if
(
loop_time
!=
0
)
{
flow_data
->
xVel
=
distance
*
flow_data
->
flowX
/
focal_length_px
/
get_last_loop_time
();
flow_data
->
yVel
=
distance
*
flow_data
->
flowY
/
focal_length_px
/
get_last_loop_time
();
}
}
int
sensor_processing
(
log_t
*
log_struct
,
user_input_t
*
user_input_struct
,
raw_sensor_t
*
raw_sensor_struct
,
sensor_t
*
sensor_struct
)
...
...
@@ -118,9 +121,9 @@ int sensor_processing(log_t* log_struct, user_input_t *user_input_struct, raw_se
// Simply copy optical flow data
sensor_struct
->
optical_flow
=
raw_sensor_struct
->
optical_flow
;
//sensor_struct->optical_flow.xVel = biquad_execute(&sensor_struct->flow_x_filt, -sensor_struct->optical_flow.xVel);
//sensor_struct->optical_flow.yVel = biquad_execute(&sensor_struct->flow_y_filt, -sensor_struct->optical_flow.yVel);
flow_to_vel
(
&
sensor_struct
->
optical_flow
,
raw_sensor_struct
->
lidar_distance_m
);
sensor_struct
->
optical_flow
.
xVel
=
biquad_execute
(
&
sensor_struct
->
flow_x_filt
,
-
sensor_struct
->
optical_flow
.
xVel
);
sensor_struct
->
optical_flow
.
yVel
=
biquad_execute
(
&
sensor_struct
->
flow_y_filt
,
-
sensor_struct
->
optical_flow
.
yVel
);
/*
* Altitude double complementary filter
...
...
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