Skip to content

Commit

Permalink
Merge pull request #2 from neachdainn/marco_dev
Browse files Browse the repository at this point in the history
alpha release
  • Loading branch information
marcbone authored Mar 2, 2021
2 parents 39565fe + 95ce3cc commit b6a5569
Show file tree
Hide file tree
Showing 30 changed files with 7,923 additions and 706 deletions.
6 changes: 4 additions & 2 deletions .github/workflows/rust.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ env:
jobs:
build:

runs-on: ubuntu-latest
runs-on: ubuntu-20.04

steps:
- uses: actions/checkout@v2
Expand All @@ -21,5 +21,7 @@ jobs:
git submodule update --init
cargo build --verbose
- name: Check Format
run: cargo fmt -- --check
run: cargo fmt -- --check
- name: Run Tests
run: cargo test -p rubullet -- --test-threads=1

4 changes: 2 additions & 2 deletions .gitmodules
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
[submodule "bullet3/libbullet3"]
path = bullet3/libbullet3
[submodule "rubullet-sys/bullet3/libbullet3"]
path = rubullet-sys/bullet3/libbullet3
url = https://github.com/bulletphysics/bullet3.git
21 changes: 5 additions & 16 deletions Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,16 +1,5 @@
[package]
name = "rubullet"
version = "0.1.0"
authors = ["Nathan Kent <[email protected]>"]
edition = "2018"

# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html

[dependencies]
nalgebra = "0.21.0"

[build-dependencies]
cmake = "0.1.42"

[dev-dependencies]
easy-error = "0.3.1"
[workspace]
members = [
"rubullet",
"rubullet-sys",
]
21 changes: 21 additions & 0 deletions LICENSE
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
MIT License

Copyright (c) 2021 Nathan Kent, Marco Boneberger

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
11 changes: 0 additions & 11 deletions README.adoc

This file was deleted.

79 changes: 79 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,79 @@
![GitHub Workflow Status](https://img.shields.io/github/workflow/status/neachdainn/rubullet/Rust)
# RuBullet

RuBullet is a Rust implementation of [PyBullet](https://pybullet.org/).
In other words, it uses the [Bullet3](https://github.com/bulletphysics/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 either Direct or Gui mode
* Load models from URDF, SDF or MuJoCo 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 linear and angular damping of joints
* Create GUI sliders, button or put debugging text or lines in the simulation
* Get keyboard and mouse events

Things which are not implemented yet:
* Collision Detection Queries
* Virtual Reality
* Connect via SHARED_MEMORY, UDP or TCP
* Plugins
* Deformables and Cloth
* Logging and saving states
* Creating constraints
* Set physics engine parameters
* Change other dynamics parameters apart from linear and angular damping

The API is unstable and subject to change.

# Example
```rust
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

1 change: 0 additions & 1 deletion bullet3/libbullet3
Submodule libbullet3 deleted from 830f0a
20 changes: 20 additions & 0 deletions rubullet-sys/Cargo.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
[package]
name = "rubullet-sys"
version = "0.1.0-alpha"
authors = ["Nathan Kent <[email protected]>", "Marco Boneberger <[email protected]>"]
edition = "2018"
license = "MIT"
repository = "https://github.com/neachdainn/rubullet"
description = "Compiles bullet3 and exposes rust bindings to the C API"
categories =["science::robotics","simulation"]
keywords =["pybullet","bullet","bullet3","physics","robotics"]
# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html

[lib]
name = "rubullet_sys"
src = "src/lib.rs"


[build-dependencies]
cmake = "0.1.42"

8 changes: 5 additions & 3 deletions build.rs → rubullet-sys/build.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,11 @@ fn main() {
// PyBullet does not enable `BT_THREADSAFE`. I assume this is because of the GIL - PyBullet does
// nothing without the GIL locked. We'll make the same guarantee by using Rust's ownership
// model.
let dst = cmake::Config::new("bullet3")
//.very_verbose(true)
.build();
let mut config = &mut cmake::Config::new("bullet3");
if config.get_profile() != "Release" {
config = config.profile("RelWithDebInfo");
}
let dst = config.build();

println!("cargo:rustc-link-search=native={}/lib", dst.display());
println!("cargo:rustc-link-lib=static=BulletExampleBrowserLib");
Expand Down
File renamed without changes.
1 change: 1 addition & 0 deletions rubullet-sys/bullet3/libbullet3
Submodule libbullet3 added at df09fd
Loading

0 comments on commit b6a5569

Please sign in to comment.