Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
R
raspinobo
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
CI / CD Analytics
Repository Analytics
Value Stream Analytics
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
blaar
raspinobo
Commits
545565f0
Commit
545565f0
authored
Mar 12, 2020
by
Arnaud Blanchard
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Introduce armdillo and Z transform
parent
0276bedc
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
25 additions
and
4 deletions
+25
-4
bl_raspi.cpp
bl_raspi.cpp
+4
-4
raspinobo.cpp
raspinobo.cpp
+21
-0
No files found.
bl_raspi.cpp
View file @
545565f0
...
...
@@ -14,8 +14,7 @@
#include <time.h>
#include <math.h>
#include <armadillo>
using
namespace
arma
;
#include <vector>
...
...
@@ -100,6 +99,8 @@ inline void Ohm_input::spike(){
/*index++;
if (index==buffer_size) index=0;*/
// activated=tau/ns_per_it;
activated
=
1
;
}
...
...
@@ -130,8 +131,7 @@ void *thread_loop(void*){
// initial_us=3000000*(int)(*raspi.ptime_us/3000000)-3000000;
// update_time();
vec
A
=
linspace
(
0.9
,
1.1
,
10
);
for
(
auto
&
input
:
ohm_inputs
){
*
raspi
.
gpfset0
|=
input
.
flag
;
//Set pin high
raspi
.
set_pin_mode
(
input
.
pin
,
raspi
.
PULL_OFF
);
...
...
raspinobo.cpp
View file @
545565f0
...
...
@@ -14,6 +14,8 @@
#include "blc_program.h"
#include "blc_channel.h"
#include "bl_raspi.h"
#include <armadillo>
static
const
int
SOUND_PIN
=
13
;
...
...
@@ -23,6 +25,7 @@ static const int LEFT_MOTOR_PIN=26;
static
const
int
RIGHT_MOTOR_PIN
=
20
;
using
namespace
std
;
using
namespace
arma
;
static
uchar
gaussian_cdf
(
uint32_t
s
,
float
mu
,
float
var
){
return
static_cast
<
uchar
>
((
1
+
erf
((
s
-
mu
)
/
sqrt
(
2
*
var
)))
*
255
/
2
);
//var+1 is to be sure it is not null
...
...
@@ -144,6 +147,20 @@ int main(int argc, char **argv){
uchar
gain
;
blc_channel
input
(
"/input"
,
BLC_CHANNEL_WRITE
,
'
FL64
'
,
'
NDEF
'
,
1
,
2
);
Row
<
u32
>
inputs
(
input
.
uints32
,
input
.
total_length
,
false
,
true
);
colvec
Z
=
linspace
<
colvec
>
(
0.99999
,
0.999999999999
,
100
);
blc_channel
output
(
"/output"
,
BLC_CHANNEL_WRITE
,
'
FL64
'
,
'
NDEF
'
,
2
,
Z
.
size
(),
inputs
.
size
());
blc_channel
transfert
(
"/transfert"
,
BLC_CHANNEL_WRITE
,
'
FL64
'
,
'
NDEF
'
,
1
,
Z
.
size
());
mat
outputs
(
output
.
doubles
,
Z
.
size
(),
inputs
.
size
(),
false
,
true
);
colvec
transferts
(
transfert
.
doubles
,
Z
.
size
(),
false
,
true
);
rowvec
dinputs
(
inputs
.
size
());
BLC_COMMAND_LOOP
(
us_period
){
if
(
blc_loop_iteration
!=
0
)
blc_eprint_cursor_up
(
1
);
...
...
@@ -152,6 +169,10 @@ int main(int argc, char **argv){
else
delay_ns
=
1000000000
-
previous_ns
+
timestamp
.
tv_nsec
;
previous_ns
=
timestamp
.
tv_nsec
;
dinputs
=
conv_to
<
dinputs
>::
from
(
inputs
);
outputs
+
dinputs
+
(
outputs
.
each_col
()
%
Z
).
each_row
();
// z
transferts
=
outputs
.
col
(
0
)
/
outputs
.
col
(
1
);
for
(
auto
&
neuron
:
neurons
){
neuron
.
update
();
}
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment