Struct g29::interface::G29Interface

source ·
pub struct G29Interface { /* private fields */ }
Expand description

! The G29Interface struct is the underlying driver for the G29 device, managing communication and state.

Implementations§

source§

impl G29Interface

source

pub fn new() -> Self

Initializes a new G29 driver, opens the device, and sets initial state.

source

pub fn reset(&self)

Resets the G29 device, including steering wheel calibration. calibration the steering wheel of the G2

source

pub fn connect(&mut self)

Connects to the G29 device by pumping data and resetting.

source

pub fn force_feedback_constant(&self, val: f32)

Sets constant force feedback on the G29 device.

source

pub fn set_autocenter(&self, strength: f32, rate: f32)

Configures autocentering strength and rate. default value to be used strength = 0.5 and rate = 0.05

source

pub fn force_off(&self)

Turns off force feedback on the G29 device.

source

pub fn pump(&mut self, timeout: i32) -> usize

Reads data from the G29 device buffer.

source

pub fn read_loop(&mut self)

Continuously pumps data in a loop.

source

pub fn update_state(&mut self, byte_array: &Vec<u8>)

Updates the internal state based on the latest data.

source

pub fn get_state(&self) -> &HashMap<&str, u8>

Retrieves the current state of the G29 device.

source

pub fn calculate_steering(&self, start: &u8, end: &u8) -> u8

Calculates the scaled steering value based on raw input.

source

pub fn carla_vehicle_controle(&self) -> HashMap<String, f32>

Transform G29 Controller input to caral controlle throttle in range of 0 -> 1 brake in range of 0 -> 1 steer in range of -1 -> 1

Trait Implementations§

source§

impl Debug for G29Interface

source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more

Auto Trait Implementations§

Blanket Implementations§

source§

impl<T> Any for T
where T: 'static + ?Sized,

source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
source§

impl<T> Borrow<T> for T
where T: ?Sized,

source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
source§

impl<T> From<T> for T

source§

fn from(t: T) -> T

Returns the argument unchanged.

source§

impl<T, U> Into<U> for T
where U: From<T>,

source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

§

type Error = Infallible

The type returned in the event of a conversion error.
source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

§

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

The type returned in the event of a conversion error.
source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.