GithubHelp home page GithubHelp logo

uwsbel / low-fidelity-dynamic-models Goto Github PK

View Code? Open in Web Editor NEW
6.0 3.0 3.0 3.45 MB

A library of fast and accurate low fidelity dynamic models for applications in robotics

License: MIT License

Python 1.16% CMake 2.25% C++ 48.84% SWIG 0.44% Cuda 46.87% TeX 0.24% Shell 0.20%

low-fidelity-dynamic-models's Introduction

Fast and Accurate Low Fidelity Dynamic Models for Robotics

Overview

This repository hosts a collection of low fidelity dynamic models, optimized for speed and efficiency, and primarily designed for robotics applications. It features models for wheeled robots, including vehicles, and is equipped with integrators (both half-implicit and implicit, utilizing Sundials) for simulating these models from a given initial state.

Using CMake, the user can choose to build the models to execute on the CPU or NVIDIA GPU cards. The CPU models are implemented in C++, whereas the GPU models utilize CUDA. A Python API is also available, provided through SWIG-wrapped C++ models.

Key Features

  1. High-Speed Performance: Models surpass real-time processing speeds. For instance, the 18 Degrees of Freedom (DOF) model achieves 2000x faster performance than real-time on standard CPUs, with an integration timestep of 1e-3 s.

  2. GPU Optimization for Scalability: The GPU models are adept at parallel simulations of multiple vehicles. The 18 DOF GPU model, for example, can simulate 300,000 vehicles in real-time on an NVIDIA A100 GPU. Note: The GPU models are only available for Nvidia GPUs.

  3. Python API: The SWIG-wrapped Python version maintains significant speed, being only 8 times slower than the C++ models, thereby offering Python's ease of use with C++ efficiency.

  4. Advanced Analysis with Sundials: The CPU models support Forward Sensitivity Analysis (FSA) for select parameters. The use of a half-implicit integrator allows easy access to Jacobians of the system's RHS in relation to states and controls, beneficial for gradient-based Model Predictive Control (MPC) methods.

  5. Comprehensive Vehicle Dynamics Simulation: Including models for the engine, powertrain, and torque converter, these simulations closely replicate actual vehicles. Users also have a choice between two semi-empirical TMeasy tire models, noted for their accuracy and performance at high vehicle speeds.

  6. User-Friendly Configuration: Parameters for the models can be set dynamically at runtime through JSON files.

This library seeks to establish the right balance between speed and accuracy in robotics simulation, especially in the context of vehicle dynamics.

How do I get started?

Please see the instructions in wheeled_vehicle_models for details on how to build and run the models.

Repository Structure

Several sub-folders contain each the source code for a vehicle model and the numerical integrator (time stepper) that runs it. CMake configurations have been set up to help with building demos, enabling the user to quickly kick off a simulation. The main repo folders are as follows:

  • docs: Documentation related to the dynamic models and their usage. See README for instructions to build the docs locally.
  • wheeled_vehicle_models: Contains subdirectories for different DOF models for wheeled vehicles:
    • 11dof: CPU version for the 11 DOF wheeled vehicle model. See README for use instructions.
    • 11dof-gpu: GPU version for the 11 DOF wheeled vehicle model. See README for use instructions.
    • 18dof: CPU version for the 18 DOF wheeled vehicle model. See README for use instructions.
    • 18dof-gpu: GPU version for the 18 DOF wheeled vehicle model. See README for use instructions.
    • 24dof: CPU version for the 24 DOF wheeled vehicle model. See README for use instructions.
    • 24dof-gpu: GPU version for the 24 DOF wheeled vehicle model. See README for use instructions.
    • third_party/rapidjson: Third-party libraries and dependencies, specifically rapidjson for JSON handling.
    • utils: Utility scripts and tools supporting the dynamic models. Each vehicle model has its own (although very similar) CMake configuration and build procedure. README files are available in each model sub-directory describing this procedure.

If you are interested to contribute, see Contribution Guidelines

Link to paper

Markdown: DOI

HTML: DOI badge

low-fidelity-dynamic-models's People

Contributors

huzaifg avatar ishaanamahajan avatar dannegrut avatar danielskatz avatar

Stargazers

Marcel Offermans avatar  avatar  avatar M. Amin Safavi avatar Json Zhou avatar Ben DeBoer avatar

Watchers

Radu Serban avatar  avatar  avatar

low-fidelity-dynamic-models's Issues

Create docs

  • Create extensive documentation on how to use the API.
  • Clean out unnecessary/wrong comments
  • Improve code base for readability with comment banners

Add GPU for 24 DOF

Add capabilities to simulate multiple 24 DOF vehicles in parallel on Nvidia GPUs

which C++ compiler is being used

I tried building the code from the repo. I ran into errors when trying to compile the code for 18dof. Using g++, I get the following error:

