[−][src]Struct mai400_api::MAI400
Structure for MAI-400 device instance
Fields
conn: Arc<Mutex<Connection>>
Device connection structure
Methods
impl MAI400
[src]
impl MAI400
pub fn new(bus: &str) -> MAIResult<MAI400>
[src]
pub fn new(bus: &str) -> MAIResult<MAI400>
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]
pub fn reset(&self) -> MAIResult<()>
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]
pub fn set_mode(&self, mode: u8, params: [i16; 4]) -> MAIResult<()>
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]
pub fn set_mode_sun(
&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]
pub fn set_gps_time(&self, gps_time: u32) -> MAIResult<()>
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]
pub fn set_rv(
&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]
pub fn passthrough(&self, msg: &[u8]) -> MAIResult<()>
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]
pub fn get_message(
&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 for T
[src]
impl<T> From for T
impl<T, U> Into for T where
U: From<T>,
[src]
impl<T, U> Into for T where
U: From<T>,
impl<T> ToOwned for T where
T: Clone,
[src]
impl<T> ToOwned for T where
T: Clone,
type Owned = T
fn to_owned(&self) -> T
[src]
fn to_owned(&self) -> T
Creates owned data from borrowed data, usually by cloning. Read more
fn clone_into(&self, target: &mut T)
[src]
fn clone_into(&self, target: &mut T)
🔬 This is a nightly-only experimental API. (toowned_clone_into
)
recently added
Uses borrowed data to replace owned data, usually by cloning. Read more
impl<T, U> TryFrom for T where
T: From<U>,
[src]
impl<T, U> TryFrom for T where
T: From<U>,
type Error = !
try_from
)The type returned in the event of a conversion error.
fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>
[src]
fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>
try_from
)Performs the conversion.
impl<T> Borrow for T where
T: ?Sized,
[src]
impl<T> Borrow for T where
T: ?Sized,
impl<T> BorrowMut for T where
T: ?Sized,
[src]
impl<T> BorrowMut for T where
T: ?Sized,
fn borrow_mut(&mut self) -> &mut T
[src]
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
impl<T, U> TryInto for T where
U: TryFrom<T>,
[src]
impl<T, U> TryInto for T where
U: TryFrom<T>,
type Error = <U as TryFrom<T>>::Error
try_from
)The type returned in the event of a conversion error.
fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>
[src]
fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>
try_from
)Performs the conversion.
impl<T> Any for T where
T: 'static + ?Sized,
[src]
impl<T> Any for T where
T: 'static + ?Sized,
fn get_type_id(&self) -> TypeId
[src]
fn get_type_id(&self) -> TypeId
🔬 This is a nightly-only experimental API. (get_type_id
)
this method will likely be replaced by an associated static
Gets the TypeId
of self
. Read more