Struct leptrino_force_torque_sensor::LeptrinoSensor[][src]

pub struct LeptrinoSensor { /* fields omitted */ }

Leptrino 6-axis force-torque sensor.

Examples

use leptrino_force_torque_sensor::{LeptrinoSensor, Product};

let mut sensor = LeptrinoSensor::open(Product::Pfs055Ya251U6, "/dev/ttyUSB0").unwrap();

let wrench = sensor.update().unwrap();
println!("{:?}", wrench);

Implementations

impl LeptrinoSensor[src]

pub fn open<'a>(
    product: Product,
    path: impl Into<Cow<'a, str>>
) -> Result<LeptrinoSensor, Error>
[src]

Connects to the Leptrino force torque sensor.

Params

  1. product specify a sensor product.
  2. path The sensor's path.

Returns

Ok(sensor) if successfully connected, Err(reason) if failed.

Examples

See the example here.

pub fn last_wrench(&self) -> Wrench[src]

Returns the latest wrench that is stored in this instance without communicaing the sensor.

Use Self::update instead to obtain a new wrench from the sensor.

Returns

Ok(sensor) if successfully connected, Err(reason) if failed.

pub fn update(&mut self) -> Result<Wrench, Error>[src]

Communicating to the sensor, updates the latest wrench.

Returns

Ok(wrench) if succeeds, Err(reason) if failed.

pub fn zeroed(&mut self)[src]

Set the offset so that the current wrench is zeroed.
This methos is useful for zero-point calibration.

Examples

use leptrino_force_torque_sensor::{LeptrinoSensor, Product, Triplet};

let mut sensor = LeptrinoSensor::open(Product::Pfs055Ya251U6, "/dev/ttyUSB0").unwrap();

sensor.update().unwrap();
sensor.zeroed();
let wrench = sensor.last_wrench();

assert_eq!(wrench.force, Triplet::new(0.0, 0.0, 0.0));
assert_eq!(wrench.torque, Triplet::new(0.0, 0.0, 0.0));

pub fn receive_product_info(&mut self) -> Result<ProductInfo, Error>[src]

Reads the product info from the sensor.

Returns

Ok(product_info) if succeeds, Err(reason) if failed.

pub fn receive_builtin_filter_cutoff_hertz(
    &mut self
) -> Result<Option<u32>, Error>
[src]

Gets the builtin filter's cutoff frequency in Hertz.

Returns

Ok(Some(hertz)) if the filter is enabled. Ok(None) if the filter is disabled. Err(reason) if an error occurred during communication to the sensor.

pub fn set_builtin_filter_cutoff_hertz(
    &mut self,
    cutoff_hertz: Option<u32>
) -> Result<(), Error>
[src]

Enable or disable the builtin filter.

The modified setting will be applied after rebooting the sensor.

Params

  1. cutoff_frequency The cutoff frequency of the filter. Specify Some(hertz) if you want to enable the filter. Specity None if you want to disable the filter.

Examples

use leptrino_force_torque_sensor::{LeptrinoSensor, Product};

let mut sensor = LeptrinoSensor::open(Product::Pfs055Ya251U6, "/dev/ttyUSB0").unwrap();

// Disable the filter.
sensor.set_builtin_filter_cutoff_hertz(None).unwrap();

pub fn inner_port(&self) -> &Box<dyn SerialPort>[src]

Returns the reference to the serial port for the sensor.

Auto Trait Implementations

Blanket Implementations

impl<T> Any for T where
    T: 'static + ?Sized
[src]

impl<T> Borrow<T> for T where
    T: ?Sized
[src]

impl<T> BorrowMut<T> for T where
    T: ?Sized
[src]

impl<T> From<T> for T[src]

impl<T, U> Into<U> for T where
    U: From<T>, 
[src]

impl<T, U> TryFrom<U> for T where
    U: Into<T>, 
[src]

type Error = Infallible

The type returned in the event of a conversion error.

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 
[src]

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.