https://github.com/alepuglisi/bicycle-feedback-linearization-ros
Odeint Simulation and Feedback linearization Control, for Trajectory tracking of a bicycle kinematic/dynamic model, in ROS Noetic
https://github.com/alepuglisi/bicycle-feedback-linearization-ros
feedback-controller modeling odeint ros-noetic simulation trajectory-tracking
Last synced: 3 months ago
JSON representation
Odeint Simulation and Feedback linearization Control, for Trajectory tracking of a bicycle kinematic/dynamic model, in ROS Noetic
- Host: GitHub
- URL: https://github.com/alepuglisi/bicycle-feedback-linearization-ros
- Owner: AlePuglisi
- License: mit
- Created: 2024-11-29T09:51:34.000Z (6 months ago)
- Default Branch: main
- Last Pushed: 2024-12-17T17:47:05.000Z (5 months ago)
- Last Synced: 2024-12-28T08:12:15.275Z (5 months ago)
- Topics: feedback-controller, modeling, odeint, ros-noetic, simulation, trajectory-tracking
- Language: C++
- Homepage:
- Size: 21.5 MB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# bicycle-feedback-linearization-ros
ROS Noetic | Odeint simulation | Control of mobile Robot | Trajectory Tracking | Feedback Linearization| ModelingThis repository contains both the code and the report of the final assignment of a course on [control of mobile robots](https://www11.ceda.polimi.it/schedaincarico/schedaincarico/controller/scheda_pubblica/SchedaPublic.do?&evn_default=evento&c_classe=837146&lang=IT&__pj0=0&__pj1=8379d6c35eccfe1c998db9b2de7c0e1c).
## Introduction
In this project, I developed a trajectory-tracking controller for a car-like robot, modeled with the bicycle model.Both kinematic and dynamic (linear and fiala tyre) models are analyzed.
The control scheme is based on an inner feedback linearization (based on the kinematic model), transforming the system model to the canonical unicycle.
Then an outer x and y PI independent velocity controllers regulate the system position, to track the reference trajectory.For further details on the model equations and parameters, on the reference trajectory and on the control scheme, refer to my [report](https://github.com/AlePuglisi/bicycle-feedback-linearization-ros/blob/main/Trajectory_Tracking_Report.pdf)
## Objective
Define bicycle model kinematic and dynamic equations, and implement a ROS-based simulation and control software.
Use it to tune the PI trajectory tracking controllers (for x,y position control) and analyze the performance.
(Notice that the feedback linearization law is based on the kinematic model, for the dynamic model, a perfect linearization is not possible in this way, and performances are not the best)In this course, we focus on control and modeling, so instead of using classical simulators like Gazebo, we use C++ library [odeint](https://headmyshoulder.github.io/odeint-v2/) for explicit differential equation resolution.
Look at the [assignment](https://github.com/AlePuglisi/bicycle-feedback-linearization-ros/blob/main/assignment.pdf) for more details.
## Packages description
The packages of this project are:
- ``car_simulator``:
Responsible for kin/dyn model simulation.
- ``car_traj_control``:
Provide the control feedback linearization + PI control law.>[!NOTE]
> For a clean code, the executables are organized as follows:
> Executables of ``car_simulator`` are:
> - "simulator", with the ROS node functions implementation
> - "simulator"_ode, with the modeling and odeint related functions
> - "simulator"_node, just initialize and run the node
>
> Executables of ``car_traj_control`` are:
> - car_fblin, implement feedback linearization
> - car_traj_control, ROS node functions implementation and control law computation
> - car_traj_control_node, just initialize and run the node## Run the Code
First, clone this repo in your ros workspace
```
git clone https://github.com/AlePuglisi/bicycle-feedback-linearization-ros.git
```
Build and source your workspace, and you are ready to use it!```
# Terminal 0, always remember roscore!
roscore
```- Simulation test:
To test if the odeint simulator is working, car_test publishes some test commands to see if the system behaves as expected.
- **Kinematic** model:
```
# Terminal 1
roslaunch car_simulator car_simulator_kin.launch
```
- **Dynamic** model:
```
# Terminal 1
roslaunch car_simulator car_simulator_dyn.launch
```- Control:
- **Kinematic** model:
```
# Terminal 1
roslaunch car_traj_control car_traj_control_kin.launch
```
- **Dynamic Linear Tyre** model:
```
# Terminal 1
roslaunch car_traj_control car_traj_control_dynlin.launch
```
- **Dynamic Fiala Tyre** model:
```
# Terminal 1
roslaunch car_traj_control car_traj_control_dynfiala.launch
```- Performance analysis and plot:
The Python [script](https://github.com/AlePuglisi/bicycle-feedback-linearization-ros/blob/main/car_traj_control/script/plot_result.py) to visualize robot xy-plane trajectory and useful insight signals over time, is based on
``rosbag`` readings, and ``matplotlib``.
This script is executed by (being on the script folder):
```
python3 plot_result.py
```
The argument "bag_name" refers to the name of a recorded bag over the whole simulation lifetime.
This bag is saved in the same folder as this Python script.
(Some bags are already present there, and are the ones used for the report results)## Conclusion
This project provides ROS-based software for the simulation and trajectory control of a car-like robot through a bicycle model.
Experimenting with the PI control gains [here](https://github.com/AlePuglisi/bicycle-feedback-linearization-ros/tree/main/car_traj_control/config), can help to understand the effect of PI control law on a trajectory tracking controller.
Also, this simulation approach is very different from the classical one but provides a white-box simulation approach for simple systems, that ensures its behavior.