Skip to content

Commit

Permalink
Updated documentation and removed old testing script.
Browse files Browse the repository at this point in the history
  • Loading branch information
DrakBoul committed Oct 11, 2024
1 parent f94b17a commit 95301fa
Show file tree
Hide file tree
Showing 4 changed files with 59 additions and 59 deletions.
55 changes: 55 additions & 0 deletions ex3_obc_fsw/handlers/coms_handler/UHF_HANDLER_README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,55 @@
# UHF Handler

The UHF handler's purpose is to modify simulated operating parameters and get UHF data. Currently the UHF handler is not integrated with the rest of the OBC software.

## Usage

To use the UHF handler first start by running the "uplink_command_msg.sh" in the scripts directory.

Assuming the ex3_simulated_subsystems directory is in the same level as the ex3_software directory:

``` bash
cd scripts
./uplink_command_msg.sh ../../ex3_simulated_subsystems
```

Next, focus into the terminal labelled "SIM GS" and send a command to the UHF. Other UHF commands can be found [here](https://docs.google.com/spreadsheets/d/1rWde3jjrgyzO2fsg2rrVAKxkPa2hy-DDaqlfQTDaNxg/edit?gid=0#gid=0).

This command sets the beacon value to "BEACON" by using opcode "4" and then providing space separated ascii encoded bytes (base 10):

``` text
UHF 4 66 69 65 67 79 78
```

You can observe if the beacon is was set correctly by checking the output in the "COMS_HANDLER" terminal or the "SIM_GS" terminal:

SIM_GS Terminal:

``` text
UHF 4 66 69 65 67 79 78
Built msg: Msg { header: MsgHeader { msg_type: 0, msg_id: 0, dest_id: 13, source_id: 7, op_code: 4, msg_len: 13 }, msg_body: [66, 69, 65, 67, 79, 78] }
Sent 13 bytes to Coms handler
Received ACK: Msg { header: MsgHeader { msg_type: 0, msg_id: 0, dest_id: 7, source_id: 8, op_code: 200, msg_len: 9 }, msg_body: [79, 75, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0] }
Received Data: [66, 69, 65, 67, 79, 78, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0]
```

COMS_HANDLER Terminal:

``` text
TRACE Received UHF IPC Msg bytes
TRACE Dserd msg body len 4089
TRACE Sent command successfully
TRACE Command response: 21 bytes
TRACE Set UHF Beacon to: BEACON
```

If you recieved these messages it means that the command was successfully sent and the new beacon value can be observed from the SIM_GS terminal.

## UHF Parameters and data

As mentioned previously the UHF handler is not integrated with the rest of the ex3 OBC software. It can only be tested using the simulated UHF (Which is also not currently integrated with OBC software). In the future both the UHF ahndler and simulated UHF will be integrated with the OBC software.

For now the UHF handler modifies simulated parameters on the UHF. For now these are generalized parameters for the purpose of testing and are not representative of actual UHF parameters. The following are simulated parameters the simulated UHF currently has:

- __Beacon String__: This is the string that is sent down to the GS as a beacon. By default it is the string "beacon". This value can be changed by the UHF handler by using the SetBeacon opcode. You can get the UHF beacon string value by the UHF handler by using the GetBeacon opcode.
- __Mode__: This is the "Mode" of the UHF that refers to the frequency and baud rate of the UHF. As of now this parameter provides no real functionality and is a dummy value to be changed and read by the UHF handler. By default its value is 0, and can be any valid integer. Can be set using SetMode opcode, and get using GetMode opcode.
33 changes: 0 additions & 33 deletions ex3_obc_fsw/handlers/coms_handler/src/uhf_handler/README.md

This file was deleted.

11 changes: 4 additions & 7 deletions ex3_obc_fsw/handlers/coms_handler/src/uhf_handler/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,7 @@ Written by Drake Boulianne
Summer 2024
This module contains functions for handling the UHF (UHF simulated as of now). It consists mainly of
getting and setting functions for the simulated UHF parameters. Each getter or setter will return a
vector of bytes containing the data returned from the UHF. The only public function in the module is the
handle_uhf_cmd, Which takes the tcp uhf_interface and message as arguments, Then returns a vector of bytes containing
the data returned from the UHF after the request or an error message if the request times out.
getting and setting functions for the simulated UHF parameters.
*/
use tcp_interface::{Interface, TcpInterface};
use message_structure::*;
Expand Down Expand Up @@ -99,7 +96,7 @@ impl UHFHandler {
self.clear_buffer();


trace!("Set Beacon value to {}", &new_beacon_as_string);
trace!("Set UHF Beacon to: {}", &new_beacon_as_string);
self.beacon = new_beacon_as_string;
}

Expand Down Expand Up @@ -222,7 +219,7 @@ impl UHFHandler {
let read_result: Result<usize, std::io::Error> = TcpInterface::read(uhf_interface, &mut self.buffer);
match read_result {
Ok(n) => {
trace!("Read {} bytes from uhf", n)
trace!("Command response: {} bytes ", n)
},
Err(_) => {
debug!("Error reading bytes from UHF")
Expand All @@ -234,7 +231,7 @@ impl UHFHandler {
fn send_msg(&mut self, uhf_interface: &mut TcpInterface, content: Vec<u8>) {
let send_result = uhf_interface.send(&content);
match send_result {
Ok(_) => trace!("Send successful."),
Ok(_) => trace!("Sent command successfully"),
Err(e) => warn!("Error occured setting beacon value: {:?}", e)
}
}
Expand Down
19 changes: 0 additions & 19 deletions ex3_obc_fsw/handlers/coms_handler/src/uhf_handler/test.sh

This file was deleted.

0 comments on commit 95301fa

Please sign in to comment.