2 releases

0.1.0-alpha-2 Mar 13, 2021
0.1.0-alpha Mar 3, 2021

#243 in Simulation


Used in 2 crates (via rubullet)

MIT license

18MB
763K SLoC

C++ 721K SLoC // 0.0% comments C 33K SLoC // 0.1% comments Lua 4.5K SLoC // 0.1% comments Rust 2K SLoC // 0.0% comments Objective-C 1K SLoC // 0.1% comments Python 660 SLoC // 0.1% comments GLSL 527 SLoC // 0.0% comments Shell 156 SLoC // 0.2% comments Batch 115 SLoC Automake 89 SLoC

Contains (DOS exe, 1.5MB) bullet3/libbullet3/build3/premake5.exe, (DOS exe, 285KB) bullet3/libbullet3/build3/premake4.exe, (ELF exe/lib, 380KB) bullet3/libbullet3/build3/premake4_arm64, (ELF exe/lib, 285KB) bullet3/libbullet3/build3/premake4_linux, (ELF exe/lib, 395KB) premake4_linux64, (Mach-o exe, 410KB) bullet3/libbullet3/build3/premake4_osx and 1 more.

GitHub Workflow Status crates.io crates.io crates.io docs.rs

RuBullet

RuBullet is a Rust implementation of PyBullet. In other words, it uses the Bullet3 C API in order to expose a functionality that is similar to PyBullet. Development is ongoing and functionality is currently limited.

Status

Right now RuBullet should cover most of the basic use cases. It can:

  • Create a PhysicsClient in Direct, Gui or other modes
  • Load models from URDF, SDF, MuJoCo or Bullet files
  • Create own models within the simulation
  • Control robots in position, velocity or torque mode
  • Calculate inverse dynamics, inverse kinematics, jacobians and mass matrices
  • Render camera images
  • Read information about links and joints
  • Change dynamics of a body
  • Create GUI sliders, buttons or put debugging text or lines in the simulation
  • Get keyboard and mouse events
  • Create and manage constraints
  • Logging
  • Saving states and loading states
  • Set physics engine parameters
  • Collision Detection Queries
  • Deformables and Cloth

Things which are not implemented yet:

  • Everything MultiDOF related
  • Virtual Reality
  • Plugins

The API is unstable and subject to change.

Example

use std::{thread, time::Duration};

use anyhow::Result;
use nalgebra::{Isometry3, Vector3};
use rubullet::*;

fn main() -> Result<()> {
    let mut physics_client = PhysicsClient::connect(Mode::Gui)?;

    physics_client.set_additional_search_path("../rubullet-sys/bullet3/libbullet3/data")?;
    physics_client.set_gravity(Vector3::new(0.0, 0.0, -10.0));

    let _plane_id = physics_client.load_urdf("plane.urdf", Default::default())?;

    let cube_start_position = Isometry3::translation(0.0, 0.0, 1.0);
    let box_id = physics_client.load_urdf(
        "r2d2.urdf",
        UrdfOptions {
            base_transform: cube_start_position,
            ..Default::default()
        },
    )?;

    for _ in 0..10000 {
        physics_client.step_simulation()?;
        thread::sleep(Duration::from_micros(4167));
    }

    let cube_transform = physics_client.get_base_transform(box_id)?;
    println!("{}", cube_transform);

    Ok(())
}

Bug reports and Merge Requests

The current development happens as a part of marcbone's master thesis. Therefore, merge requests can not be accepted until July 5, 2021. We are disabling merge requests until then which sadly also disables issues. If you find any bugs or have suggestions please write an email to one of the maintainers.

License

RuBullet is licensed under MIT


lib.rs:

Foreign function interface for Bullet C API.

No runtime deps