Ackermann Steering Kinematic from ros2 controllers
The following image shows a four-wheeled robot with two independent steering wheels in the front.
-
$w_f$ is the wheel track of the front axle, measured between the two kingpins.
To prevent the front wheels from slipping, the steering angle of the front wheels cannot be equal. This is the so-called Ackermann steering.
Note
Ackermann steering can also be achieved by a mechanical linkage between the two front wheels. In this case the robot has only one steering input, and the steering angle of the two front wheels is mechanically coupled. The inverse kinematics of the robot will then be the same as in the car-like model above.
Forward Kinematics
The forward kinematics is the same as for the car-like model above.
Inverse Kinematics
The turning radius of the robot is
Then the steering angles of the front wheels must satisfy these conditions to avoid skidding
Odometry
The calculation of
holds. But to get a more robust solution, we take the average of both , i.e.,
The following image shows a four-wheeled car-like robot with two independent steering wheels at the front, which are also driven independently.
-
$d_{kp}$ is the distance from the kingpin to the contact point of the front wheel with the ground.
Forward Kinematics
The forward kinematics is the same as the car-like model above.
Inverse Kinematics
To avoid slipping of the front wheels, the velocity of the front wheels cannot be equal and
with turning radius of the robot and the left/right front wheel
This results in the following inverse kinematics equations
with the steering angles of the front wheels from the Ackermann steering equations above.
Odometry
The calculation of
holds. But to get a more robust solution, we take the average of both , i.e.,
- ROS2 ROS2 Documentation (Seguir Desktop Install)
- Gazebo
sudo apt install ros-<version_ros>-gazebo-ros-pkgs - Xacro
sudo apt install ros-<version_ros>-xacro - <version_ros>: Actualmente se esta empleando iron
Important
Para utlizar ROS2, siempre hacer source ROS2 en cada nueva terminal source /opt/ros/iron/setup.bash
-
comandos de ejecución:
ros2 launch urdf_tutorial display.launch.py model:=<path to ackermann_model.urdf>
Important
Es necesario instalar el paquete urdf_tutorial mediante sudo apt install ros-iron-urdf-tutorial
- ackermann.xacro Archivo que modela la estructura del robot
- params.xacro Archivo que contiene parámetros del robot
-
El archivo de lanzamiento en python es creado en un paquete de ROS. Para más información sobre la creación de paquetes y su compilación ver creating a package
-
Para la visualización mediante los nodos
robot_state_publisher,joint_state_publisheryrviz2se realizó el siguiente launch file visualization.launch.py
Note
La variable urdf_path en la línea 8 debe ser modificado a la ruta del archivo .xacro
Note
La ruta al archivo config.rviz debe ser modificada por la ruta de un archivo de ocnfiguración de RVIZ previamente creado o en su defecto eliminar la opción del comando, en ese caso la configuración debe realizarse de forma manual una vez abierto RVIZ
comandos de ejecución:
cd <workspace>
source install/local_setup.bash
ros2 launch ackermann_robot visualization.launch.py
La visualización del robot es:
Utilizando rqt_graph se visualiza el siguiente grafo:

-
Para añadir un nodo de control se utliza el driver
libgazebo_ros_ackermann_drive.so, este es vinculado al robot con el siguiente archivo gazebo.xacro. Para modularizar los componentes del robot se utliza el archivo robot.xacro (archivo principal que integra los componentes del robot) -
Para la visualización mediante los nodos
robot_state_publisher,spawn_entityygazebose realizó el siguiente launch file visualization.launch.py. Adicionalmente, también se agregó el nodorviz2
Note
La variable urdf_path en la línea 12 debe ser modificado a la ruta del archivo .xacro
Note
La ruta al archivo config_lidar.rviz debe ser modificada por la ruta de un archivo de ocnfiguración de RVIZ previamente creado o en su defecto eliminar la opción del comando, en ese caso la configuración debe realizarse de forma manual una vez abierto RVIZ
-
Para agregar un sensor tipo LIDAR se utiliza el driver
libgazebo_ros_ray_sensor.so, vinculado al robot en el archivo lidar.xacro. El driver envía mensajes del tipoLaserScana través del tópicoscan.comandos de ejecución:
cd <workspace> source install/local_setup.bash ros2 launch ackermann_robot gazebo.launch.py
Warning
Para visualizar el sensor en RVIZ es necesario añadir la visualización manualmente con el mensaje tipo LaserScan y luego vincularlo al tópico scan.
La visualización del robot en GAZEBO es:
Los datos del sensor LIDAR en RVIZ:
Utilizando rqt_graph se visualiza el siguiente grafo:
