-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathSegwayANN.rct
74 lines (51 loc) · 2.32 KB
/
SegwayANN.rct
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
diagram SegwayANN
interface ANNInput {
event anewError:real
event adiff:real
}
interface ANNOutput {
event angleOutputE:real
}
module SegwayANN {
controller SegwayController {
uses HallSensorsI uses IMUI uses AnglePIDVars requires MotorsI requires InterruptsI
sref stm_ref0 = BalanceSTM
connection SegwayController on leftMotorVelocity to stm_ref0 on leftMotorVelocity
connection SegwayController on rightMotorVelocity to stm_ref0 on rightMotorVelocity
connection SegwayController on gyroX to stm_ref0 on gyroX
connection SegwayController on gyroY to stm_ref0 on gyroY
connection SegwayController on gyroZ to stm_ref0 on gyroZ
connection stm_ref0 on anewError to SegwayController on anewError
connection stm_ref0 on adiff to SegwayController on adiff
connection stm_ref2 on speedOutputE to stm_ref0 on speedOutputE
connection stm_ref0 on snewError to stm_ref2 on snewError
sref stm_ref2 = SpeedPID
connection stm_ref0 on rdiff to stm_ref3 on rdiff
sref stm_ref3 = RotationPID
connection SegwayController on angle to stm_ref0 on angle
connection stm_ref3 on rotationOutputE to stm_ref0 on rotationOutputE
connection SegwayController on angleOutputE to stm_ref0 on angleOutputE
}
rref rp_ref0 = SegwayRP
anncontroller AnglePIDANN {
params { inputcontext {
ordevent anewError:real 1
ordevent adiff:real 2
}
outputcontext {
ordevent angleOutputE:real 1
}
layerstructure < 1 , 1 > weights < < < 1.22838 , 0.132874 > > , < < 0.744636 > > > biases < < 0.125424 > , < - 0.107753 > > activationfunction relu
inRanges <(|-30.0, 30.0|), (|-250.0, 250.0|)> outRanges <(| -1950.0, 1950.0|)> annRange (| 0.0,1.0|)
}
}
connection rp_ref0 on gyroX to SegwayController on gyroX ( _async )
connection rp_ref0 on gyroY to SegwayController on gyroY ( _async )
connection rp_ref0 on gyroZ to SegwayController on gyroZ ( _async )
connection SegwayController on anewError to AnglePIDANN on anewError
connection AnglePIDANN on angleOutputE to SegwayController on angleOutputE
connection rp_ref0 on angle to SegwayController on angle ( _async )
connection SegwayController on adiff to AnglePIDANN on adiff
connection rp_ref0 on leftMotorVelocity to SegwayController on leftMotorVelocity ( _async )
connection rp_ref0 on rightMotorVelocity to SegwayController on rightMotorVelocity ( _async )
}