-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathcode_planning.rtf
74 lines (73 loc) · 3.16 KB
/
code_planning.rtf
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
74
{\rtf1\ansi\ansicpg1252\cocoartf1404\cocoasubrtf460
{\fonttbl\f0\fswiss\fcharset0 Helvetica;}
{\colortbl;\red255\green255\blue255;}
\paperw11900\paperh16840\margl1440\margr1440\vieww13580\viewh16280\viewkind0
\pard\tx566\tx1133\tx1700\tx2267\tx2834\tx3401\tx3968\tx4535\tx5102\tx5669\tx6236\tx6803\pardirnatural\partightenfactor0
\f0\fs24 \cf0 Structure affenspinner code\
\
Main \
Polled tasks\
The update of what should be displayed should be updated in an interrupt \
and the actual update of the display could be done at an irregular interval.. as often as possible during the available time ?\
The timer which times the duration of each segment should be updated pretty regularly. i.e. a few segments could probably pass without noticeable effect to the viewer. \
\
\
i2c library\
No idea what is involved \
Send messages \
Read messages from the DMP buffer when it\'92s free\
Need to optimise the refresh rate of the DMP, and possibly adjust the DMP rate on the fly to assure that the segment location gets updated often enough\
\
\
Structure \
Files \
\
physical.h\
- offset of the device from the rotation point of the wheel\
- max speed of the wheel in rad/s or kph. \
- \
\
\
Main.c\
Runs the tasks from display.c, prepnext.c, model.c\
Can be done on modulo basis. i.e. only every n th cycle. if x%4: if x%2: \
\
\
display.c\
alternate_display - runs as a task in main\
- displays one element of the current section of memory. Only one cathode at a time for consistent brightness.\
- 8x registers loaded for this. 8x8b = 4x16b. \
\
prepnext - runs as a task in main\
- prepares the data for the next segment into memory \
- gets called immediately after the alternate_display until the alternate display is loaded\
- switcher keeps track of when to change the image or reset the segment counter\
\
switcher.c\
- keeps track of what the current image is and the location in the memory. as each segment is loaded into memory this module may run. \
\
model.c - runs as a task in main - HARD -\
- new data for the task comes via the DMP interrupt\
- needs to maintain three integrals. the integral of the gyro, integral of the angular acceleration , integral of the angular velocity. \
- Needs to update the timer regularly. \
- timer should never be perfectly right but keep a track of the actual segment duration and also keep track of the total time taken i.e. at the end of the segment the time should be less than 1/180th of the time..\
to find the model we can measure the values over the cycle of the wheel\
\
\
the model should be of the velocity (or the accel??) could differentiate to determine the acceleration behaviour. \
- notes \
- the troughs/peaks indicate the max and min velocities, and the acceleration transitions (through zero)\
- Determine the angle directly from the acceleration?? \
- I forget the problems with the acceleration but something doesn\'92t work\
\
Consider doing a control loop? will it be possible on a fixed control loop? \
\
\
i2c.c\
- gets initiated when the buffer interrupt is triggered\
\
magnet.c\
Used to calculate the interval based on the timer value from the magnet. Should be self updating depending on the velocity. Should also be able to shut down the main tasks \
\
\
}