Git Product home page Git Product logo

ihm2's Introduction

IHM2

This repository showcases a summary of the skills and knowledge I acquired between 2021 and 2022 at the EPFL Racing Team. This student led initiative designs and builds each year a new electric autonomous racecar taking part in the Formula Student competitions. I was in charge of the control of the autonomous racing car Ariane.

It features:

  • A Nonlinear Model Predictive Controller (NMPC) based on a path-parametric bicycle model with nonlinear path and control input constraints.
  • A simple simulator based on a bicycle model as well for Model-in-the-Loop (MiL) testing.
  • A ROS 2 workspace using Foxglove Studio for visualization and debugging, with its dependencies managed through miniforge and robostack for cross-platform ROS compatibility.

No part of this code (except for some external dependencies) was used at any point by the EPFL Racing Team. Everything was entirely developed after my departure for the sole purpose to display my skills and knowledge in vehicle modelling, control and software development.

Workspace setup

  1. install miniforge3:
cd $HOME
curl -L -O "https://github.com/conda-forge/miniforge/releases/latest/download/Miniforge3-$(uname)-$(uname -m).sh"
bash Miniforge3-$(uname)-$(uname -m).sh
  1. clone this repository wherever you want:
git clone https://github.com/tudoroancea/ihm2 --filter=blob:none
cd ihm2
  1. create a conda env
mamba env create -f env.yml
  1. install acados
mamba activate ihm2
cd $HOME/miniforge3/envs/ihm2/src
git clone https://github.com/acados/acados.git --recurse-submodules --filter=blob:none
cd acados
mkdir build && cd build
cmake -DACADOS_WITH_OPENMP=ON ..
make install -j6
echo "export ACADOS_SOURCE_DIR=\$HOME/miniforge3/envs/ihm2/src/acados" >> ~/miniforge3/envs/ihm2/setup.sh
echo "export LD_LIBRARY_PATH=\$LD_LIBRARY_PATH:\$ACADOS_SOURCE_DIR/lib" >> ~/miniforge3/envs/ihm2/setup.sh
echo "export DYLD_LIBRARY_PATH=\$DYLD_LIBRARY_PATH:\$ACADOS_SOURCE_DIR/lib" >> ~/miniforge3/envs/ihm2/setup.sh
mamba deactivate
mamba activate ihm2
pip3 install -e $ACADOS_SOURCE_DIR/interfaces/acados_template
  1. build workspace (first cd back to the dir where you cloned this repo):
chmod +x scripts/*.sh
./scripts/build.sh

Foxglove Studio

You can download the latest version of Foxglove Studio from here. To visualize data, you can then import the created layout in templates/ihm2_foxglove.json and run the following command to run the foxglove bridge:

ros2 launch foxglove_ros_bridge foxglove_ros_bridge_launch.xml

References & credits

ihm2's People

Contributors

tudoroancea avatar

Stargazers

 avatar  avatar  avatar

Watchers

 avatar

ihm2's Issues

Debug foxglove bridge incompatible QoS

Sometimes, QoS policy incompatibilities arise when using foxglove bridge. When it happens, we cannot visualize the corresponding data on foxglove studio, whether it is coming from a ros bag/mcap or live publishers.

My bests guess for the moment: if foxglove bridge creates a subscriber on a certain topic, it will (supposedly) check the QoS policies of the other subscribers and will use the same one. If the foxglove bridge is already running when we launch our nodes, it could start before the others and use wrong QoS profiles.

Relevant parts of foxglove bridge source code:
choice of the QoS profile and PR where it was introduced

add proper dependencies (with submodules)

To be added:

  • acados. Options:
    - instructions to install it in the conda env and possibly bash scripts
    - add it as git submodule and bult by colcon
  • foxglove bridge -> add it as submodule that will be built by colcon
  • foxglove studio -> provide download link

add lap time computation in simulation node

Goal

add lap time computation capabilities to the simulation node. We could publish these lap times in the sim_node's diagnostics (the last one and the best one since the last reset).

write control node

Implementation

Implement an abstract class and first close this

then if time do this (otherwise keep for v2)

Don't forget about this for the message filters to synchronize /ihm2/pose and /ihm2/velocity

Add `cones_observations` publisher to `sim_node`

Goal

In a first version, we could just add the ground truth for the cones observations.
In a second version, we could add noises to these observations and add parameters to choose from several noise models (gaussian, uniform, exponential, etc.).

Implementation

Parameters

  • cones_observations_freq: float
  • cones_observations_range_noise_model: string
  • cones_observations_bearing_noise_model: string (in "uniform", "uni","exponential","exp","normal", "gaussian")
  • cones_observations_range_noise_param: float (either max value for uniform (symmetric support), 1/mean for exp, std for normal)
  • cones_observations_bearing_noise_param: float

Publishers

  • /ihm2/cones_observations: ihm2/msg/ConesObservations

Custom interfaces

  • ihm2/mgs/ConesObservations: based on the following .msg file:
    # ConesObservations
    std_msgs/Header header
    uint8 BLUE = 0
    uint8 YELLOW = 1
    uint8 SMALL_ORANGE = 2
    uint8 BIG_ORANGE = 3
    float64[] rho
    float64[] theta
    uint8[] colors
    float64[] rho_uncertainty # std dev of the rho (range) measurement
    float64[] theta_uncertainty # std dev of the theta (bearing) measurement
    float64[] colors_confidence # confidence of the color measurement, between 0 and 1
    

Implement IHM2 controller with FKin6 model

Goal

First implementation of the principal goal of this repo: develop new fancy controllers.

Implementation

For the moment, the acados ocp solver is generated for a particular track because of the splines embedded in the model. Either we find a way to provide the parameters of those splines at runtime, or we generate several controllers. Cf issue #6

how to properly handle the track options for the controller

Basically, each ocp solver will be generated for one track and only one track. When we switch tracks, we have to switch controllers.

  • Do we pre-generate controllers for all tracks and include them all ? => to be done properly, we would have to create some enums (maybe)
  • do we generate them lazily by calling a python script? => would be hard to source the right env from c++

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.