Consolidate compiler generated dependencies of target demo_hmmwv_hi
[ 3%] Building CXX object CMakeFiles/demo_hmmwv_hi.dir/dof18.cpp.o
/home/jbernard/repos/low-fidelity-dynamic-models/wheeled_vehicle_models/18dof/dof18.cpp:296:53: error: ‘void d18::computeCombinedcoulombForce(double&, double&, double, double, double, double, double)’ should have been declared inside ‘d18’
296 | double vcoulomb) {
| ^
make[2]: *** [CMakeFiles/demo_hmmwv_hi.dir/build.make:90: CMakeFiles/demo_hmmwv_hi.dir/dof18.cpp.o] Error 1
make[1]: *** [CMakeFiles/Makefile2:93: CMakeFiles/demo_hmmwv_hi.dir/all] Error 2
make: *** [Makefile:91: all] Error 2

Moving to using clang++, version 14, I get the following error:

[ 6%] Building CXX object CMakeFiles/demo_hmmwv_hi.dir/dof18.cpp.o
/home/jbernard/repos/low-fidelity-dynamic-models/wheeled_vehicle_models/18dof/dof18.cpp:290:11: error: out-of-line definition of 'computeCombinedcoulombForce' does not match any declaration in namespace 'd18'; did you mean 'computeCombinedColumbForce'?
void d18::computeCombinedcoulombForce(double& fx,
^~~~~~~~~~~~~~~~~~~~~~~~~~~
computeCombinedColumbForce
/home/jbernard/repos/low-fidelity-dynamic-models/wheeled_vehicle_models/18dof/dof18.h:894:6: note: 'computeCombinedColumbForce' declared here
void computeCombinedColumbForce(double& fx, double& fy, double mu, double vsx, double vsy, double fz, double vcoulomb);
^
/home/jbernard/repos/low-fidelity-dynamic-models/wheeled_vehicle_models/18dof/dof18.cpp:593:5: error: use of undeclared identifier 'computeCombinedcoulombForce'; did you mean 'computeCombinedColumbForce'?
computeCombinedcoulombForce(Fx0, Fy0, t_params._mu, vsx, vsy, fz, t_params._vcoulomb);
^~~~~~~~~~~~~~~~~~~~~~~~~~~
computeCombinedColumbForce
/home/jbernard/repos/low-fidelity-dynamic-models/wheeled_vehicle_models/18dof/dof18.cpp:290:11: note: 'computeCombinedColumbForce' declared here
void d18::computeCombinedcoulombForce(double& fx,
^
/home/jbernard/repos/low-fidelity-dynamic-models/wheeled_vehicle_models/18dof/dof18.cpp:749:13: warning: taking the absolute value of unsigned type 'bool' has no effect [-Wabsolute-value]
if (std::abs((v_states._u - 0) < 1e-9) && (torque_t < 0)) {
^
/home/jbernard/repos/low-fidelity-dynamic-models/wheeled_vehicle_models/18dof/dof18.cpp:749:13: note: remove the call to 'abs' since unsigned values cannot be negative
if (std::abs((v_states._u - 0) < 1e-9) && (torque_t < 0)) {
^~~~~~~~
/home/jbernard/repos/low-fidelity-dynamic-models/wheeled_vehicle_models/18dof/dof18.cpp:783:13: warning: taking the absolute value of unsigned type 'bool' has no effect [-Wabsolute-value]
if (std::abs((v_states._u - 0) < 1e-9) && (torque_t < 0)) {
^
/home/jbernard/repos/low-fidelity-dynamic-models/wheeled_vehicle_models/18dof/dof18.cpp:783:13: note: remove the call to 'abs' since unsigned values cannot be negative
if (std::abs((v_states._u - 0) < 1e-9) && (torque_t < 0)) {
^~~~~~~~
/home/jbernard/repos/low-fidelity-dynamic-models/wheeled_vehicle_models/18dof/dof18.cpp:921:13: warning: taking the absolute value of unsigned type 'bool' has no effect [-Wabsolute-value]
if (std::abs((v_states._u - 0) < 1e-9) && (torque_t < 0)) {
^
/home/jbernard/repos/low-fidelity-dynamic-models/wheeled_vehicle_models/18dof/dof18.cpp:921:13: note: remove the call to 'abs' since unsigned values cannot be negative
if (std::abs((v_states._u - 0) < 1e-9) && (torque_t < 0)) {
^~~~~~~~
/home/jbernard/repos/low-fidelity-dynamic-models/wheeled_vehicle_models/18dof/dof18.cpp:955:13: warning: taking the absolute value of unsigned type 'bool' has no effect [-Wabsolute-value]
if (std::abs((v_states._u - 0) < 1e-9) && (torque_t < 0)) {
^
/home/jbernard/repos/low-fidelity-dynamic-models/wheeled_vehicle_models/18dof/dof18.cpp:955:13: note: remove the call to 'abs' since unsigned values cannot be negative
if (std::abs((v_states._u - 0) < 1e-9) && (torque_t < 0)) {
^~~~~~~~
4 warnings and 2 errors generated.
make[2]: *** [CMakeFiles/demo_hmmwv_hi.dir/build.make:90: CMakeFiles/demo_hmmwv_hi.dir/dof18.cpp.o] Error 1
make[1]: *** [CMakeFiles/Makefile2:93: CMakeFiles/demo_hmmwv_hi.dir/all] Error 2
make: *** [Makefile:91: all] Error 2

Add GPU for 11 DOF

Generate a GPU version of the 11 DOF model similar to the 18 DOF model

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.