linorobot2 is a ROS2 port of the linorobot package

Overview

linorobot2

linorobot2

linorobot2 is a ROS2 port of the linorobot package. If you're planning to build your own custom ROS2 robot (2WD, 4WD, Mecanum Drive) using accessible parts, then this package is for you. This repository contains launch files to easily integrate your DIY robot with Nav2 and a simulation pipeline to run and verify your experiments on a virtual robot in Gazebo.

Once the robot's URDF has been configured in linorobot2_description package, users can easily switch between booting up the physical robot and spawning the virtual robot in Gazebo.

linorobot2_architecture

Assuming you're using one of the tested sensors, linorobot2 automatically launches the necessary hardware drivers, with the topics being conveniently matched with the topics available in Gazebo. This allows users to define parameters for high level applications (ie. Nav2 SlamToolbox, AMCL) that are common to both virtual and physical robots.

The image below summarizes the topics available after running bringup.launch.py. linorobot2_microcontroller

An in-depth tutorial on how to build the robot is available in linorobot2_hardware.

Installation

This package requires ros-foxy or ros-galactic. If you haven't installed ROS2 yet, you can use this installer script that has been tested to work on x86 and ARM based dev boards ie. Raspberry Pi4/Nvidia Jetson Series.

1. Robot Computer - linorobot2 Package

The easiest way to install this package on the robot computer is to run the bash script found in this package's root directory. It will install all the dependencies, set the ENV variables for the robot base and sensors, and create a linorobot2_ws (robot_computer_ws) on the robot computer's $HOME directory. If you're using a ZED camera with a Jetson Nano, you must create a custom Ubuntu 20.04 image for CUDA and the GPU driver to work. Here's a quick guide on how to create a custom image for Jetson Nano.

source /opt/ros/
   
    /setup.bash
cd /tmp
wget https://raw.githubusercontent.com/linorobot/linorobot2/master/install_linorobot2.bash
bash install_linorobot2.bash 
     
      
      
       
source ~/.bashrc

      
     
    
   

robot_type:

  • 2wd - 2 wheel drive robot.
  • 4wd - 4 wheel drive robot.
  • mecanum - Mecanum drive robot.

laser_sensor:

Sensors marked with an asterisk are depth sensors. If a depth sensor is used as a laser sensor, the launch files will run depthimage_to_laserscan to convert the depth sensor's depth image to laser scans.

depth_sensor:

Alternatively, follow this guide to do the installation manually.

2. Host Machine / Development Computer - Gazebo Simulation (Optional)

This step is only required if you plan to use Gazebo later. This comes in handy if you want to fine-tune parameters (ie. SLAM Toolbox, AMCL, Nav2) or test your applications on a virtual robot.

2.1 Install linorobot2 Package

Install linorobot2 package on the host machine:

cd 
   
    
git clone https://github.com/linorobot/linorobot2 src/linorobot2
rosdep update && rosdep install --from-path src --ignore-src -y --skip-keys microxrcedds_agent --skip-keys micro_ros_agent
colcon build
source install/setup.bash

   
  • microxrcedds_agent and micro_ros_agent dependency checks are skipped to prevent this issue of finding its keys. This means that you have to always add --skip-keys microxrcedds_agent --skip-keys micro_ros_agent whenever you have to run rosdep install on the ROS2 workspace where you installed linorobot2.

2.2 Define Robot Type

Set LINOROBOT2_BASE env variable to the type of robot base used. Available env variables are 2wd, 4wd, and mecanum. For example:

> ~/.bashrc source ~/.bashrc ">
echo "export LINOROBOT2_BASE=2wd" >> ~/.bashrc
source ~/.bashrc

You can skip the next step (Host Machine - RVIZ Configurations) since this package already contains the same RVIZ configurations to visualize the robot.

3. Host Machine - RVIZ Configurations

Install linorobot2_viz package to visualize the robot remotely specifically when creating a map or initializing/sending goal poses to the robot. The package has been separated to minimize the installation required if you're not using the simulation tools on the host machine.

