Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Good enough for a alpha release? #2

Merged
merged 127 commits into from
Mar 2, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
127 commits
Select commit Hold shift + click to select a range
aa55fea
add panda demo and necessary functions for it
Dec 8, 2020
ffe343d
fix clippy warnings
Dec 8, 2020
479722b
fix more clippy warnings
Dec 8, 2020
8f23542
implement inverse dynamics and joint control via arrays
Dec 9, 2020
9d2c168
add get_link_state and get_link_states
Dec 11, 2020
10492a3
add camera image and fix tricky segmentation fault in calculate_inver…
Dec 13, 2020
2eb243b
fix inverse dynamics error
Dec 14, 2020
27fcc59
add calculate jacobi matrix, add tests, add PostionWithPD control mode
Dec 15, 2020
e83f5a2
implement mass matrix
Dec 15, 2020
c0a1169
reformat
Dec 15, 2020
eadf443
add reset simulation
Dec 15, 2020
b38c7cf
refactor inverse kinematics to use Optional arguments via the builder…
Dec 16, 2020
cc9c724
add debug slider
Dec 16, 2020
0f96008
add apply external force and torque
Dec 16, 2020
7f4598d
add add_debug_text
Dec 16, 2020
85ed6fd
use body_id for debug parameter
Dec 16, 2020
bbd1380
add add_user_debug_line
Dec 18, 2020
46eb7f4
add get_keyboard_events
Dec 18, 2020
c7368c5
add get_mouse_events
Dec 18, 2020
acccb73
use char in keyboard event
Dec 18, 2020
3312b60
add reset_base_transform
Dec 18, 2020
28d4067
add enable_joint_torque sensor
Dec 18, 2020
7f002ee
add_set_debug_color
Dec 18, 2020
eba51b2
fix ser debug object color
Dec 21, 2020
620117e
split ffi into separate crate
Dec 23, 2020
5359bf5
fix clippy warnings + reformat
Dec 23, 2020
64b04c0
add tests to ci
Dec 23, 2020
5e937c1
use ubuntu 20.04 instead of ubuntu latest in ci
marcbone Dec 25, 2020
991c38b
use new JointState struct instead of b3JointSensorState
Dec 25, 2020
a87adf4
use new JointState struct instead of b3JointSensorState
Dec 25, 2020
42398e6
move data types to separate file
Dec 25, 2020
59c96f8
introduce LinkState struct to replace b3LinkState
Dec 26, 2020
a00b8b2
fix clippy warnings
Dec 26, 2020
5446b6d
add more documentation
Jan 7, 2021
708d7ef
add get and reset base_velocity
Jan 7, 2021
0a5ffd6
improve reset_joint_state
Jan 7, 2021
d81c538
add docs for get_joint_state(s)
Jan 7, 2021
f411316
add documentation for calculate_mass_matrix and calculate_inverse_dyn…
Jan 7, 2021
68660a3
fix segmentation faults by using nullptr
Jan 12, 2021
ca8ec8b
add create_visual_shape + collision_shape + multi_body and some other…
Jan 19, 2021
f9a62be
add get_body_info and remove_body
Jan 19, 2021
ee4aee8
add get_visual_shape_data
Jan 19, 2021
98c5a13
add unit tests and documentation for compute_view_matrix and projecti…
Jan 19, 2021
443de2b
add test for get and reset_base_transformation
Jan 19, 2021
2119674
add get_num_bodies and add a test
Jan 19, 2021
1f78c86
fix spelling
Feb 9, 2021
86fe185
add documentation for calculate inverse kinematics
Feb 9, 2021
8f551f3
add documentation for set control mode methods
Feb 9, 2021
551d161
delete JointMotorControlOptions
Feb 9, 2021
c959a95
document calculate jacobian
Feb 9, 2021
477381c
include depth and segmentation image buffers in get_camera_image
Feb 9, 2021
3a5d093
introduce ItemId for user debug parameters and document all correspon…
Feb 10, 2021
4e814a1
document set_debug_object_color
Feb 10, 2021
2ea6a0c
document get_{keyboard,mouse}_events and improve the usability of Mou…
Feb 10, 2021
dc9aea1
document apply_external_{force,torque}
Feb 10, 2021
15aed78
document the jacobian struct
Feb 10, 2021
cd44833
document enable_joint_torque_sensor and JointState
Feb 10, 2021
786887d
document the remaining methods in client.rs
Feb 10, 2021
0f6eda3
add load_sdf method
Feb 10, 2021
57de818
add load_mjcf method
Feb 10, 2021
73cfe6e
add READMe.md add license and update Cargo.toml's
Feb 10, 2021
fb307df
update gitmodules
Feb 10, 2021
6a5d695
Revert "update gitmodules"
Feb 10, 2021
b7d3349
rename rubullet-ffi to rubullet-sys
Feb 10, 2021
9f3f6a2
chane version to alpha
Feb 10, 2021
f4fc5aa
add doc to GeometricCollisionShape
Feb 10, 2021
5de8254
fix signature of b3GetStatusActualState and its usage
Feb 16, 2021
00d4387
replace easy error crate with anyhow
Feb 17, 2021
9b97b6f
replace crate keyword "simulation" with "physics"
Feb 17, 2021
f7c8066
build bullet3 in RelWithDebInfo mode when not in release mode
Feb 17, 2021
9471ca6
rename rubullet-sys's lib from rubullet_ffi to rubullet_sys
Feb 17, 2021
fc1eec0
remove unnecessary calls to set_additional_search_path
Feb 17, 2021
a78d4d9
load dmatrix from_vec instead of from_row_slice. it only works becaus…
Feb 17, 2021
a04b190
introduce velocity type and refine jacobian
Feb 20, 2021
dee29b7
use velocity type in LinkState and make it an optional type depending…
Feb 20, 2021
9658f61
update comment about compute_link_velocity
Feb 20, 2021
3035624
Use bitflag crate to create flags for loading models. Improve usage o…
Feb 21, 2021
411fc49
remove target_velocities array in set_joint_motor_control_array and r…
Feb 22, 2021
f114990
remove added cube in hello_rubullet.rs
Feb 22, 2021
e59b8b8
convert type of maximum_force in set_joint_motor_control_array from O…
Feb 22, 2021
36f5073
use Matrix4 and Vector3 and Point3 for calculating view and projectio…
Feb 22, 2021
71c58dd
use pathbuf instead of string for filenames
Feb 23, 2021
147b007
fix docs for filenames
Feb 23, 2021
979c63d
improve MultiBodyOptions struct
Feb 23, 2021
fd7a87d
make plane_normal a vector
Feb 23, 2021
fdd2faa
switch flags for debug visualization to camelCase
Feb 23, 2021
b45a6d6
change capitalization style for types (eg. PD -> Pd) to make clippy h…
Feb 23, 2021
618ff27
remove commented out macro
Feb 23, 2021
5c7d876
use &str and CString in add_user_debug_{parameter,text} method
Feb 23, 2021
33bfbe3
put #[derive] after doc comments
Feb 23, 2021
cfb50a2
refactor Ik calculation and associated structs
Feb 23, 2021
46cf258
move body out of inversekinematicsparameters directly into the calcul…
Feb 23, 2021
574ecda
use from_u32 instead of from_u32_unchecked when converting keycode to…
Feb 23, 2021
b07723d
change u32 in inverse kinematircs parameters to usize
Feb 24, 2021
76281a5
convert all joint indices to usize
Feb 24, 2021
ba6f99f
change type of Box::half_extents to Vector3
Feb 24, 2021
3ff8e25
use quaternion for AddDebugTextOptions and make text position generic
Feb 24, 2021
c322d91
make line_from and line_to in add_user_debug_line a generic Point3
Feb 24, 2021
5eebc02
make set_gravity accept a generic vector3
Feb 24, 2021
3e5ddeb
make calculate jacobian accept a generic translation3
Feb 24, 2021
a62e44a
make apply_external_{force,torque} generic
Feb 24, 2021
6f43057
fix linear and angular velcity documentation for reset_velocity
Feb 24, 2021
5bf6324
escaping [ and ] in docs
Feb 24, 2021
09e4e50
rename set_joint_motor_control_2 to set_joint_motor_control
Feb 24, 2021
ba2f5be
do not consider no linear and no angular velocity as an error for res…
Feb 24, 2021
69abf2d
remove doc for error in reset_base_velocity
Feb 24, 2021
fc42c1b
flags from documentation for (Change)VisualShapeOptions
Feb 24, 2021
dce4a6b
convert link indices to usizes in client.rs
Feb 25, 2021
72c4b75
convert link indices to usizes in types.rs
Feb 25, 2021
3355b5e
make VisualId and CollisionId pub(crate) and introduce VisualId::NONE…
Feb 25, 2021
7576019
make parent index in JointInfo a Option<usize>
Feb 25, 2021
6ba0845
use asserts for checking inputs
Feb 25, 2021
4cfe8da
assert positive bodyid and that we can submit a command in remove_bod…
Feb 25, 2021
20abf3e
rename mesh_scale to mesh_scaling and make it an Option<Vectro3<f64>>
Feb 25, 2021
3aefd0a
minor doc change
Feb 25, 2021
9cf72c2
convert colors from slices to arrays
Feb 25, 2021
3347474
optimize reexports
Feb 27, 2021
e3dbc49
convert unwrap_or to unwrap_or_else
Feb 27, 2021
e59efe8
Introduce JointInfoFlags and hide its documentation
Feb 28, 2021
a48efa5
improve error messages for exceeding the body capacity while loading …
Feb 28, 2021
f12d820
remove allow dead code and adapt gui_marker
Feb 28, 2021
ff37e8f
remove unnecessary error checking
Feb 28, 2021
39947f9
remove sync_body_info
Feb 28, 2021
8e0db59
use assert for linear and angular damping
Feb 28, 2021
882c11a
delete comment about file representation in windows
Feb 28, 2021
00f4500
fix format
Feb 28, 2021
95ce3cc
let ffi return Option<b3PhysicsClientHandle>
Mar 1, 2021
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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