Skip to content
/ twr Public

Two-Wheeled Robot (differential drive) based on ROS2 Jazzy

Notifications You must be signed in to change notification settings

AJedancov/twr

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

61 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

TWR Project

The aim of the project is to create a model of a robot with a differential drive based on ROS2. This robot model can be used for testing and evaluating various control and navigation algorithms in a simulated environment.

Ubuntu: 24.04
ROS2 Distro: Jazzy
Gazebo: Harmonic

Installation

Install dependencies

 sudo apt install ros-${ROS_DISTRO}-xacro \
                  ros-${ROS_DISTRO}-joint-state-publisher \            

Install ros2_control packages:

 sudo apt install ros-${ROS_DISTRO}-ros2-control \
                  ros-${ROS_DISTRO}-ros2-controllers \             

Install Gazebo for a specific ROS2 version. More details from the source.
In addition, we will need the ros2_control plugin for Gazebo:

 sudo apt install ros-${ROS_DISTRO}-ros-gz \
                  ros-${ROS_DISTRO}-gz-ros2-control

Install Nav2 framework packages:

sudo apt install ros-${ROS_DISTRO}-navigation2 \
                 ros-${ROS_DISTRO}-nav2-bringup

Build project

Open the directory where the ros2 workspace will be stored. Clone repository and build project:

 git clone https://github.com/AJedancov/twr.git
 cd twr
 colcon build

Source the setup files

Source the setup file from project directory on every new shell you open:

 # Replace ".bash" with your shell
 # Possible values are: setup.bash, setup.sh, setup.zsh
 source install/setup.bash

Model preview in RViz2

Use this launch file to see model preview in RViz2:

 ros2 launch twr_bringup rviz2.launch.py

Start simulation in Gazebo Sim

 ros2 launch twr_bringup twr_bringup.launch.py

Set the use_sim_time parameter to use Gazebo time (by default True).
Set the use_rviz2 to use RViz2 during simulation time (by default True).

Control

Keyboard control

Use the teleop_twist_keyboard package to implement basic keyboard control:

ros2 run teleop_twist_keyboard teleop_twist_keyboard --ros-args -r /cmd_vel:=/diff_drive_controller/cmd_vel -p stamped:=True

Set goal point

The robot is capable of moving to a given point in space. The Nav2 framework is used to implement the navigation task.
Use the "2D Goal Pose" function in RViz2 to set the desired position.

Available sensors

LIDAR

Topic name: /scan
Number of samples: 360
Range (m): 0.05 - 5

(Tip: to visualize LIDAR data in Gazebo, you need to activate the plugin Visualize Lidar and refresh list of topics.)