cd 
   
    
git clone https://github.com/linorobot/linorobot2_viz src/linorobot2_viz
rosdep update && rosdep install --from-path src --ignore-src -y 
colcon build
source install/setup.bash

   

Hardware and Robot Firmware

All the hardware documentation and robot microcontroller's firmware can be found here.

URDF

1. Define robot properties

linorobot2_description package has parameterized xacro files that can help you kickstart writing the robot's URDF. Open .properties.urdf.xacro in linorobot2_description/urdf directory and change the values according to the robot's specification/dimensions. All pose definitions must be measured from the base_link (center of base) and wheel positions (ie wheel_pos_x) are referring to wheel 1.

For custom URDFs, you can change the urdf_path in description.launch.py found in linorobot2_description/launch directory.

Robot Orientation:

--------------FRONT--------------

WHEEL1 WHEEL2 (2WD/4WD)

WHEEL3 WHEEL4 (4WD)

--------------BACK--------------

Build the robot computer's workspace to load the new URDF:

cd 
   
    
colcon build

   

The same changes must be made on the host machine's .properties.urdf.xacro if you're simulating the robot in Gazebo. Remember to also build the host machine's workspace after editing the xacro file.

cd 
   
    
colcon build

   

2. Visualize the newly created URDF

Robot Computer:

ros2 launch linorobot2_description description.launch.py

Optional parameters for simulation on host machine:

  • rviz - Set to true to visualize the robot in rviz2 and only if you're configuring the URDF from the host machine. For example:

      ros2 launch linorobo2_description description.launch.py rviz:=true
    

Host Machine:

The rviz argument on description.launch.py won't work on headless setup but you can visualize the robot remotely from the host machine:

ros2 launch linorobot2_viz robot_model.launch.py

Quickstart

All commands below are to be run on the robot computer unless you're running a simulation or rviz2 to visualize the robot remotely from the host machine. SLAM and Navigation launch files are the same for both real and simulated robots in Gazebo.

1. Booting up the robot

1.1a Using a real robot:

ros2 launch linorobot2_bringup bringup.launch.py

Optional parameters:

  • base_serial_port - Serial port of the robot's microcontroller. The assumed value is /dev/ttyACM0. Otherwise, change the default value to the correct serial port. For example:

    ros2 launch linorobot2_bringup bringup.launch.py base_serial_port:=/dev/ttyACM1
    
  • joy - Set to true to run the joystick node in the background. (Tested on Logitech F710).

Always wait for the microROS agent to be connected before running any application (ie. creating a map or autonomous navigation). Once connected, the agent will print:

| Root.cpp             | create_client     | create
| SessionManager.hpp   | establish_session | session established

The agent needs a few seconds to get reconnected (less than 30 seconds). Unplug and plug back in the microcontroller if it takes longer than usual.

1.1b Using Gazebo:

ros2 launch linorobot2_bringup gazebo.launch.py

linorobot2_bringup.launch.py or gazebo.launch.py must always be run on a separate terminal before creating a map or robot navigation when working on a real robot or gazebo simulation respectively.

2. Controlling the robot

2.1 Keyboard Teleop

Run teleop_twist_keyboard to control the robot using your keyboard:

ros2 run teleop_twist_keyboard teleop_twist_keyboard

Press:

  • i - To drive the robot forward.
  • , - To reverse the robot.
  • j - To rotate the robot CCW.
  • l - To rotate the robot CW.
  • shift + j - To strafe the robot to the left (for mecanum robots).
  • shift + l - To strafe the robot to the right (for mecanum robots).
  • u / o / m / . - Used for turning the robot, combining linear velocity x and angular velocity z.

2.2 Joystick

Pass joy argument to the launch file and set it to true to enable the joystick. For example:

ros2 launch linorobot2_bringup bringup.launch.py joy:=true
  • On F710 Gamepad, the top switch should be set to 'X' and the 'MODE' LED should be off.

Press Button/Move Joystick:

  • RB (First top right button) - Press and hold this button while moving the joysticks to enable control.
  • Left Joystick Up/Down - To drive the robot forward/reverse.
  • Left Joystick Left/Right - To strafe the robot to the left/right.
  • Right Joystick Left/Right - To rotate the robot CW/CCW.

