This repository provides a simulation environment for the KUKA YouBot in Gazebo using ROS 2. The simulation includes a Gazebo world setup, the YouBot robot model, and a launch file for easy execution.
First update your system by running the following command in a terminal
sudo apt update
sudo apt upgrade
Install the latest version of ROS 2 Humble by following the instructions here
Install Gazebo Classic with the following command
sudo apt install gazebo
Create a workspace for ROS. Run the following code to create your workspace with the src subdirectory.
mkdir -p your_workspace/srcNote
You can use any name you like for your workspace. For the rest of this file we will assume you name it your_workspace
In this section you will find the necessary packages for your Ros2 workspace, run the following command to get into the your_workspace/src folder
cd your_workspace/src
Now you need to install the necessary packages with the following command:
git clone https://github.com/hsk-mobile-robotics/youbot_simulation.git
git clone -b ros2 https://github.com/ros-simulation/gazebo_ros_pkgs.git
After you have installed the necessary packages, go back to your_workspace and build the workspace by using this command:
Important
Make sure you are in the your_workspace folder.
colcon build
If you do not want to build the workspace every time you change a file, you can use:
colcon build --symlink-install
Now you need to source the workspace by running:
source install/setup.bash
To start the simulation use the following command:
ros2 launch youbot_gazebo youxacro.launch.py
Once the simulation is running, you can move the robot by sending a command to the ROS2 topic /cmd_vel.
In this example we want the robot to move in a circle In a new terminal, use
ros2 topic pub --rate 1 /cmd_vel geometry_msgs/msg/Twist "{linear: {x: 2.0, y: 0.0, z: 0.0}, angular: {x: 0.0, y: 0.0, z: 1.8}}"
To stop the robot, use the following command
ros2 topic pub --once /cmd_vel geometry_msgs/msg/Twist "{linear: {x: 0.0, y: 0.0, z: 0.0}, angular: {x: 0.0, y: 0.0, z: 0.0}}"
You can move the robot manually with your keyboard using this command:
ros2 run teleop_twist_keyboard teleop_twist_keyboard
You should now be able to move the robot with your keybord.
Important
Note that the terminal with the keybord must be the selected/active terminal. <<<<<<< HEAD
=======
e0cbf80936849d4107357ed9889df1cbe9cb9793