[−][src]Struct mai400_api::MAI400
Structure for MAI-400 device instance
Fields
conn: Arc<Mutex<Connection>>
Device connection structure
Methods
impl MAI400
[src]
pub fn new(bus: &str) -> MAIResult<MAI400>
[src]
Constructor for MAI400 structure
Arguments
- conn - The underlying connection stream to use for communication with the device
Examples
use mai400_api::*; let mai = MAI400::new("/dev/ttyS5")?;
pub fn reset(&self) -> MAIResult<()>
[src]
Request a hardware reset of the MAI-400
Errors
If this function encounters any errors, an MAIError
variant will be returned.
Examples
let mai = MAI400::new("/dev/ttyS5")?; mai.reset()?;
pub fn set_mode(&self, mode: u8, params: [i16; 4]) -> MAIResult<()>
[src]
Set the ACS mode
Arguments
Note: Arguments should be set to 0x00
when not needed for desired mode
- mode - ACS mode to enter
- params - Array of signed shorts containing the arguments for configuring the requested mode
Errors
If this function encounters any errors, an MAIError
variant will be returned.
Examples
let mai = MAI400::new("/dev/ttyS5")?; mai.set_mode(9, [1, -1, -3, 0])?;
pub fn set_mode_sun(
&self,
mode: u8,
sun_angle_enable: i16,
sun_rot_angle: f32
) -> MAIResult<()>
[src]
&self,
mode: u8,
sun_angle_enable: i16,
sun_rot_angle: f32
) -> MAIResult<()>
Set the ACS mode (Normal-Sun or Lat/Long-Sun)
Arguments
Note: Arguments should be set to 0x00
when not needed for desired mode
- mode - ACS mode to enter. Should be either Normal-Sun or Lat/Long-Sun
- sun_angle_enable - Sun angle enable (0 = no update, 1 = update)
- sun_rot_angle - Sun rotation angle, in degrees
Errors
If this function encounters any errors, an MAIError
variant will be returned.
Examples
let mai = MAI400::new("/dev/ttyS5")?; mai.set_mode_sun(7, 1, 45.0)?;
pub fn set_gps_time(&self, gps_time: u32) -> MAIResult<()>
[src]
Set the ADACS clock with the desired GPS time
Arguments
- gps_time - New clock time (elapsed seconds after Jan 6, 1980 00:00:00)
Errors
If this function encounters any errors, an MAIError
variant will be returned.
Examples
let mai = MAI400::new("/dev/ttyS5")?; // Jan 01, 2018 mai.set_gps_time(1198800018)?;
pub fn set_rv(
&self,
eci_pos: [f32; 3],
eci_vel: [f32; 3],
time_epoch: u32
) -> MAIResult<()>
[src]
&self,
eci_pos: [f32; 3],
eci_vel: [f32; 3],
time_epoch: u32
) -> MAIResult<()>
Set orbital position and velocity at epoch for RK4 integration method of orbit propagation
Arguments
- eci_pos - ECI position [X, Y, Z]
- eci_vel - ECI velocity [X, Y, Z]
- time_epoch - GPS time at Epoch
Errors
If this function encounters any errors, an MAIError
variant will be returned.
Examples
let mai = MAI400::new("/dev/ttyS5")?; mai.set_rv([0.0, 0.0, 0.0], [0.0, 0.0, 0.0], 1198800018)?;
pub fn passthrough(&self, msg: &[u8]) -> MAIResult<()>
[src]
Directly send a message without formatting or checksum calculation
Arguments
- msg - Message to send
Errors
If this function encounters any errors, an MAIError
variant will be returned.
Examples
let mai = MAI400::new("/dev/ttyS5")?; let mut array = [0; 8]; array[0] = 0x90; // SYNC byte 1 array[1] = 0xEB; // SYNC byte 2 array[2] = 0x0; // Data_len byte 1 array[3] = 0x0; // Data_len byte 2 array[4] = 0x5A; // Msg_id array[5] = 0x0; // Addr array[6] = 0x00; // CRC byte 1 array[7] = 0x00; // CRC byte 2 mai.passthrough(&array)?;
pub fn get_message(
&self
) -> MAIResult<(Option<StandardTelemetry>, Option<RawIMU>, Option<IREHSTelemetry>)>
[src]
&self
) -> MAIResult<(Option<StandardTelemetry>, Option<RawIMU>, Option<IREHSTelemetry>)>
Wait for and read a message set from the MAI-400.
Returns a tuple potentially containing a standard telemetry message, a raw IMU telemetry message, and an IREHS telemetry packet.
Note: Messages are sent every 250ms, so, to the human eye, this should appear to be instantaneous
Errors
If this function encounters any errors, an MAIError
variant will be returned.
Examples
let mai = MAI400::new("/dev/ttyS5")?; let (std, imu, irehs) = mai.get_message()?; if let Some(telem) = std { println!("Num successful commands: {}", telem.cmd_valid_cntr); }
Trait Implementations
Auto Trait Implementations
Blanket Implementations
impl<T> From<T> for T
[src]
impl<T, U> Into<U> for T where
U: From<T>,
[src]
U: From<T>,
impl<T> ToOwned for T where
T: Clone,
[src]
T: Clone,
type Owned = T
The resulting type after obtaining ownership.
fn to_owned(&self) -> T
[src]
fn clone_into(&self, target: &mut T)
[src]
impl<T, U> TryFrom<U> for T where
U: Into<T>,
[src]
U: Into<T>,
type Error = Infallible
The type returned in the event of a conversion error.
fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>
[src]
impl<T, U> TryInto<U> for T where
U: TryFrom<T>,
[src]
U: TryFrom<T>,
type Error = <U as TryFrom<T>>::Error
The type returned in the event of a conversion error.
fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>
[src]
impl<T> BorrowMut<T> for T where
T: ?Sized,
[src]
T: ?Sized,
fn borrow_mut(&mut self) -> &mut T
[src]
impl<T> Borrow<T> for T where
T: ?Sized,
[src]
T: ?Sized,
impl<T> Any for T where
T: 'static + ?Sized,
[src]
T: 'static + ?Sized,