3. Creating a map

3.1 Run SLAM Toolbox:

ros2 launch linorobot2_navigation slam.launch.py

Optional parameters for simulation on host machine:

For example:

ros2 launch linorobot2_navigation slam.launch.py rviz:=true sim:=true
  • sim - Set to true for simulated robots on the host machine. Default value is false.
  • rviz - Set to true to visualize the robot in RVIZ. Default value is false.

3.1 Run rviz2 to visualize the robot from host machine:

The rviz argument on slam.launch.py won't work on headless setup but you can visualize the robot remotely from the host machine:

ros2 launch linorobot2_viz slam.launch.py

3.2 Move the robot to start mapping

Drive the robot manually until the robot has fully covered its area of operation. Alternatively, the robot can also receive goal poses to navigate autonomously while mapping:

ros2 launch nav2_bringup navigation_launch.py
  • Pass use_sim_time:=true to the launch file when running in simulation.

More info here.

3.3 Save the map

cd linorobot2/linorobot2_navigation/maps
ros2 run nav2_map_server map_saver_cli -f 
   
     --ros-args -p save_map_timeout:=10000

   

4. Autonomous Navigation

4.1 Load the map you created:

Open linorobot2/linorobot2_navigation/launch/navigation.launch.py and change MAP_NAME to the name of the newly created map. Build the robot computer's workspace once done:

cd 
   
    
colcon build

   

Alternatively, map argument can be used when launching Nav2 (next step) to dynamically load map files. For example:

ros2 launch linorobot2_navigation navigation.launch.py map:=
   
    /
    
     .yaml

    
   

4.2 Run Nav2 package:

ros2 launch linorobot2_navigation navigation.launch.py

Optional parameter for loading maps:

  • map - Path to newly created map .

Optional parameters for simulation on host machine:

  • sim - Set to true for simulated robots on the host machine. Default value is false.
  • rviz - Set to true to visualize the robot in RVIZ. Default value is false.

4.3 Run rviz2 to visualize the robot from host machine:

The rviz argument for navigation.launch.py won't work on headless setup but you can visualize the robot remotely from the host machine:

ros2 launch linorobot2_viz navigation.launch.py

Check out Nav2 tutorial for more details on how to initialize and send goal pose.

Troubleshooting Guide

1. The changes I made on a file are not taking effect on the package configuration/robot's behavior.

  • You need to build your workspace every time you modify a file:

    cd 
         
          
    colcon build
    #continue what you're doing...
    
         

2. [slam_toolbox]: Message Filter dropping message: frame 'laser'

  • Try to up transform_timeout by 0.1 in linorobot2_navigation/config/slam.yaml until the warning is gone.

3. target_frame - frame does not exist

  • Check your .properties.urdf.xacro and ensure that there's no syntax errors or repeated decimal points.

Useful Resources:

https://navigation.ros.org/setup_guides/index.html

http://gazebosim.org/tutorials/?tut=ros2_overview

Owner
linorobot
linorobot
A fully automated system that transforms Twitch clips into gaming compilations

A fully automated system that transforms Twitch clips into gaming compilations Authors: Christian C., Moritz M., Luca S. Related Projects: Neural Netw

215 Dec 27, 2022
A bot that deletes any embeds sent by a tropical webhook containing hex #000000 rancher's boots

tropical-webhook-cleanup how to use download the source code as zip get your discord bot token from https://discord.com/developers/applications put yo

carreb 0 Nov 25, 2022
A minimal open source mtg-like tcg game made in python that can be played on a terminal emulator using a keyboard.

A minimal open source mtg-like tcg game made in python that can be played on a terminal emulator using a keyboard.

Amos 3 Aug 29, 2021
2d war game single player

WarGame-third-version-0.0.4- 2d war game single player Hi ! Today, I publish on GitHub the version 0.0.4 of "WarGame". In this version, you can find a

Edouard Vincent 2 Apr 08, 2022
Racers-API - a game where you have to go around racing with your car, earning money

