Struct dynpick_force_torque_sensor::DynpickSensorBuilder[][src]

pub struct DynpickSensorBuilder<C> { /* fields omitted */ }

Builder of a connection to a dynpick sensor.

Examples

use dynpick_force_torque_sensor::DynpickSensorBuilder;

let sensor = DynpickSensorBuilder::open("/dev/ttyUSB0")
    .and_then(|b| b.set_sensitivity_by_builtin_data())
    .and_then(|b| b.build())
    .unwrap();

Implementations

impl DynpickSensorBuilder<SensitivityNotSetYet>[src]

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

Connects to the dynpick force torque sensor.

Params

  1. path The sensor's path.

Returns

Ok(builder) if successfully connected, Err(reason) if failed.
Before you use the sensor, you need to calibrate the sensor by calling Self::set_sensitivity_by_builtin_data or Self::set_sensitivity_manually.

Examples

See the example here.

pub fn set_sensitivity_manually(
    self,
    sensitivity: Sensitivity
) -> DynpickSensorBuilder<Ready>
[src]

Set the Sensitivity of the connected sensor by using the specified sensitivity.

Examples

use dynpick_force_torque_sensor::{DynpickSensorBuilder, Sensitivity, Triplet};

let sensitivity = {
    let force = Triplet::new(24.9, 24.6, 24.5);
    let torque = Triplet::new(1664.7, 1639.7, 1638.0);
    Sensitivity::new(force, torque)
};

let sensor = DynpickSensorBuilder::open("/dev/ttyUSB0")
    .map(|b| b.set_sensitivity_manually(sensitivity))
    .and_then(|b| b.build())
    .unwrap();

pub fn set_sensitivity_by_builtin_data(
    mut self: Self
) -> Result<DynpickSensorBuilder<Ready>, Error>
[src]

Set the Sensitivity of the connected sensor, reading its sensitivity from it.
Some sensors may not support this functionality (Err(_) will be returned under this situation).

Examples

See the example here

Note

This method has not been tested yet because my sensor (WDF-6M200-3) does not support this functionality.

impl DynpickSensorBuilder<Ready>[src]

pub fn build(self) -> Result<DynpickSensor, Error>[src]

Consuming this builder, attempts to construct a sensor instance.

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.