Controlling the simulated robot in RViz2

Setup

Hint

Before installing any packages from apt, make sure existing packages are up-to-date:

sudo apt update && sudo apt upgrade -y

Hint

ROS packages installed from apt are only available in terminals where the ROS environment has been sourced. To use these packages, you must first source the general ROS 2 environment:

source /opt/ros/jazzy/setup.bash
  1. Install teleop twist keyboard from apt:

    sudo apt install ros-jazzy-teleop-twist-keyboard
    
  2. Navigate to your colcon workspace:

    cd ~/<your_colcon_workspace>/src
    
  3. Clone the robotont_driver package:

    git clone https://github.com/robotont/robotont_driver.git
    
  4. Build the package:

    colcon build --packages-select robotont_driver
    
  5. Start the driver:

    ros2 launch robotont_driver fake_driver_launch.py
    

Controlling the robot using teleop twist keyboard

  1. Start the teleop_twist_keyboard node:

    ros2 run teleop_twist_keyboard teleop_twist_keyboard
    
  2. Use the following keys to move the robot:

    _images/teleop_twist_terminal.png

    Hint

    Note that teleop only receives keypresses when the terminal window is active (in focus).

    Tip

    Use CTRL + C to stop the node.