rubullet/
lib.rs

1//! A Rust interface for Bullet physics inspired by PyBullet.
2//!
3//! # Example
4//! ```no_run
5//! use std::{thread, time::Duration};
6//!
7//! use anyhow::Result;
8//! use nalgebra::{Isometry3, Vector3};
9//! use rubullet::*;
10//!
11//! fn main() -> Result<()> {
12//!     let mut physics_client = PhysicsClient::connect(Mode::Gui)?;
13//!
14//!     physics_client.set_additional_search_path("../rubullet-sys/bullet3/libbullet3/data")?;
15//!     physics_client.set_gravity(Vector3::new(0.0, 0.0, -10.0));
16//!
17//!     let _plane_id = physics_client.load_urdf("plane.urdf", None)?;
18//!
19//!     let cube_start_position = Isometry3::translation(0.0, 0.0, 1.0);
20//!     let box_id = physics_client.load_urdf(
21//!         "r2d2.urdf",
22//!         UrdfOptions {
23//!             base_transform: cube_start_position,
24//!             ..Default::default()
25//!         },
26//!     )?;
27//!
28//!     for _ in 0..10000 {
29//!         physics_client.step_simulation()?;
30//!         thread::sleep(Duration::from_micros(4167));
31//!     }
32//!
33//!     let cube_transform = physics_client.get_base_transform(box_id)?;
34//!     println!("{}", cube_transform);
35//!
36//!     Ok(())
37//! }
38//! ```
39pub use crate::{
40    client::PhysicsClient,
41    error::Error,
42    mode::Mode,
43    server::{PhysicsServer, ServerMode},
44    types::{
45        Aabb, ActivationState, AddDebugLineOptions, AddDebugTextOptions, BodyId, BodyInfo,
46        BodyType, CameraImageOptions, ChangeConstraintOptions, ChangeDynamicsOptions,
47        ChangeVisualShapeOptions, CollisionId, ConstraintId, ConstraintInfo, ConstraintSolverType,
48        ContactPoint, ControlCommand, ControlCommandArray, DebugVisualizerCameraInfo,
49        DebugVisualizerFlag, DynamicsInfo, ExternalForceFrame, GeometricCollisionShape,
50        GeometricVisualShape, IkSolver, Images, InverseKinematicsNullSpaceParameters,
51        InverseKinematicsParameters, InverseKinematicsParametersBuilder, ItemId, Jacobian,
52        JointFeedbackMode, JointInfo, JointInfoFlags, JointState, JointType, KeyboardEvent,
53        LinkState, LoadModelFlags, LogFlags, LogId, LoggingType, MouseButtonState, MouseEvent,
54        MultiBodyOptions, OverlappingObject, PhysicsEngineParameters, RayHitInfo,
55        RayTestBatchOptions, RayTestOptions, Renderer, RendererAuxFlags, ResetFlags, SdfOptions,
56        SetPhysicsEngineParameterOptions, SoftBodyOptions, StateId, StateLoggingOptions, TextureId,
57        UrdfOptions, Velocity, VisualId, VisualShapeData, VisualShapeFlags, VisualShapeOptions,
58    },
59};
60pub use image;
61pub use nalgebra;
62mod client;
63mod error;
64pub mod logging_utils;
65mod mode;
66mod server;
67mod types;