Struct leptrino_force_torque_sensor::LeptrinoSensor [−][src]
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]
product: Product,
path: impl Into<Cow<'a, str>>
) -> Result<LeptrinoSensor, Error>
Connects to the Leptrino force torque sensor.
Params
product
specify a sensor product.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]
&mut self
) -> Result<Option<u32>, Error>
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]
&mut self,
cutoff_hertz: Option<u32>
) -> Result<(), Error>
Enable or disable the builtin filter.
The modified setting will be applied after rebooting the sensor.
Params
cutoff_frequency
The cutoff frequency of the filter. SpecifySome(hertz)
if you want to enable the filter. SpecityNone
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
impl !RefUnwindSafe for LeptrinoSensor
[src]
impl Send for LeptrinoSensor
[src]
impl !Sync for LeptrinoSensor
[src]
impl Unpin for LeptrinoSensor
[src]
impl !UnwindSafe for LeptrinoSensor
[src]
Blanket Implementations
impl<T> Any for T where
T: 'static + ?Sized,
[src]
T: 'static + ?Sized,
impl<T> Borrow<T> for T where
T: ?Sized,
[src]
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
[src]
T: ?Sized,
pub fn borrow_mut(&mut self) -> &mut T
[src]
impl<T> From<T> for T
[src]
impl<T, U> Into<U> for T where
U: From<T>,
[src]
U: From<T>,
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.
pub 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>,