{"id":13798909,"url":"https://github.com/ros2/turtlebot2_demo","last_synced_at":"2025-05-13T06:31:45.999Z","repository":{"id":139040223,"uuid":"61739369","full_name":"ros2/turtlebot2_demo","owner":"ros2","description":null,"archived":true,"fork":false,"pushed_at":"2019-08-11T23:35:49.000Z","size":616,"stargazers_count":96,"open_issues_count":0,"forks_count":47,"subscribers_count":22,"default_branch":"master","last_synced_at":"2024-11-18T13:47:07.976Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"C++","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/ros2.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null}},"created_at":"2016-06-22T17:45:38.000Z","updated_at":"2024-08-30T12:33:05.000Z","dependencies_parsed_at":"2023-05-03T10:24:37.815Z","dependency_job_id":null,"html_url":"https://github.com/ros2/turtlebot2_demo","commit_stats":null,"previous_names":[],"tags_count":9,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ros2%2Fturtlebot2_demo","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ros2%2Fturtlebot2_demo/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ros2%2Fturtlebot2_demo/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ros2%2Fturtlebot2_demo/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/ros2","download_url":"https://codeload.github.com/ros2/turtlebot2_demo/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":253888965,"owners_count":21979536,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2024-08-04T00:00:56.410Z","updated_at":"2025-05-13T06:31:44.424Z","avatar_url":"https://github.com/ros2.png","language":"C++","funding_links":[],"categories":["Packages"],"sub_categories":["Examples"],"readme":"This repository contains the code and supporting files to run TurtleBot 2 demos using ROS 2. Due to reliance on existing Linux-only code and dependencies, these demos are intended for use only on Linux (that could change in the future).\n\nThe following instructions are for ROS Bouncy, if you are using ROS Ardent please refer to [these instructions](https://github.com/ros2/turtlebot2_demo/blob/ardent/README.md).\n\n\u003c!-- Here's a video of the very first successful run of ROS 2 follower: https://www.youtube.com/watch?v=YTlls9yHZog.\n\nThis is very much a work in progress and there's plenty of functionality present in the ROS 1 equivalent system that's currently missing or disabled, but it's an important step. --\u003e\n\nThis demo assumes that you have an Orbbec Astra depth camera. Extra work would be required to use the Kinect or Asus Xtion Pro. Without an Astra, you can still do joystick teleop.\nFor instructions on how to setup your turtlebot please see [Setup your turtlebot2](https://github.com/ros2/turtlebot2_demo/blob/master/Turtlebot_Setup.md)\n\n# Installation\n\n## Installation from binaries\n\nFirst, install ROS2 from binaries following [these instructions](https://github.com/ros2/ros2/wiki/Linux-Install-Debians)\n\nThen install the turtlebo2 demo specific packages:\n```\nexport ROS1_DISTRO=melodic\nsudo apt install ros-bouncy-turtlebot2* ros-$ROS1_DISTRO-kobuki-ftdi\n```\n\n## Installation from source\nThis assumes that you have ROS Kinetic installed (or at lease have the ros apt repository in your sources)\n\nFirst, install ROS2 from source following [these instructions](https://github.com/ros2/ros2/wiki/Linux-Development-Setup)\n\nThen get the turtlebo2 demos specific code:\n```\ncd \u003cYOUR_ROS2_WORKSPACE\u003e\nwget https://raw.githubusercontent.com/ros2/turtlebot2_demo/bouncy/turtlebot2_demo.repos\nvcs import src \u003c turtlebot2_demo.repos\n```\n\n### Install some dependencies:\n```bash\nexport ROS1_DISTRO=melodic # or kinetic if using Ubuntu Xenial\nsudo apt-get install --no-install-recommends -y libboost-iostreams-dev libboost-regex-dev libboost-system-dev libboost-thread-dev libceres-dev libgoogle-glog-dev liblua5.2-dev libpcl-dev libprotobuf-dev libsdl1.2-dev libsdl-image1.2-dev libsuitesparse-dev libudev-dev libusb-1.0-0-dev libyaml-cpp-dev protobuf-compiler python-sphinx ros-$ROS1_DISTRO-catkin ros-$ROS1_DISTRO-kobuki-driver ros-$ROS1_DISTRO-kobuki-ftdi\n```\n\nReason for each dependency:\n* `ros-$ROS1_DISTRO-kobuki-driver` : our ROS 2 kobuki driver builds on top of this package (and its dependencies)\n* `ros-$ROS1_DISTRO-kobuki-ftdi` : we use a `udev` rule from this package\n* `ros-$ROS1_DISTRO-common-msgs` : to support use of the `ros1_bridge`, we need the ROS 1 messages available (TODO: document use of the bridge to view depth images and other stuff)\n\n### Build the ros2 code\n\nFor resource constrained platforms we will split the build into 2 steps to make sure not to overflow the memory\n```bash\ncolcon build --symlink-install --packages-skip cartographer cartographer_ros cv_bridge opencv_tests ros1_bridge turtlebot2_amcl turtlebot2_drivers turtlebot2_follower turtlebot2_cartographer turtlebot2_teleop vision_opencv\n```\n\nNow the resource intensive packages and the ones depending on ROS1 packages:\n```bash\nsource /opt/ros/$ROS1_DISTRO/setup.bash\ncolcon build --symlink-install --packages-select cartographer cartographer_ros turtlebot2_amcl turtlebot2_cartographer turtlebot2_drivers turtlebot2_follower turtlebot2_teleop\n```\nGo grab a coffee (or a meal if you compile on ARM)\n\n# Configure a couple of things\n\n## Setup the udev rules\n\n### Copy the astra udev rules\n\n#### If you installed from binaries\nIf you installed from binary you'll need to download the udev rule by hand:\n```bash\nwget https://raw.githubusercontent.com/ros2/ros_astra_camera/ros2/56-orbbec-usb.rules\n```\n\n#### If you installed from source\n```bash\ncd ~/ros2_ws/src/ros2/ros_astra_camera\n```\n\n#### Copy the rules file\n```bash\nsudo cp 56-orbbec-usb.rules /etc/udev/rules.d\n```\n\n### Copy the kobuki udev rule\n\n```bash\nsudo cp `rospack find kobuki_ftdi`/57-kobuki.rules /etc/udev/rules.d\n```\n\n### Restart the udev service\n```bash\nsudo service udev reload\nsudo service udev restart\n```\n\n## Source your workspace\n\nIf installed from Debian packages\n```bash\nsource /opt/ros/$ROS1_DISTRO/setup.bash\nsource /opt/ros/bouncy/setup.bash\n```\n\nIf installed from source\n```bash\nsource /opt/ros/$ROS1_DISTRO/setup.bash\nsource ~/ros2_ws/install/local_setup.bash\n```\n\nYou'll need to do this step for every terminal you use for these demos\n\n# Run the demos\n\n## Joystick teleop\nThis is a classic teleoperation demo where the robot can be driven around using a gamepad controller. This demo has been tested with logitech controllers and uses `RB` as a deadman, the left joystick for driving forward/backward and the right joystick for rotation.\nTry the launch file:\n```\nlaunch `ros2 pkg prefix turtlebot2_teleop`/share/turtlebot2_teleop/launch/turtlebot_joy.py\n```\n\nOr, run the nodes separately:\n```\nros2 run turtlebot2_drivers kobuki_node\n```\n```\nros2 run joy joy_node\n```\n\nNote: this demo assumes that your controller is in D mode (switch on the back) and that the MODE led is on. \n\n## Follower\nThis demo uses the astra camera to detect blobs in the depthimage and follow them\nTry the launch file:\n```\nlaunch `ros2 pkg prefix turtlebot2_follower`/share/turtlebot2_follower/launch/turtlebot_follow.py\n```\n\nOr, run the nodes separately.\n```\nros2 run turtlebot2_drivers kobuki_node\n```\n```\nros2 run astra_camera astra_camera_node -- -dw 320 -dh 240 -C -I\n```\n```\nros2 run turtlebot2_follower follower\n```\n\n## Cartographer (mapping)\nThis demo is using Google cartographer to build a map of the environment. The resulting map can be visualized in RViz using the ros1_bridge (more information below).\n\n### Run the demo\nTry the launch file:\n```\nlaunch `ros2 pkg prefix turtlebot2_cartographer`/share/turtlebot2_cartographer/launch/turtlebot_carto_2d.py\n```\n\n### Visualize the results\nThe created map can be visualized in Rviz on a remote computer by using the dynamic bridge that converts messages between ROS1 and ROS2.\nThis assumes that you have a ROS2 dynamic bridge on your system.\n\n#### Installing the bridge\n\n##### From binaries:\nSetup your sources as explained on the [setup sources section](https://github.com/ros2/ros2/wiki/Linux-Install-Debians#setup-sources) and then run\n```bash\nsudo apt update \u0026\u0026 sudo apt install ros-bouncy-ros1-bridge\n```\n\n##### From source:\nBuild your ROS2 workspace as explained in [these instructions](https://github.com/ros2/ros1_bridge/blob/master/README.md#build-the-bridge-from-source).\n\n#### Run the bridge\n\nTerminal A:\n```bash\n. /opt/ros/$ROS1_DISTRO/setup.bash\nroscore\n```\n\nTerminal B:\n```bash\n. /opt/ros/$ROS1_DISTRO/setup.bash\n. \u003cYOUR_ROS2_WORKSPACE\u003e\nros2 run ros1_bridge dynamic_bridge\n```\n\nTerminal C:\n```bash\n. /opt/ros/$ROS1_DISTRO/setup.bash\nrosrun rviz rviz\n```\nTopics you can visualize in Rviz:\n- the map on the topic `/map`\n- the transforms on the topic `/tf`\n- the depth images on the topic `/depth`\n- the laserscans on the topic `/scans`\n\nNote: ROS Bouncy uses cartographer 0.3.0 that doesn't publish an occupancy grid on the `/map` topic anymore.\n\n## AMCL (localization)\nSee the [AMCL demo README](https://github.com/ros2/turtlebot2_demo/blob/master/turtlebot2_amcl/README.md)\n\n# Discussion\nWhat's happening here compared to the ROS 1 versions of these demos? Well, it's 100% ROS 2, with no bridge or shim. We took 4 different\napproaches in building the different pieces:\n\n1. Kobuki driver: we wrote a new, very small rclcpp node that calls into the existing kobuki driver packages, which are organized to be roscpp-independent. In this case, we're building on top of ROS 1 packages, but they don't use `roscpp` or other parts of the ROS 1 middleware, so we're just using them as supporting libraries.\n2. Astra driver: we forked and ported the existing ROS 1 package (there's no roscpp-independent package separation).\n3. Joystick driver: we wrote a simple rclcpp node from scratch (Linux-only for now).\n4. Follower node: we created a new package into which we copied and then ported the ROS 1 follower nodelet.\n\nAs we start migrating more code to ROS 2, we'll discover more about these kinds of techniques and arrive at some best practices that we can recommend for similar projects.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fros2%2Fturtlebot2_demo","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fros2%2Fturtlebot2_demo","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fros2%2Fturtlebot2_demo/lists"}