summaryrefslogtreecommitdiff
path: root/SoftwareFunctionalSpecJune2003.mdwn
blob: 283b3da35ea19d41113ee2d2b76274a9b36c405e (plain)
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
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
# <a name="Title and Scope"></a> Title and Scope

Software Functional Specification

This document gives a functional description of Flight Computer software to be created for the June 2003 launch.

Phrases in **_bold italic_** are gaps to be filled in and solicitation of better description.

# <a name="Hardware Architecture"></a> Hardware Architecture

[[fig1\_hardware.png|SoftwareFunctionalSpecJune2003/fig1_hardware.png]]

Figure 1 gives a brief overview of the hardware connections to/from the Flight Computer. This figure is a simple block diagram intended only to show basic connections of the Flight Computer. For more details of the hardware, consult the hardware specifications at [[FlightComputer]] and [[BlockDiagram]].

The Flight Computer has an attachment to the CAN bus, over which it exchanges CAN messages with the Pyro/2m, GPS, IMU, ATV and APS (Avionics Power System) nodes.

The Flight Computer has a connection to an IEEE 802.11 [[WiFi]] transceiver, over which it exchanges message with the Ground Station.

The Flight Computer has 128MB (32MB x 32) of non-volatile flash memory used as a "flash" hard disk (for program and data storage).

# <a name="Software Architecture"></a> Software Architecture

[[fig2\_software.png|SoftwareFunctionalSpecJune2003/fig2_software.png]]

**_Amendment: SMART distributes its own IMU messages instead of sending to the CAN reader_**

The Flight Computer software will be implemented as a set of cooperating processes which exchange message by reading and writing named pipes. Figure 2 shows the process boundaries and message flows.

## <a name="Manager Process"></a> Manager Process

The Manager Process supervises all the other processes. It is responsible for:

- starting all processes initially
- watching for error conditions
- restarting process after their death
- perform orderly shutdown when commanded

**_missing: how does Manager communicate with Ground Station?_**

## <a name="Message Formats"></a> Message Formats

There are three message formats:

- **CANbus message format** Messages on the CAN bus

    typedef struct {
        u_int32_t cm_time;   /* 25us timestamp counter */
        unsigned  cm_id : 11;   /* message id */
        unsigned  cm_rtr : 1;   /* RTR bit */
        unsigned  cm_len : 4;   /* Length of body */
        u_int8_t  cm_body[8];   /* message bytes */
    } CAN_MSG;

- **Airlink message format** FIFO\_MSG with the NET\_MSG union filled in is used on the [[WiFi]] link. Fields are in network byte order.

    typedef struct {
        u_int32_t   nm_time;        /* 25us timestamp counter */
        u_int16_t   nm_id;          /* (id << 5) | (rtr << 4) | len */
        u_int8_t    nm_body[8];     /* message bytes (network byte order if numeric) */
    } NET_MSG;

- **Fifo message format** Used within the Flight Computer.

    typedef struct {
        FM_TAG   fm_tag; /* enum of all message types */
        union {
            CAN_MSG    fm_can;
            NET_MSG    fm_net;
            STRING_MSG fm_string;
        } fm_u;
    } FIFO_MSG;

## <a name="CAN Reader Process"></a> CAN Reader Process

Reads from the CAN bus. Converts messages from CANbus message format to Fifo message format.

- reads messages from CAN bus
- produces 5 output streams in Fifo message format.

1. all CAN messages are written to Logger Process input pipe
2. a subset **_need filter description_** of messages are written to the input pipe of [[FC2Net]] Process
3. all CAN messages are written to the input pipe of the Sequencer Process
4. GPS messages are written to the input pipe of the SMART Process
5. IMU messages are written to the input pipe of the SMART Process

## <a name="CAN Writer Process"></a> CAN Writer Process

Converts messages from Fifo message format to CANbus message format. Writes to the CAN bus.

- opens a named pipe for input
- expects 3 inputs in Fifo message format:

1. messages from [[Net2FC]] Process
2. messages from Sequencer Process **_guess: state transitions_**
3. messages from SMART Process: **_fact check:_** GPS messages to be sent to ATV node

- output: for each message received:

1. convert to CANbus message format
2. write to CAN bus

## <a name="FC2Net Process"></a> [[FC2Net]] Process

Implements [[WiFi]] downlink to Ground Station.

- opens a named pipe for input
- expects 3 inputs in Fifo message format:

1. filtered messages from CAN Reader Process
2. filtered messages from Sequencer Process
3. filtered messages from SMART Process

- output

1. opens a UDP socket over the [[WiFi]] device to [[RocketView]] in Ground Station, creating a downlink
2. all messages received are written to the socket.
3. all messages are written in airlink message format

## <a name="Net2FC Process"></a> [[Net2FC]] Process

Implements [[WiFi]] uplink from Ground Station.

- input

1. opens a **_fact check_** UDP socket over the [[WiFi]] device from **_name of cooperating process_** in Ground Station, creating an uplink
2. reads all messages received on the socket.
3. incoming messages are in airlink message format

- produces 2 output streams in Fifo message format:

1. all messages received are written to the input pipe of the Sequencer Process
2. all messages received are written to the input pipe of the CAN Writer Process

## <a name="Logger Process"></a> Logger Process

Implements a non-volatile log of all CAN messages. Expects and writes messages in Fifo message format.

- opens a named pipe for input
- input: reads all messages received on the pipe
- output

1. all messages received are written to non-volatile flash memory
2. when flash memory becomes full, oldest data is overwritten first

## <a name="SMART Process"></a> SMART Process

Smart Module Assembling Realtime Tasks

Process imu, gps, etc. data to determine position in space. Detect launch, apogee etc. Dispatch virtual CAN message to Logger, [[FC2Net]], and Sequencer (position updates).

Transform GPS serial data into position messages **_Jamey, need better description here_**

Transform IMU messages from **_Jamey, need better description here_**

- opens a named pipe for input
- expects 2 inputs:

1. GPS messages from the CAN Reader Process
2. IMU messages from the CAN Reader Process

- produces 4 output streams:

1. **_transformed_** GPS messages are written to the input pipe of CAN Writer Process
2. **_transformed_** IMU messages are written to:
  1. the input pipe of the Logger Process
  2. the input pipe of [[FC2Net]] Process **_(filtered)_**
  3. the input pipe of the Sequencer Process

## <a name="Sequencer Process"></a> Sequencer Process

Implements the flight state machine.

**_Larry, Nate: this would be a good place to embed your state machine design, or a link to it if you have a separate document._**

Implements recovery backup timer. **_better description needed_**

- **_initiates recovery backup timer_**
- opens a named pipe for input
- expects 3 inputs:

1. messages from the CAN Reader Process
2. messages from the [[Net2FC]] Process
3. position updates from the SMART Process

- produces 2 output streams:

1. a subset **_need filter description: commands?_** of messages are written to the input pipe of CAN Writer Process
2. a subset **_need filter description: status updates?_** of messages are written to the input pipe of [[FC2Net]] Process

- [[figure_source.ppt]]: drawing source