10000 GitHub - stillonearth/bevy_urdf: Import robots from URDF descriptors to bevy and simulate them with Rapier physics
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content

Import robots from URDF descriptors to bevy and simulate them with Rapier physics

Notifications You must be signed in to change notification settings

stillonearth/bevy_urdf

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

48 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

bevy_urdf

Import robots from URDF files and run simulation with rapier.

API

  1. Add Urdf and Stl plugins to bevy app
UrdfPlugin,
StlPlugin,
  1. Load robot in your startup systems
fn setup(mut ew_load_robot: EventWriter<LoadRobot>,) {
...
ew_load_robot.send(LoadRobot {
    urdf_path: "robots/flamingo_edu/urdf/Edu_v4.urdf".to_string(),
    mesh_dir: "assets/robots/flamingo_edu/urdf".to_string(),
});
...
}
  1. Subscribe to loaded event and emit spawn event
fn start_simulation(
    mut er_robot_loaded: EventReader<RobotLoaded>,
    mut ew_spawn_robot: EventWriter<SpawnRobot>,
    mut state: ResMut<NextState<AppState>>,
) {
    for event in er_robot_loaded.read() {
        ew_spawn_robot.send(SpawnRobot {
            handle: event.handle.clone(),
            mesh_dir: event.mesh_dir.clone(),
        });
        state.set(AppState::Simulation);
    }
}

Events

Read sensors and control motors through events:

#[derive(Event)]
pub struct SensorsRead {
    pub handle: Handle<UrdfAsset>,
    pub transforms: Vec<Transform>,
    pub joint_angles: Vec<f32>,
}

#[derive(Event)]
pub struct ControlMotors {
    pub handle: Handle<UrdfAsset>,
    pub velocities: Vec<f32>,
}

Limitations

You may need to hand-inspect urdf files to ensure mesh links are relative to urdf file. package:// and links and gazebo nodes are not supported.

Examples

cargo run --example simulate --release

About

Import robots from URDF descriptors to bevy and simulate them with Rapier physics

Resources

Stars

Watchers

Forks

Packages

No packages published

Languages

0