ROS - Robot Operating System
The Robot Operating System (ROS) is a set of software libraries and tools that help you build robot applications.
ROS簡介
ROS簡介及教學資源整理
他其實是安裝在Linux的環境上面.(Linux系統—架構淺析)
ROS比較像是在負責為機器人的各個元件進行溝通與操作的一個框架,
以機器人的行走為例,要讓機器人走路需要控制其底下的馬達、還有一些感測器以進行避障等等,
ROS內就有這種類型的函式可以讓控制馬達的程式得以與接收感測器的程式溝通,如下圖所示:
ROS-based communication architecture
ROS is a collection of tools and libraries that aids robotics software development. Software is written in form of nodes that exchange messages using a transport layer called TCPROS based on standard TCP/IP sockets.
ROS has a centralized network configuration which means that there has to exist a running ROS master. To improve on this design limitation, developers of ROS2 implemented Object Management Group’s standard DDS as the communication middleware considering it to be scalable, robust and well-proven in mission-critical systems.
An Automated Guided Vehicle (AGV) carrying a diesel truck engine and an autonomous mobile platform (MiR100) carrying kitted material to be assembled on an engine enter the Collaborative Robot Assembly Station.
Robots using ROS
TurtleBot
ROS distro
-
ROS Noetic Ninjemys on Ubuntu 20.04 (Recommended for Latest ROS 1 LTS) Install
-
ROS Foxy Fitzroy on Ubuntu 20.04, macOS (10.14), or Windows (VS2019) (Recommended for Latest ROS 2 LTS) Install
-
ROS Humble Hawksbill on Ubuntu 22.04, macOS, or Windows (VS2019) (Recommended for Latest ROS 2) Install
Noetic Ninjemys | Foxy Fitzroy | Humble Hawksbill |
ROS on DDS
The Data Distribution Service (DDS) for real-time systems is an Object Management Group (OMG) machine-to-machine (sometimes called middleware or connectivity framework) standard that aims to enable dependable, high-performance, interoperable, real-time, scalable data exchanges using a publish–subscribe pattern.
DDS addresses the needs of applications like aerospace and defense, air-traffic control, autonomous vehicles, medical devices, robotics, power generation, simulation and testing, smart grid management, transportation systems, and other applications that require real-time data exchange.
DDS has been used in:
- battleships
- large utility installations like dams
- financial systems
- space systems
- flight systems
- train switchboard systems
DDSI-RTPS
DDSI: DDS Interoperability Wire Protocol
RTPS: Real-Time Publish-Subscribe protocol
The DDS interoperability demonstration used scenarios such as:
- Basic connectivity to network using Internet Protocol (IP)
- Discovery of publishers and subscribers
- Quality of service (QoS) Compatibility between requester and offerer
- Delay-tolerant networking
- Multiple topics and instances of topics
- Exclusive ownerships of topics
- Content filtering of topic data including time and geographic
In 2004, the Object Management Group (OMG) published DDS version 1.0.
Ubuntu22.04 on Windows 11
在Windows 10 使用WSL2 安裝Linux系統
WSL 的基本命令
啟用 Windows子系統Linux 與 虛擬機器平台
- Open PowerShell as administrator (管理者權限)
- 啟用 Windows 子系統 Linux
dism.exe /online /enable-feature /featurename:Microsoft-Windows-Subsystem-Linux /all /norestart
- 啟用 虛擬機器平台
dism.exe /online /enable-feature /featurename:VirtualMachinePlatform /all /norestart
- 更新wsl
wsl --status wsl --update
- 設WSL2為預設版本
wsl --set-default--version 2 wsl -l -v
安裝Microsoft商店的 Ubuntu 22.04 LTS
export Ubuntu for backup
- Open PowerShell as adminstrator
wsl --shutdown wsl -l -v cd D:\WSL\Backup wsl --export Ubuntu-22.04 ubuntu_backup.tar
How to move existing WSL installation to D: drive
move C:\Users\username\AppData\Local\Packages\CanonicalGroupLimited.Ubuntu22.04LTS_79rhkp1fndgsc\LocalState\ext4 to D:\WSL\Working
Reset User Password if forgotten
- run Command-Prompt
ubuntu config --default-user root
- run Ubuntu
passwd user_name
- Command-Prompt
ubuntu config --default-user user_name
Xserver for Win11 display
- Download & Install MobaXterm
-
Run MobaXterm to find DISPLAY ip-address from X-server icon at upper-right corner
- set DISPLAY ip-address in ~/.bashrc
nano ~/.bashrc
# add 3 lines below
export DISPLAY=192.168.0.20:0
export LIBGL_ALWAYS_INDIRECT=
export LIBGL_ALWAYS_SOFTWARE=1
Ubuntu22.04 on RPi4
- How to install Ubuntu 22.04 LTS on Raspberry Pi 4
- Performance Tips for Ubuntu 22.04 on Raspberry Pi 4
ROS
ROS Noetic for Ubuntu20.04
(kinetic=16.04, melodic=18.04, noetic=20.04)
Ubuntu install of ROS Noetic
sudo sh -c 'echo "deb http://packages.ros.org/ros/ubuntu $(lsb_release -sc) main" > /etc/apt/sources.list.d/ros-latest.list'
sudo apt-key adv --keyserver 'hkp://keyserver.ubuntu.com:80' --recv-key C1CF6E31E6BADE8868B172B4F42ED6FBAB17C654
sudo apt-get update
export ROS1_DISTRO=noetic # kinetic=16.04, melodic=18.04, noetic=20.04
sudo apt-get install ros-$ROS1_DISTRO-desktop-full
sudo apt-get install python3-catkin-tools python3-osrf-pycommon # ubuntu 20.04
sudo apt-get install libeigen3-dev libboost-all-dev libceres-dev
Environment setup
echo "alias source_ros1=\"source /opt/ros/$ROS1_DISTRO/setup.bash\"" >> ~/.bashrc
source ~/.bashrc
source_ros1
Tutorial: Understanding Nodes
sudo apt-get install ros-noetic-turtlesim
Open 6 Terminals to run the following:
- ros master
source_ros1 roscore
- list nodes & optics
source_ros1 rosnode list
rosnode info /rosout
rostopic list
- turtlesim node
source_ros1 rosrun turtlesim turtlesim_node
- Make the turtle move by arrow-keys
source_ros1 rosrun turtlesim turtle_teleop_key
- print a publishing topic
source_ros1 rostopic echo /turtle1/cmd_vel
- Make the turtle move in a circle (Ctrl-C to stop)
source_ros1 rostopic pub -r 1 /turtle1/cmd_vel geometry_msgs/Twist -- '[2.0, 0.0, 0.0]' '[0.0, 0.0, 1.8]'
ROS Tutorials
Navigating the ROS Filesystem
sudo apt-get install ros-noetic-ros-tutorials
-
rospack find [package_name]
rospack find roscpp
-
roscd [package_name/subdir]
roscd roscpp
-
ROS_PACKAGE_PATH
echo $ROS_PACKAGE_PATH
/opt/ros/noetic/share -
rosls [package_name/subdir]
rosls roscpp_tutorials
Creating Package: Beginner_Tutorials with talker & listener
source_ros1
mkdir -p ~/catkin_ws/src
- Initialize workspace
cd ~/catkin_ws catkin init
-
If you can not initialize workspace to ~/catkin_ws, then
rm -rf ~/.catkin_tools
- Create package
cd src catkin_create_pkg beginner_tutorials std_msgs rospy roscpp --rosdistro noetic
- Create talker.cpp & listener.cpp
cd beginner_tutorials/src wget https://raw.github.com/ros/ros_tutorials/kinetic-devel/roscpp_tutorials/talker/talker.cpp wget https://raw.github.com/ros/ros_tutorials/kinetic-devel/roscpp_tutorials/listener/listener.cpp
- Modify CMakeLists.txt for talker & listener
cd .. mv CMakeLists.txt CMakeLists.txt.0 wget https://raw.github.com/ros/catkin_tutorials/master/create_package_pubsub/catkin_ws/src/beginner_tutorials/CMakeLists.txt
- Create messages & services
mkdir msg echo "int64 num" > msg/Num.msg mkdir srv roscp rospy_tutorials AddTwoInts.srv srv/AddTwoInts.srv
- Using catkin_make to compile
cd ~/catkin_ws catkin_make
- Using catkin build to compile
cd ~/catkin_ws catkin build
Exercise: Talker & Listener
- ROS master
source_ros1 roscore
- Talker
source_ros1 cd ~/catkin_ws source devel/setup.bash rosrun beginner_tutorials talker
- Listener
source_ros1 cd ~/catkin_ws source devel/setup.bash rosrun beginner_tutorials listener
Gym-Gazebo
an extension of the initial OpenAI gym for robotics using ROS and Gazebo
GazeboCircuit2TurtlebotLidar-v0 | GazeboCircuitTurtlebotLidar-v0 |
GazeboCartPole-v0 | GazeboModularArticulatedArm4DOF-v1 |
GazeboModularScara4DOF-v3 | GazeboModularScara3DOF-v3 | GazeboModularScara3DOF-v2 |
ARIACPick-v0
ROS Developement Studio (RDS)
exploring-ros-2-wheeled-robot-part-01
ROS2
install ROS2 on ubuntu20.04 LTS
install ROS2 on Ubuntu22.04 LTS
sudo apt install software-properties-common
sudo add-apt-repository universe
sudo apt update && sudo apt install curl gnupg lsb-release
sudo curl -sSL https://raw.githubusercontent.com/ros/rosdistro/master/ros.key -o /usr/share/keyrings/ros-archive-keyring.gpg
echo "deb [arch=$(dpkg --print-architecture) signed-by=/usr/share/keyrings/ros-archive-keyring.gpg] http://packages.ros.org/ros2/ubuntu $(source /etc/os-release && echo $UBUNTU_CODENAME) main" | sudo tee /etc/apt/sources.list.d/ros2.list > /dev/null
sudo apt update
sudo apt upgrade
# Desktop Install (Recommended): ROS, RViz, demos, tutorials.
sudo apt install ros-humble-desktop
echo "alias source_ros2=\"source /opt/ros/humble/setup.bash\"" >> ~/.bashrc
source ~/.bashrc
To uninstall it
sudo apt remove ~nros-humble-* && sudo apt autoremove
you may also want to remove the repository:
sudo rm /etc/apt/sources.list.d/ros2.list
sudo apt update
sudo apt autoremove
# Consider upgrading for packages previously shadowed.
sudo apt upgrade
Try examples
source /opt/ros/humble/setup.bash
- test mutlicasting
ros2 multicast receive
ros2 multicast send
- If can not receive multicast, then run ufm as follows
sudo ufw allow in proto udp to 224.0.0.0/4 sudo ufw allow in proto udp from 224.0.0.0/4
- Talker-Listener
- On one terminal
source /opt/ros/humble/setup.bash ros2 run demo_nodes_cpp talker
- In another terminal
source /opt/ros/humble/setup.bash ros2 run demo_nodes_py listener
- On one terminal
Understanding ROS2 Nodes
sudo apt-get install ros-galactic-turtlesim
(for Ubuntu20.04 LTS)
sudo apt-get install ros-humble-turtlesim
(for Ubuntu22.04 LTS)
Open 3 Terminals to run the following:
- turtlesim node
source_ros2 ros2 run turtlesim turtlesim_node
- list nodes
source_ros2 ros2 node list
/turtlesim
- turtlesim teleop-keyboard
source_ros2 ros2 run turtlesim turtle_teleop_key
- topic echo
ros2 topic echo /turtle1/cmd_vel
Other operations:
- Remapping
ros2 run turtlesim turtlesim_node --ros-args --remap __node:=my_turtle
- ROS2 Node Info
ros2 node info /turtlesim
ROS2 commands
-
Demo in C++
ros2 run demo_nodes_cpp talker
ros2 run demo_nodes_cpp listener
-
Demo in Python
ros2 run demo_nodes_py talker
ros2 run demo_nodes_py listener
- ROS2 Nodes:
ros2 node list
ros2 node info /my_turtle
- ROS2 Topics
ros2 topic list
ros2 topic echo <topic_name>
ros2 topic info /turtle1/cmd_vel
ros2 topic pub <topic_name> <msg_type> '<args>'<br>
- ROS2 Services
ros2 service list
ros2 service type <service_name>
ros2 service list -t
ros2 service find <type_name>
ros2 interface show <type_name>.srv
ros2 service call <service_name> <service_type> <arguments>
- ROS2 Parameters
ros2 param list
ros2 param get <node_name> <parameter_name>
ros2 param set <node_name> <parameter_name> <value>
ros2 param dump <node_name>
ros2 param load <node_name> <parameter_file>
ros2 run <package_name> <executable_name> --ros-args --params-file <file_name>
- ROS2 Actions
ros2 action list
ros2 action list -t
ros2 action info /turtle1/rotate_absolute
ros2 interface show turtlesim/action/RotateAbsolute
ros2 action send_goal <action_name> <action_type> <values>
This site was last updated October 07, 2024.