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
136e23f4
Commit
136e23f4
authored
7 years ago
by
dawehr
Browse files
Options
Downloads
Patches
Plain Diff
Added node for pitch trim so it can be set remotely.
parent
4b1cf027
No related branches found
No related tags found
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
quad/src/quad_app/control_algorithm.c
+11
-1
11 additions, 1 deletion
quad/src/quad_app/control_algorithm.c
quad/src/quad_app/type_def.h
+2
-0
2 additions, 0 deletions
quad/src/quad_app/type_def.h
with
13 additions
and
1 deletion
quad/src/quad_app/control_algorithm.c
+
11
−
1
View file @
136e23f4
...
...
@@ -59,6 +59,10 @@ int control_algorithm_init(parameter_t * ps)
ps
->
cur_pitch
=
graph_add_defined_block
(
graph
,
BLOCK_CONSTANT
,
"Pitch"
);
// ID 15
ps
->
cur_roll
=
graph_add_defined_block
(
graph
,
BLOCK_CONSTANT
,
"Roll"
);
ps
->
cur_yaw
=
graph_add_defined_block
(
graph
,
BLOCK_CONSTANT
,
"Yaw"
);
// Sensor trims
ps
->
pitch_trim
=
graph_add_defined_block
(
graph
,
BLOCK_CONSTANT
,
"Pitch trim"
);
ps
->
pitch_trim_add
=
graph_add_defined_block
(
graph
,
BLOCK_ADD
,
"Pitch trim add"
);
// Yaw angular velocity PID
// theta_dot is the angular velocity about the y-axis
// phi_dot is the angular velocity about the x-axis
...
...
@@ -90,10 +94,14 @@ int control_algorithm_init(parameter_t * ps)
ps
->
pos_time
=
graph_add_defined_block
(
graph
,
BLOCK_CONSTANT
,
"Ts_VRPN"
);
// Connect pitch PID chain
// Trims
graph_set_source
(
graph
,
ps
->
pitch_trim_add
,
ADD_SUMMAND1
,
ps
->
pitch_trim
,
CONST_VAL
);
graph_set_source
(
graph
,
ps
->
pitch_trim_add
,
ADD_SUMMAND2
,
ps
->
cur_pitch
,
CONST_VAL
);
// Controllers
graph_set_source
(
graph
,
ps
->
pitch_r_pid
,
PID_SETPOINT
,
ps
->
pitch_pid
,
PID_CORRECTION
);
graph_set_source
(
graph
,
ps
->
pitch_r_pid
,
PID_CUR_POINT
,
ps
->
theta_dot
,
CONST_VAL
);
graph_set_source
(
graph
,
ps
->
pitch_r_pid
,
PID_DT
,
ps
->
angle_time
,
CONST_VAL
);
graph_set_source
(
graph
,
ps
->
pitch_pid
,
PID_CUR_POINT
,
ps
->
cur_
pitch
,
CONST_VAL
);
graph_set_source
(
graph
,
ps
->
pitch_pid
,
PID_CUR_POINT
,
ps
->
pitch
_trim_add
,
ADD_SUM
);
//graph_set_source(graph, ps->pitch_pid, PID_CUR_POINT, ps->vrpn_pitch, CONST_VAL);
graph_set_source
(
graph
,
ps
->
pitch_pid
,
PID_DT
,
ps
->
angle_time
,
CONST_VAL
);
...
...
@@ -187,6 +195,8 @@ int control_algorithm_init(parameter_t * ps)
graph_set_param_val
(
graph
,
ps
->
clamp_d_pwmY
,
BOUNDS_MIN
,
-
PWM_DIFF_BOUNDS
);
graph_set_param_val
(
graph
,
ps
->
clamp_d_pwmY
,
BOUNDS_MAX
,
PWM_DIFF_BOUNDS
);
// Set trims
graph_set_param_val
(
graph
,
ps
->
pitch_trim
,
CONST_SET
,
0
.
02
);
// Initial value for sampling periods
graph_set_param_val
(
graph
,
ps
->
pos_time
,
CONST_SET
,
0
.
04
);
...
...
This diff is collapsed.
Click to expand it.
quad/src/quad_app/type_def.h
+
2
−
0
View file @
136e23f4
...
...
@@ -341,6 +341,8 @@ typedef struct parameter_t {
// "trim" for autonomous
int
throttle_trim
;
int
throttle_trim_add
;
int
pitch_trim
;
int
pitch_trim_add
;
}
parameter_t
;
/**
...
...
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