{"id":27375103,"url":"https://github.com/katharostech/webots-rust","last_synced_at":"2025-07-05T03:37:57.949Z","repository":{"id":66216810,"uuid":"597265322","full_name":"katharostech/webots-rust","owner":"katharostech","description":"Rust bindings to the Webots libcontroller C API. Lets you write Webots controllers in Rust.","archived":false,"fork":false,"pushed_at":"2023-02-06T02:07:28.000Z","size":63,"stargazers_count":2,"open_issues_count":0,"forks_count":0,"subscribers_count":3,"default_branch":"main","last_synced_at":"2025-06-14T02:35:18.122Z","etag":null,"topics":["rust","webots","webots-robot-simulator"],"latest_commit_sha":null,"homepage":"","language":"Rust","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/katharostech.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null}},"created_at":"2023-02-04T02:16:41.000Z","updated_at":"2024-04-06T09:40:34.000Z","dependencies_parsed_at":null,"dependency_job_id":"8e93b697-e51f-4062-b774-c000c967a37d","html_url":"https://github.com/katharostech/webots-rust","commit_stats":{"total_commits":32,"total_committers":3,"mean_commits":"10.666666666666666","dds":0.375,"last_synced_commit":"6becd69d86b3468d4f2311b5b6474b4dc5f57b2d"},"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/katharostech/webots-rust","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/katharostech%2Fwebots-rust","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/katharostech%2Fwebots-rust/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/katharostech%2Fwebots-rust/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/katharostech%2Fwebots-rust/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/katharostech","download_url":"https://codeload.github.com/katharostech/webots-rust/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/katharostech%2Fwebots-rust/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":261384110,"owners_count":23150586,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["rust","webots","webots-robot-simulator"],"created_at":"2025-04-13T12:14:27.242Z","updated_at":"2025-07-05T03:37:57.928Z","avatar_url":"https://github.com/katharostech.png","language":"Rust","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Webots `libcontroller` Rust Bindings\n\nThis is a reference project that shows how to build controllers for the [Webots robot simulator](https://cyberbotics.com) using the Rust programming language.\n\n## Running The Example\n\nFirst you must install [Webots](https://cyberbotics.com) \u0026 [Rust](https://rust-lang.org).\n\nYou can run the example by:\n\n1. Install Webots \u0026 Rust.\n1. Clone this repository and switch folders to it.\n1. Run `cargo build --example rust_epuck_controller`\n1. Open up the `example` world in the `sample_project` folder in Webots, and run the simulation.\n\nIf you make changes, simply re-build the example and restart the simulation!\n\n## Using in Your Own Project\n\n\u003e **Warning:** There is a `webots` crates.io package, but that is not this crate. Currently this\n\u003e crate is only published on GitHub, and we may change the name to prevent confusion with the\n\u003e crates.io crate.\n\n**`Cargo.toml`:**\n\n```toml\n[dependencies]\nwebots = { git = \"https://github.com/katharostech/webots-rust\" }\n```\n\nNow you can compile your crate to create a Webots controller.\n\nOnce you have compiled the crate, you must copy or link your controller to a Webots project folder.\n\nWebots projects always have a folder named `worlds` and you will need to have a `controllers` folder next to that. Inside of that create a folder named after your controller, such as `my_rust_controller`. Finally, copy your built controller into that folder, and make sure it has the same name as your folder.\n\nNow, in the Webots program, you can select `my_rust_controller` as the controller for any robot!\n\n## Simple Controller Example\n\nHere's one of the simplest controllers, which works to make the NAO model robot \"wave\":\n\n```rust\nuse std::time::Duration;\n\nuse webots::prelude::*;\n\nstruct Participant {\n    arm_up: bool,\n    arm_motor: Motor,\n}\n\nimpl Robot for Participant {\n    fn time_step(\u0026self) -\u003e std::time::Duration {\n        Duration::from_secs(1)\n    }\n\n    fn init() -\u003e Self {\n        let arm_motor = Motor::new(\"RShoulderPitch\");\n        arm_motor.set_velocity(arm_motor.max_velocity());\n        Participant {\n            arm_motor,\n            arm_up: false,\n        }\n    }\n\n    fn step(\u0026mut self) {\n        if !self.arm_up {\n            self.arm_motor.set_position(self.arm_motor.max_position());\n        } else {\n            self.arm_motor.set_position(self.arm_motor.min_position());\n        }\n        self.arm_up = !self.arm_up;\n    }\n}\n\nfn main() {\n    webots::run::\u003cParticipant\u003e();\n}\n```\n\n## How it Works\n\n[Bindgen](https://github.com/rust-lang/rust-bindgen) is used to generate bindings to the Webots C library at compile time. It will look in standard OS installation directories, or else use the `WEBOTS_PATH` environment variable to find your local Webots installation. For now, you must have it installed locally to compile this crate. We may change that soon.\n\nYou can find the raw, generated bindings in the `webots::sys` module, and the rest of the crate contains idiomatic Rust bindings. Though the idiomatic bindings are incomplete, they are easy to write, and we will be extending them as time permits. It's simple to see how they are made, and to add your own if necessary. Pull requests are welcome!\n\n## License\n\nThis project is licensed under either of\n\n- Apache License, Version 2.0, ([LICENSE-APACHE](LICENSE-APACHE) or\n  \u003chttp://www.apache.org/licenses/LICENSE-2.0\u003e)\n- MIT license ([LICENSE-MIT](LICENSE-MIT) or\n  \u003chttp://opensource.org/licenses/MIT\u003e)\n\nat your option.\n\n### Contribution\n\nUnless you explicitly state otherwise, any contribution intentionally submitted\nfor inclusion in this project by you, as defined in the Apache-2.0 license,\nshall be dual licensed as above, without any additional terms or conditions.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fkatharostech%2Fwebots-rust","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fkatharostech%2Fwebots-rust","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fkatharostech%2Fwebots-rust/lists"}