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
955bcd56
Commit
955bcd56
authored
8 years ago
by
dawehr
Browse files
Options
Downloads
Patches
Plain Diff
Fixed bug with populating the exec_input_vals array.
parent
11a22952
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/computation_graph/src/computation_graph.c
+7
-3
7 additions, 3 deletions
quad/computation_graph/src/computation_graph.c
quad/computation_graph/src/main.c
+4
-4
4 additions, 4 deletions
quad/computation_graph/src/main.c
with
11 additions
and
7 deletions
quad/computation_graph/src/computation_graph.c
+
7
−
3
View file @
955bcd56
...
...
@@ -103,10 +103,14 @@ void graph_compute_node_rec(struct computation_graph *graph, int node_id, int de
if
(
graph
->
nodes
[
src_cntl_id
].
processed_state
==
UNPROCESSED
)
{
graph_compute_node_rec
(
graph
,
src_cntl_id
,
depth
+
1
);
}
int
src_output_id
=
node
->
input_srcs
[
input_id
].
controller_output
;
exec_input_vals
[
input_id
]
=
graph
->
nodes
[
src_cntl_id
].
output_values
[
src_output_id
];
}
}
// Populate the exec_input_vals array for computation
for
(
input_id
=
0
;
input_id
<
node
->
type
->
n_inputs
;
input_id
++
)
{
int
src_cntl_id
=
node
->
input_srcs
[
input_id
].
controller_id
;
int
src_output_id
=
node
->
input_srcs
[
input_id
].
controller_output
;
exec_input_vals
[
input_id
]
=
graph
->
nodes
[
src_cntl_id
].
output_values
[
src_output_id
];
}
(
*
node
->
type
->
execute
)(
node
->
state
,
node
->
param_values
,
exec_input_vals
,
node
->
output_values
);
node
->
processed_state
=
PROCESSED
;
}
...
...
@@ -140,7 +144,7 @@ int export_dot(const struct computation_graph* graph, FILE* of) {
fprintf
(
of
,
"|<f%d> [%s=%.3f]
\n
"
,
j
+
1
+
node
->
type
->
n_inputs
,
node
->
type
->
param_names
[
j
],
node
->
param_values
[
j
]);
}
fprintf
(
of
,
"
\"
]
\n
"
);
// Close label bracket
//
//
Make connections from
for
(
j
=
0
;
j
<
node
->
type
->
n_inputs
;
j
++
)
{
struct
graph_node
*
src_node
=
&
graph
->
nodes
[
node
->
input_srcs
[
j
].
controller_id
];
int
output_id
=
node
->
input_srcs
[
j
].
controller_output
;
...
...
This diff is collapsed.
Click to expand it.
quad/computation_graph/src/main.c
+
4
−
4
View file @
955bcd56
...
...
@@ -8,9 +8,9 @@
int
main
()
{
struct
computation_graph
*
graph
=
create_graph
();
int
const1
=
graph_add_node_const
(
graph
,
"Const
1
"
);
int
const1
=
graph_add_node_const
(
graph
,
"Const
2
"
);
graph_set_param_val
(
graph
,
const1
,
CONST_SET
,
2
);
int
const2
=
graph_add_node_const
(
graph
,
"Const
2
"
);
int
const2
=
graph_add_node_const
(
graph
,
"Const
1
"
);
graph_set_param_val
(
graph
,
const2
,
CONST_SET
,
3
);
int
add1_id
=
graph_add_node_add
(
graph
,
"Add"
);
...
...
@@ -22,8 +22,8 @@ int main() {
graph_set_source
(
graph
,
gain1_id
,
GAIN_INPUT
,
add1_id
,
ADD_SUM
);
int
mult1_id
=
graph_add_node_mult
(
graph
,
"Mult"
);
graph_set_source
(
graph
,
mult1_id
,
MULT_MULTIPLICAND
1
,
gain1_id
,
GAIN_RESULT
);
graph_set_source
(
graph
,
mult1_id
,
MULT_MULTIPLICAND
2
,
const1
,
CONST_VAL
);
graph_set_source
(
graph
,
mult1_id
,
MULT_MULTIPLICAND
2
,
gain1_id
,
GAIN_RESULT
);
graph_set_source
(
graph
,
mult1_id
,
MULT_MULTIPLICAND
1
,
const1
,
CONST_VAL
);
graph_compute_node
(
graph
,
mult1_id
);
...
...
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