This repo supports Multimodal Model Predictive Runtime Verification of the F1Tenth vehicle.
Without Monte Carlo Multimodal Prediction | With Monte Carlo Multimodal Prediction |
---|---|
![]() |
![]() |
- The purple/pink line is the reference trajectory of the ego-vehicle.
- The blue/cyan line is the trajectory produced by MPC that the ego-vehicle is following.
- The green line is the reference trajectory of the opponent vehicle.
- Note, there is some additional lag in the visualization on RVIZ (since the visualization messages for this simulation are massive), but the vehicle's control strategies are meeting real-time requirements.
-
Install F1Tenth OpenAI Gym environment.
git clone https://github.com/f1tenth/f1tenth_gym cd f1tenth_gym && pip3 install -e .
-
Install F1Tenth ROS2 Simulator.
cd $HOME && mkdir -p sim_ws/src cd sim_ws/src git clone https://github.com/f1tenth/f1tenth_gym_ros source /opt/ros/foxy/setup.bash cd .. rosdep install -i --from-path src --rosdistro foxy -y
-
Install this repo.
cd $HOME/sim_ws/src git clone https://github.com/aaurandt/MMPRV_F1Tenth.git sudo apt-get update sudo apt-get install ros-foxy-ackermann-msgs
-
Run the following commands:
cd $HOME/sim_ws/src/ mv ./MMPRV_F1Tenth/gym_bridge.rviz ./f1tenth_gym_ros/launch mv ./MMPRV_F1Tenth/sim.yaml ./f1tenth_gym_ros/config
-
Install F1Tenth Racetracks.
cd $HOME/sim_ws/src/ git clone https://github.com/f1tenth/f1tenth_racetracks.git
-
Install OSQP.
cd $HOME/sim_ws/src git clone --recursive https://github.com/oxfordcontrol/osqp
-
Install OSQPEigen.
cd $HOME/sim_ws/src git clone https://github.com/robotology/osqp-eigen.git cd osqp-eigen mkdir build && cd build cmake ../ make sudo make install
-
Build the project.
cd $HOME/sim_ws colcon build
Open three terminals and run the following commands in each terminal in the order listed:
-
Run opponent vehicle running RRT*.
cd $HOME/sim_ws source install/setup.bash ros2 run rrt_star rrt_star
-
Launch the simulator.
cd $HOME/sim_ws source install/setup.bash ros2 launch f1tenth_gym_ros gym_bridge_launch.py
-
Run ego-vehicle running MPC.
cd $HOME/sim_ws source install/setup.bash ros2 run mpc mpc_node
To manually move the ego-vehicle (blue) around use 2D Pose Estimate in the top bar of RVIZ.
To manually move the opponent vehicle (orange) around use 2D Goal Pose in the top bar of RVIZ.
Change values of K and N in $HOME/sim_ws/src/MMPRV_F1Tenth/mpc/mpc_node.cpp
Each run automatically writes the trace, atomic probability, and latency to a csv $HOME/sim_ws.
Reference the following repo for running MMPRV on the collected data: https://github.com/aaurandt/MMPRV_R2U2