百科.dev
全部条目AI 编程趋势榜开源项目技术资讯提交条目
登录
< 返回工具列表
R

rosbot

> 编程语言
开源

基于 ROS 2 的机器人学习平台

200 stars0 点赞0 次浏览
访问官网GitHub

工具介绍

基于 ROS 2 的机器人学习平台

ROSBOT

ROS 2 based robot learning platform. Click the image to video showing robot design and navigation in action

Bill of Materials

The BOM has not been designed for easy replication but most all used components and alternatives considered are there with respective links of where were they purchased so maybe it helps someone putting together a similar build :) Click the image to open BOM

Run main rosbot/ros workspace

Disclaimer

The following documentation is various commands and information that I've written over the time the robot was in development and everything is not up to date or relevant but maybe it helps someone.

  • Add user to usb serial and input groups
    • sudo usermod -a -G input ubuntu
    • sudo usermod -a -G dialout ubuntu
    • sudo usermod -a -G tty ubuntu
  • Build rosbot (on both the robot and the remote PC)
    • cd ~/rosbot/ros to open workspace
    • rosdep install -i --from-path src --rosdistro foxy -y to install dependencies
    • git pull && colcon build to pull changes and build workspace
  • Launch rosbot on the robot
    • First build it if there have been any changes
    • Open new terminal
    • cd ~/rosbot/ros to open workspace
    • . install/local_setup.bash to load workspace overlay (on both robot and remote pc)
    • ros2 launch odrive_bringup rosbot.launch.py to launch rosbot (run on robot)
    • ros2 launch odrive_bringup rviz.launch.py to launch rviz (run on remote pc)
  • Run joystick teleop
    • Open new terminal
    • . install/local_setup.bash to load workspace overlay
    • ros2 launch teleop_twist_joy teleop.launch.py joy_config:='rosbot_xbox_bluetooth' cmd_vel:=/diff_drive_controller/cmd_vel_unstamped to launch joystick teleop
    • Hold down left trigger (button 6) and use left and right joysticks to control speed and rotation
    • Hold down right trigger (button 7) for boost (faster movements)
  • Launch odrive manual control (for testing only)
    • Open new terminal
    • . install/local_setup.bash to load workspace overlay
    • ros2 launch odrive_bringup odrive.launch.py to launch odrive test ()
    • ros2 topic pub -r 100 /left_wheel_joint_velocity_controller/commands std_msgs/Float64MultiArray "data: [1]"
    • ros2 topic pub -r 100 /right_wheel_joint_velocity_controller/commands std_msgs/Float64MultiArray "data: [-1]"
    • ros2 launch teleop_twist_joy teleop.launch.py joy_config:='rosbot_xbox_bluetooth' cmd_vel:=/diff_drive_controller/cmd_vel_unstamped to launch joystick teleop
    • Hold down left trigger (button 6) and use left and right joysticks to control speed and rotation
  • Launch usb xbox joystick teleop that publishes to /cmd_vel
    • ros2 launch teleop_twist_joy teleop.launch.py cmd_vel:=cmd_vel joy_config:=rosbot_xbox_usb

Debugging

  • Debugging
  • ros2 topic echo /joint_states to show joint states including velocity etc
  • ros2 topic echo /dynamic_joint_states to show dynamic joint states including axis error etc
  • ros2 run tf2_tools view_frames.py to generate frames.pdf frame tree
  • rqt to open RQT, add plugins such as Topics > Topic Monitor
  • ros2 run xacro xacro ./src/rosbot_description/urdf/rosbot.urdf.xacro to debug what's wrong with URDF file
  • ros2 run tf2_ros tf2_echo odom base_link to verify transforms from odom to base_link
    • At time 1634580767.596875940
      • Translation: [6.986, -2.328, 0.000]
      • Rotation: in Quaternion [0.000, 0.000, -0.210, 0.978]
    • At time 1634580768.594622939
      • Translation: [7.108, -2.383, 0.000]
      • Rotation: in Quaternion [0.000, 0.000, -0.213, 0.977]

