Giter VIP home page Giter VIP logo

vehiclecontrol's Introduction

Table of Contents

Introduction

This repository includes the commonly used control algorithms for vehicle motion like PID, LQR, MPC and other algorithms based on geometry model like Stanley, Pure Pursuit and Rear Wheel Feedback.

Two scenarios are tested here:

  • forward driving in curved road with differernt velocity and radius
  • reverse driving in curved road

The velocity of test trajectory is in the range from 10m/s to 25m/s, a part of result plot is post in below, all the plots can be found in the folder named result_plot.

The simulation is conducted in GAZEBO, the vehicle model and the senario are obtained from the Demo of Prius in ROS/GAZEBO(https://github.com/osrf/car_demo.git).

Prius_image Prius_image_2 ![senario]senario

WorkFlow

work_flow

Usage

Run Example

~$ cd catkin_ws/src//car_demo/multi_launch/
# forward running in an empty world with smooth, artificial trjaectory
~/catkin_ws/src//car_demo/multi_launch$ ./forward.sh
# reverse running in an empty world with smooth, artificial trjaectory
~/catkin_ws/src//car_demo/multi_launch$ ./reverse.sh
# running in an simulated environment with recored trajectory
~/catkin_ws/src//car_demo/multi_launch$ ./simulated_world.sh
# running in an simulated environment with ramp
~/catkin_ws/src//car_demo/multi_launch$ ./run_in_ramp.sh

working process

Choose Test Trajectory

~$ cd catkin_ws/src/car_demo/launch/
# change the trajectory in empty world
~/catkin_ws/src//car_demo/launch$ gedit publish_mat_trajectory.launch
# change the trajectory in simulated world
~/catkin_ws/src//car_demo/launch$ gedit publish_recorded_trajectory.launch

Modify the value of test trajectory file path to change the test trajectories.The availble test trajectories can be found in the folder named "test_trajectories".

In this folder, the trajectory file starting with "mat" means that it is a artificial trajectory, and the recorded trajectories are recorded in the GAZEBO senario, which are not so smooth, but closer to the real situation.

The last num of trajectory file name means the velocity of vehicle running in curve, only for the "mat trajectories", the velocity of recorded trajectories are not constant.

Record Trajectory

Recording a trajectory is a good method to generate an availble trajectory in the city environment.

  1. find the plugin code
~$ cd catkin_ws/src/car_demo/plugins/
~/catkin_ws/src//car_demo/plugins$ gedit PriusHybridPlugin.cc
  1. Switch on the recording function
    correct the record_enabled into True

  2. roslaunch

~$ roslaunch car_demo record_trajectory.launch
  1. record trajectory
    "W","A","D" are the control keys
    "S" is "reverse"
    "E" is "brake"

  2. Get recorded trajectory
    The recorded trajectory is stored in the folder (catkin_ws/src/car_demo/recorded_trajectories), you can trim it and move it to the test_trajectories folder.

Choose Controller and Adjust Their Parameters

~$ cd catkin_ws/src/car_demo/conf/
~/catkin_ws/src//car_demo/conf$ gedit control_conf.txt

This file includes the physical parameters of vehicle model (can not be modified) and all the parameters (can be adjusted) required by the controllers and other important objects necessary during the operation of control module.

The controller can be classified into the distributed controllers (control longitudinal and lateral motion respectively) and centralized controllers (control the vehicle motion coupled).

To active distributed controller, the CONTROLLER_NUM must be 2, the next step is to set the LONGITUDINAL_CONTROLLER and LATERAL_CONTROLLER, the options are listed below them.

To active centralized controller, the CONTROLLER_NUM must be 1, the next step is to set the CENTRALIZED_CONTROLLER.

Choose the Plot shown

Since the FPS is low if we plot more than one figures simultaneously, so now there is only one plot can be shown during the simulation (after simulation, we can get all the plots, see Other Plot), the steps to choose the plot shown is:

~$ cd catkin_ws/src/car_demo/scripts/
~/catkin_ws/src//car_demo/scripts$ gedit TrajectoryPlotter.py

change the TARGET_PLOT to choose which plot you want to see during simulation, now there are three options

  • trajectory comparison
  • velocity comparison with station
  • heading angle comarison with station

Controllers

Result PLot Reverse

v=10m/s

Result PLot Forward

Pure Pursuit Controller

  • Trajectory Tracking v=10m/s v=15m/s
  • Velocity and Heading Tracking(working in process)
    v=10m/s v=10m/s

Stanley Controller

  • Trajectory Tracking v=10m/s v=15m/s
  • Velocity and Heading Tracking(working in process)

Rear Wheel Feedback Controller

  • Trajectory Tracking
    v=10m/s v=15m/s
  • Velocity and Heading Tracking(working in process)

LQR

  • Trajectory Tracking
    v=10m/s v=15m/s
  • Velocity and Heading Tracking(working in process)

LQR with prediction

  • Trajectory Tracking
    v=10m/s v=15m/s
  • Velocity and Heading Tracking(working in process)

MPC

  • Trajectory Tracking
    v=10m/s v=15m/s
  • Velocity and Heading Tracking(working in process)

Other Plot

~$ cd catkin_ws/src/car_demo/plot_py/
~/catkin_ws/src/car_demo/plot_py$ python result_plot.py

This program subscribes the published trajectory, vehicle localization and the vehicle working conditions like output torque, brake torque, traveled distance and so on.

It is very convenient to get these plots through simple modification of this code.

Maintainers

@djh1995555

vehiclecontrol's People

Contributors

djh1995555 avatar

Watchers

James Cloos avatar

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.