Racers-API About Racers API is a game where you have to go around racing with yo

3 Jan 09, 2022
A simple log-frequency helper for solving Wordle puzzles

A Simple Helper for Wordle Basic Usage Clone the repo and run python play.py Select a word from the list, or type your own choice of word Type the sam

Christian Casey 2 Feb 14, 2022
Turn NY Times crosswords into Across Lite files

NYT Crossword to Puz A windows program to convert NY Times crosswords from the web to Across Lite compatible files. To run this, first download and de

31 Oct 11, 2022
🕹️ Jeu Azul en Python avec 4 IAs 🤖 implémentées, jouable de 1 à 4 joueurs

Projet jeu Azul 🕹️ Jeu Azul en Python avec 4 IAs 🤖 implémentées, jouable de 1 à 4 joueurs Par : Berachem MARKRIA et Tristan MARTINEZ Projet réalisé

Berachem Markria 2 Jun 07, 2022
A classic alien shooting game.

Space-Invaders A classic alien shooting game. Description An open source game created by me and friends. How to play Install the latest python version

Phạm Thanh Sơn 1 Feb 08, 2022
用于 blivechat 的图形界面

blivechat GUI 用于 blivechat 的图形界面。 有朋友在搞 Vtuber,像 blivechat 类似的项目能通过自定义 CSS 的方式在 OBS 上添加一个非常好看的聊天栏。但是想要在桌面端看到弹幕的话得要再开一个浏览器页面,十分不方便。就想写一个背景透明的浮窗浏览器。 挺喜欢

Silence 11 Dec 29, 2022
This a secret santa game organizer that assigns secret santa randomly to each participant and then sends an automated mail to each santa with details of his/her secret santa child.

Before executing the script, make sure to turn on 'Less Secure App access' option from your gmail ID that will be used to send out the mails to all participants of the game. To do so, get going with

DEV_FINWIZ 10 Dec 06, 2022
This is a python implementation of wordle, which uses the same set of available words as the hit game, Wordle

Wordle Game This is a python implementation of wordle, which uses the same set of available words as the hit game, Wordle. Play the game manually pyth

Pierre Theo Klein 11 Mar 04, 2022
Chesston (Chess+Python) is a two-player chess game with graphical user interface written in PyQt5

♟️ Chesston (Chess+Python) is a two-player chess game with graphical user interface written in PyQt5. 💿 Dependencies This program uses Py

6 May 26, 2022
狼人杀,线下面杀用,服务端语音播报,浏览器操作,移动端友好。不再需要真人法官~

Wolf 狼人杀面杀法官系统 Preview 如何使用 安装 Python 3.5.2 版本及以上(PyWebIO 要求) pip install -r requirements.txt python main.py 所有玩家访问 Web 服务 TODO,欢迎PR TTS 目前仅支持 macOS 未

Lake Chan 33 Nov 11, 2022
Wordle Solver: A simple script which is also called Wordle solver

wordle-solver this code is a simple script which is also called Wordle solver. t

amirreza 1 Feb 15, 2022
Logo hitting the corner == best feeling ever!

Bouncing DVD logo - Pygame A little ride back to the 90s. Ah good ol' time! Didn't we all wait for the logo to hit the corners? Best feeling ever!! I

Hoang Nguyen 3 May 25, 2022
FlappyBird game with python and pygame

FlappyBird game with python and pygame

Mohammad Dori 4 Jul 15, 2022
Hagia is a 2D game engine and toolset for Python.

HAGIA What is Hagia? Hagia is a 2D game engine and toolset for Python. Hagia has

star 3 Jun 01, 2022
Ghdl-interactive-sim - Interactive GHDL simulation of a VHDL adder using Python, Cocotb, and pygame

GHDL Interactive Simulation This is an interactive test bench for a simple VHDL adder. It uses GHDL to elaborate/run the simulation. It is coded in Py

Chuck Benedict 2 Aug 11, 2022
PyGame-Tutorial - Refrence for building games in pygame

PyGame-Tutorial How to build games using the python library PyGame End result Ho

St. Mark's Computer Science Club 2 Jan 09, 2022