Skip to content

hsk-mobile-robotics/youbot_simulation

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

29 Commits
 
 
 
 
 
 

Repository files navigation

YouBot Simulation

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.

Prerequisites

First update your system by running the following command in a terminal

sudo apt update
sudo apt upgrade

ROS2

Install the latest version of ROS 2 Humble by following the instructions here

Gazebo Classic

Install Gazebo Classic with the following command

sudo apt install gazebo

Create your workspace

Create a workspace for ROS. Run the following code to create your workspace with the src subdirectory.

mkdir -p your_workspace/src

Note

You can use any name you like for your workspace. For the rest of this file we will assume you name it your_workspace

Installing

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

Build your ROS 2 workspace

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

Source your workspace

Now you need to source the workspace by running:

source install/setup.bash

Start the simulation

To start the simulation use the following command:

ros2 launch youbot_gazebo youxacro.launch.py

Moving the Youbotmodel

Once the simulation is running, you can move the robot by sending a command to the ROS2 topic /cmd_vel.

Move in a circle

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}}"

Drive the Youbot

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

About

No description, website, or topics provided.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors