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
bbd1dcf1
Commit
bbd1dcf1
authored
8 years ago
by
dawehr
Browse files
Options
Downloads
Patches
Plain Diff
Re-added lost log initialization from initialize_components. Fixed issue with logging units.
parent
6e70e527
No related branches found
No related tags found
No related merge requests found
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
quad/src/quad_app/initialize_components.c
+3
-0
3 additions, 0 deletions
quad/src/quad_app/initialize_components.c
quad/src/quad_app/initialize_components.h
+1
-0
1 addition, 0 deletions
quad/src/quad_app/initialize_components.h
quad/src/quad_app/log_data.c
+7
-7
7 additions, 7 deletions
quad/src/quad_app/log_data.c
with
11 additions
and
7 deletions
quad/src/quad_app/initialize_components.c
+
3
−
0
View file @
bbd1dcf1
...
...
@@ -50,6 +50,9 @@ int init_structs(modular_structs_t *structs) {
// Initialize the controller
control_algorithm_init
(
&
structs
->
parameter_struct
);
// Initialize the logging
initialize_logging
(
&
structs
->
log_struct
,
&
structs
->
parameter_struct
);
// Initialize loop timers
struct
TimerDriver
*
global_timer
=
&
structs
->
hardware_struct
.
global_timer
;
struct
TimerDriver
*
axi_timer
=
&
structs
->
hardware_struct
.
axi_timer
;
...
...
This diff is collapsed.
Click to expand it.
quad/src/quad_app/initialize_components.h
+
1
−
0
View file @
bbd1dcf1
...
...
@@ -14,6 +14,7 @@
#include
"util.h"
#include
"type_def.h"
#include
"controllers.h"
#include
"mio7_led.h"
/**
* @brief
...
...
This diff is collapsed.
Click to expand it.
quad/src/quad_app/log_data.c
+
7
−
7
View file @
bbd1dcf1
...
...
@@ -46,11 +46,11 @@ static char units_param_str[512] = {};
static
struct
str
units_output
=
{
.
str
=
units_output_str
,
.
size
=
0
,
.
capacity
=
sizeof
(
units_output_str
)};
static
struct
str
units_param
=
{
.
str
=
units_param_str
,
.
size
=
0
,
.
capacity
=
sizeof
(
units_output_str
)};
void
safe_strcat
(
struct
str
str
,
char
*
to_add
)
{
void
safe_strcat
(
struct
str
*
str
,
const
char
*
to_add
)
{
size_t
add_len
=
strlen
(
to_add
);
if
(
add_len
+
str
.
size
<=
str
.
capacity
)
{
strcpy
(
&
(
str
.
str
[
str
.
size
]),
to_add
);
str
.
size
+=
add_len
;
if
(
add_len
+
str
->
size
<=
str
->
capacity
)
{
strcpy
(
&
(
str
->
str
[
str
->
size
]),
to_add
);
str
->
size
+=
add_len
;
}
}
...
...
@@ -61,7 +61,7 @@ void addOutputToLog(log_t* log_struct, int controller_id, int output_id, char* u
log_outputs
[
n_outputs
].
sub_id
=
output_id
;
n_outputs
++
;
snprintf
(
units_buf
,
sizeof
(
units_buf
),
"
\t
%s"
,
units
);
safe_strcat
(
units_output
,
units_buf
);
safe_strcat
(
&
units_output
,
units_buf
);
}
}
void
addParamToLog
(
log_t
*
log_struct
,
int
controller_id
,
int
param_id
,
char
*
units
)
{
...
...
@@ -71,14 +71,14 @@ void addParamToLog(log_t* log_struct, int controller_id, int param_id, char* uni
log_params
[
n_params
].
sub_id
=
param_id
;
n_params
++
;
snprintf
(
units_buf
,
sizeof
(
units_buf
),
"
\t
%s"
,
units
);
safe_strcat
(
units_param
,
units_buf
);
safe_strcat
(
&
units_param
,
units_buf
);
}
}
void
initialize_logging
(
log_t
*
log_struct
,
parameter_t
*
ps
)
{
char
*
rad
=
"rad"
;
char
*
rad_s
=
"rad/s"
;
char
*
pwm_val
=
"10
u
s_dutycycle"
;
char
*
pwm_val
=
"10
n
s_dutycycle"
;
char
*
m
=
"m"
;
addOutputToLog
(
log_struct
,
ps
->
alt_pid
,
PID_CORRECTION
,
pwm_val
);
addOutputToLog
(
log_struct
,
ps
->
x_pos_pid
,
PID_CORRECTION
,
rad
);
...
...
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