g29/
lib.rs

1//! Rust driver for Logitech G29
2//!
3//! This library provides a Rust interface for Logitech G29 wheel/pedal and force feedback control.
4//!
5//! # Example
6//!
7//! ```rust
8//! use g29::controller::Controller;
9//!
10//! fn main() {
11//!     // Create a new G29 instance
12//!     let mut g29 = Controller::new();
13//!     // Set force feedback for G29 controller - make sure to set the Logitech to PS3 Mode
14//!     g29.g29.lock().unwrap().force_feedback_constant(0.6);
15//!     // Start the reading thread to continuously read input from the G29 device
16//!     g29.start_pumping();
17//!     loop {
18//!         println!("steering = {:?}", g29.g29.lock().unwrap().get_state());
19//!     }
20//! }
21//! ```
22//!
23//! Interacting with the driver without starting a thread to set force feedback.
24//!
25//! ```rust
26//! use g29::interface::G29Interface;
27//!
28//! fn main() {
29//!     // Create a new G29 driver instance
30//!     let mut g29 = G29Interface::new();
31//!     // Set ForceFeedback
32//!     g29.force_feedback_constant(0.5);
33//!
34//!     // Reset the G29 device, including steering wheel calibration
35//!     g29.reset();
36//!
37//!     // Example: Set autocenter with a strength of 0.5 and a rate of 0.05
38//!     g29.set_autocenter(0.5, 0.05);
39//! }
40//! ```
41//!
42//! Reading input from the Logitech G29 in the main thread, and getting the state input in carla format
43//!
44//! ```rust
45//! use g29::controller::Controller;
46//!
47//! fn main() {
48//!     // Create a new G29 instance
49//!     let mut g29 = Controller::new();
50//!     // Set G29 Steer to the center
51//!     g29.g29.lock().unwrap().set_autocenter(0.5, 0.05);
52//!     // Reading
53//!     loop {
54//!         // Reading every 10ms from the G29
55//!         g29.g29.lock().unwrap().pump(10);
56//!         // Get the read values
57//!         println!("Carla_controle = {:?}", g29.g29.lock().unwrap().carla_vehicle_controle());
58//!     }
59//! }
60//! ```
61//!
62
63
64
65
66pub mod controller;
67pub mod interface;
68