Joystick teleop

  • https://index.ros.org/p/teleop_twist_joy/github-ros2-teleop_twist_joy/
  • https://github.com/ros2/teleop_twist_joy/tree/foxy/
  • http://wiki.ros.org/joy
  • https://github.com/medusalix/xow need xow to use xbox bluetooth controller
  • Configure XOW to use xbox controller over bluetooth
    • sudo apt install cabextract to install dependencies
    • git clone https://github.com/medusalix/xow
    • cd xow
    • make BUILD=RELEASE
    • sudo make install
    • sudo systemctl enable xow
    • sudo systemctl start xow
    • sudo systemctl kill -s SIGUSR1 xow to enable XOW pairing mode (generally not needed)
  • Disable ERTM
    • sudoedit /sys/module/bluetooth/parameters/disable_ertm
    • replace N with Y
    • reboot
  • Restart bluetooth
    • sudo service bluetooth restart
    • sudo rmmod btusb
  • Test controller
    • jstest /dev/input/js0
  • Also disable ERTM permanently
    • https://www.addictivetips.com/ubuntu-linux-tips/xbox-one-controllers-over-bluetooth-linux/
    • sudo apt install dkms git linux-headers-uname -r``
    • git clone https://github.com/atar-axis/xpadneo.git
    • cd xpadneo
    • sudo ./install.sh
    • reboot
  • Disable internal bluetooth when using dongle
    • sudoedit /boot/firmware/usrcfg.txt
    • add line dtoverlay=disable-bluetooth
    • reboot
    • check with hciconfig -a and hcitool dev
    • does not seem to actually work..
  • Connect to bluetooth xbox controller using terminal (on robot)
    • https://simpleit.rocks/linux/shell/connect-to-bluetooth-from-cli/
    • https://raspberrypi.stackexchange.com/questions/114586/rpi-4b-bluetooth-unavailable-on-ubuntu-20-04
    • https://www.makeuseof.com/manage-bluetooth-linux-with-bluetoothctl/
    • sudo apt install bluez pi-bluetooth joystick
    • Append "include btcfg.txt" to sudoedit /boot/firmware/usrcfg.txt
    • reboot
    • hciconfig -a or hcitool dev (from bluez) to check for bluetooth devices
    • bluetoothctl to run interactive bluetooth controller
    • scan on
    • wait for xbox controller (make it pair by holding the pair button, starts to blink rapidly)
    • trust XX:XX:XX:XX:XX:XX to trust the controller
    • connect XX:XX:XX:XX:XX:XX to connect to the controller
    • sudo chmod a+rw /dev/input/js0 to give everyone read-write permissions to joystick
    • sudo chmod a+rw /dev/input/event4 to give everyone read-write permissions to joystick (sometimes it's one of eventX)
  • If the joystick /dev/input/eventX does not have correct permissions then (this does not seem to actually work)
    • sudo apt install input-utils to install lsinput tool
    • sudo lsinput to get list of inputs, note the vendor and product of "Xbox Wireless Controller"
    • sudoedit 80-xbox-controller.rules
    • add KERNEL=="event*", ATTRS{idProduct}=="02e0", ATTRS{idVendor}=="045e", MODE="0666" etc that mathes vendor and product
  • Test joystick from terminal
    • sudo apt install joystick
    • jstest /dev/input/js0
    • ros2 run joy joy_enumerate_devices
  • Test joystick visually
    • sudo apt install jstest-gtk
    • jstest-gtk
  • Test joystick messages
    • ros2 topic echo /joy
    • ros2 topic echo /cmd_vel
    • ros2 topic echo /diff_drive_controller/cmd_vel_unstamped

Setup Gazebo simulator

  • sudo apt install ros-foxy-gazebo-ros-pkgs

Setup Raspberry PI UART

  • https://askubuntu.com/questions/1254376/enable-uart-communication-on-pi4-ubuntu-20-04
  • Create boot configuration backups
    • cd /boot/firmware
    • sudo cp usrcfg.txt usrconfig.backup.txt
    • sudo cp cmdline.txt cmdline.backup.txt
  • Disable console UART
    • add enable_uart=0 to /boot/firmware/usrcfg.txt
    • remove console=serial0,115200 from /boot/firmware/cmdline.txt
  • Disable the Serial Service which used the miniUART
    • sudo systemctl stop [email protected]
    • sudo systemctl disable [email protected]
    • sudo systemctl mask [email protected]
  • UART Pins
    • Pin 8 TXD GPIO14
    • Pin 10 RXD GPIO15

Setup ROS2 Navigation2 Nav2

  • https://navigation.ros.org/getting_started/index.html
  • Install dependencies
    • sudo apt install ros-foxy-navigation2 ros-foxy-nav2-bringup ros-foxy-cartographer ros-foxy-cartographer-ros ros-foxy-robot-localization ros-foxy-slam-toolbox ros-foxy-gazebo-ros-pkgs ros-foxy-xacro ros-foxy-slam-toolbox
    • sudo apt install ros-foxy-turtlebot3* for testing on remote pc only
  • Slam toolbox on the robot
    • Use snap slam-toolbox
    • It has optimizations in it that make it about 10x faster
  • Run mapping and navigation
    • ros2 launch slam_toolbox online_async_launch.py to launch slam toolbox mapper
    • ros2 launch nav2_bringup navigation_launch.py to run navigation2

Run navigation2_tutorials

  • Clone and build https://github.com/ros-planning/navigation2_tutorials.git
  • launch robot ros2 launch sam_bot_description display.launch.py
  • Launch usbteleop
    • Open new terminal
    • cd ~/rosbot/ros
    • . install/local_setup.bash
    • ros2 launch teleop_twist_joy teleop.launch.py cmd_vel:=/demo/cmd_vel joy_config:=rosbot_xbox_usb
    • or without the /demo in modified version
  • Launch slam_toolbox
    • Open new terminal
    • ros2 launch slam_toolbox online_async_launch.py

Setup Arduino

  • Install Arduino IDE
  • Add https://www.adafruit.com/package_adafruit_index.json to Arduino preferences additional boards URLs
  • Install board Adafruit nRF52
  • Install pip3 install --user adafruit-nrfutil
  • Update bootloader
    • https://learn.adafruit.com/introducing-the-adafruit-nrf52840-feather/update-bootloader
    • Double press reset to enter DFU mode
  • Install Micro-XRCE-DDS Agent
    • git clone https://github.com/eProsima/Micro-XRCE-DDS-Agent.git
    • cd Micro-XRCE-DDS-Agent && git checkout foxy
    • mkdir build && cd build
    • source /opt/ros/dashing/setup.bash # to share libraries with ros2
    • cmake ..
    • make
    • sudo make install
    • sudo ldconfig /usr/local/lib/

Update cmake

  • cmake --version
  • sudo apt update
  • sudo apt install -y software-properties-common lsb-release
  • wget -O - https://apt.kitware.com/keys/kitware-archive-latest.asc 2>/dev/null | gpg --dearmor - | sudo tee /etc/apt/trusted.gpg.d/kitware.gpg >/dev/null
  • sudo apt-add-repository "deb https://apt.kitware.com/ubuntu/ $(lsb_release -cs) main"
  • sudo apt update
  • sudo apt install kitware-archive-keyring
  • sudo rm /etc/apt/trusted.gpg.d/kitware.gpg
  • sudo apt update
  • sudo apt install cmake
  • cmake --version

Build micro-ros on MBED

  • https://github.com/micro-ROS/micro_ros_mbed
  • pip3 install catkin_pkg lark-parser empy colcon-common-extensions mbed-tools
  • sudo apt install gcc-arm-none-eabi
  • clone repo and cd into it
  • mbed-tools deploy
  • mbed-tools compile -m LPC1768 -t GCC_ARM -f

Install ROS

Installation guide.

  • Enable universe (probably not needed)
    • sudo apt install software-properties-common
    • sudo add-apt-repository universe
  • Add repository
    • sudo apt update && sudo apt install curl gnupg2 lsb-release
    • sudo curl -sSL https://raw.githubusercontent.com/ros/rosdistro/master/ros.key -o /usr/share/keyrings/ros-archive-keyring.gpg
  • Add repository to sources list
    • echo "deb [arch=$(dpkg --print-architecture) signed-by=/usr/share/keyrings/ros-archive-keyring.gpg] http://packages.ros.org/ros2/ubuntu $(lsb_release -cs) main" | sudo tee /etc/apt/sources.list.d/ros2.list > /dev/null
  • Install ROS
    • sudo apt update
    • sudo apt install ros-foxy-desktop
  • Install autocomplete
    • sudo apt install -y python3-argcomplete
  • Add sourcing ROS to bashrc
    • echo "source /opt/ros/foxy/setup.bash" >> ~/.bashrc
  • Add colcom_cd to bashrc
    • echo "source /usr/share/colcon_cd/function/colcon_cd.sh" >> ~/.bashrc
    • echo "export _colcon_cd_root=~/ros2_install" >> ~/.bashrc
  • Check environment variables
    • printenv | grep -i ROS
  • Set domain id (random number between 0-101 inclusive)
    • echo "export ROS_DOMAIN_ID=" >> ~/.bashrc
  • Test ROS (open in separate terminals)
    • ros2 run demo_nodes_cpp talker
    • ros2 run demo_nodes_py listener
  • Install ros bag for data recording/playback
    • sudo apt-get install ros-galactic-ros2bag ros-galactic-rosbag2-storage-default-plugins

Install tools

  • Install VSCode
    • sudo snap install --classic code

Install TurtleSim

  • Install
    • sudo apt install ros-foxy-turtlesim
  • Check the pa

Issues· 1 开放

查看全部 Issues在 GitHub 打开

暂无开放 Issues,或尚未同步最近议题。

> 标签

C++

暂无评论,来聊聊你的看法吧

> 工具信息

发布日期2026年8月1日
最后更新2026年9月18日
分类编程语言
定价开源

> 相关工具

T
TypeScript
JavaScript 的超集,为前端与全栈提供静态类型
P
Python
通用编程语言,广泛用于 Web、数据与 AI
G
Go
Google 推出的简洁高效系统语言