ROS Noetic | Odeint simulation | Control of mobile Robot | Trajectory Tracking | Feedback Linearization| Modeling
This repository contains both the code and the report of the final assignment of a course on control of mobile robots.
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
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 for explicit differential equation resolution.
Look at the assignment for more details.
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
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
- Kinematic model:
-
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
- Kinematic model:
-
Performance analysis and plot:
The Python script to visualize robot xy-plane trajectory and useful insight signals over time, is based on
rosbag
readings, andmatplotlib
.This script is executed by (being on the script folder):
python3 plot_result.py <bag_name>
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)
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, 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.