Trước đây mình học robotic và có cơ hội làm việc với ROS(Robot Operating System). Mình thấy ROS là một framework rất hay để các bạn làm quen với lập trình robot. Đồng thời ROS cũng cung cấp nhiều API để việc lập trình robot dễ dàng hơn.
Hiện tại công việc của mình là cloud engineer nên thay vì tiếp xúc làm việc nhiều với robot thì mình deploy các services nhiều hơn. Tuy nhiên thì sở thích là robot nên mình vẫn chạy 1 số project về Robot và xe tự lái. Đó là lý do có trang web này. Và mình thấy có thể kết hợp 2 mảng này để tạo nên 1 số dự án thú vị.
Trong bài này mình sẽ hướng dẫn các bạn cài đặt ROS2 trên docker container:
Nói sơ qua Docker là gì?
Bạn có thể coi Docker trên PC như một máy tính bên trong máy tính của bạn. Docker là một dịch vụ cung cấp các máy ảo độc lập được cài đặt sẵn những phần mền cần thiết. Những máy ảo này giúp cuộc sống của bạn dễ dàng hơn vì chúng đi kèm với các phiên bản phần mềm phù hợp cho bất kỳ ứng dụng nào bạn đang cố gắng chạy.
Lý do cài ROS nên docker container là gì, khi bạn muốn cài ros trên windows hoặc MacOS cũng được, nhưng sẽ phức tạp hơn. Do đó có thể chọn xài máy ảo(VM) chạy linux, hoặc xài docker, coi là bản mới của VM cũng được.
Ok vào bài:
Đầu tiên: Cài docker cho window trước, làm theo hướng dẫn từ Microsoft là chuẩn nhất:
Đợi 1 lúc để Gazebo được bật lên, bình thường nó đã lâu rồi, chạy giả lập trong docker container thì phải lâu hơn chút. Dưới đây là thành quả.
Thực hiện theo các bước trên các bạn có thể giả lập 1 môi trường ảo cho robot trên một máy ảo chạy trên window của bạn cùng với sự trợ giúp của Docker và Ubuntu app 2020 trên Microsoft Store. Tất cả các phần mềm trên đều miễn phí.
Làm sao tắt ROS 2 docker container:
1 là mấy bạn vào app Ubuntu cái mà đang chạy docker container và tắt nó đi, hoặc dùng lệnh sau:
According to inventor and artist Leonardo Da Vinci ‘Learning Never Exhausts the Mind’ and over the past decade here at SoftBank Robotics we have found that to be consistently true.
NAO History
In 2004 Aldebaran Robotics (Now SoftBank Robotics) launched project NAO which over time has come to revolutionize the way humans and robots interact with each other. NAO is a 58cm tall humanoid robot that is continuously evolving to help support humans in all their endeavors.
Capabilities
NAO’s abilities range from facial recognition, learning from past conversations to automated movement. NAO has already shown his more advanced capabilities through concierging at hotels, aided researchers in over 70 different institutions.
In Education
Most recently, NAO has been put to use in multiple South Australian schools; there NAO supports teachers, challenges students and is changing the way they interact. Monica Williams, a researcher from The Association of Independent Schools of South Australia noted that “What surprised the director was the depth of the students’ understanding and that once the teachers opened up to working with the students on the robot they continually saw things that surprised all of us as to what students were capable of”. Additionally, these schools found that both boys and girls were equally captivated by NAO and even began learning how to code for NAO using Python, an industry standard. Similarly, with the help of Choreographe and multiple licenses provided for schools, students can work with a virtual NAO as they take turns working with the actual NAO which encourages each student to learn at their own pace.
NAO has also been hard at work in the special education field, supporting students in developing skills like turn taking, spontaneous communication and social interaction with NAO and others.
Through the years, NAO has proven that whether you are a teacher wanting to empower your students, a hotel in need of a concierge or a student who could use a helping hand, NAO will be there for you, with capabilities that surprise and engage people.
NAO is more than just a robot, NAO can connect with real people and has the ability to become a core part of a community. Like us, NAO will keep developing and learning and if his time in Australia shows us anything, it is that NAO’s mind is far from exhausted.
Using industrial robot, industrial robot arm in production is an optimal solution to help businesses improve labor productivity and increase competitiveness. The following article, together with TPA, learn about the concept and benefits of Industrial Robots
Robot operating system is a dedicated software system for programming and controlling robots, including tools for programming, visualizing, directly interacting with hardware, and connecting robot communities around the world. In general, if you want to program and control a robot, using ROS software will make the execution much faster and less painful. And you don’t need to sit and rewrite things that others have already done, but there are things that you want to rewrite are not capable. Like Lidar or Radar driver.
ROS runs on Ubuntu, so to use ROS first you must install Linux. For those who do not know how to install Linux and ros, I have this link for you:
The robots and sensors supported by ROS:
The above are supported robots, starting from Pepper (a), REEM-C (b), Turtlebot (c), Robotnaut (d) and Universal robot (e). In addition, the sensors supported by ROS include LIDAR, SICK laser lms1xx, lms2xx, Hokuyo, Kinect-v2, Velodyne .., for more details, you can see the picture below.
Basic understanding of how ROS work:
Basically ROS files are laid out and behave like this, top down in the following order, metapackages, packages, packages manifest, Misc, messages, Services, codes:
In that package (Metapackages) is a group of packages (packages) related to each other. For example, in ROS there is a total package called Navigation, this package contains all packages related to the movement of the robot, including body movement, wheels, related algorithms such as Kalman, Particle filter. … When we install the master package, it means all the sub-packages in it are also installed.
Packages (Packages), here I translate them as packages for easy understanding, the concept of packages is very important, we can say that the package is the most basic atoms that make up ROS. In one package includes, ROSnode, datasets, configuration files, source files, all bundled in one “package”. However, although there are many things in one package, but to work, we only need to care about 2 things in one package, which is the src folder, which contains our source code, and the Cmake.txt file, here is where we declare the libraries needed to execute (compile) code.
Interaction between nodes in ROS
ROS computation graph is a big picture of the interaction of nodes and topics with each other.
In the picture above, we can see that the Master is the nodes that connect all the remaining nodes.
Nodes: ROS nodes are simply the process of using the ROS API to communicate with each other. A robot may have many nodes to perform its communication. For example, a self-driving robot will have the following nodes, node that reads data from Laser scanner, Kinect camera, localization and mapping, node sends speed command to the steering wheel system.
Master: ROS master acts as an intermediate node connecting between different nodes. Master covers information about all nodes running in the ROS environment. It will swap the details of one button with the other to establish a connection between them. After exchanging information, communication will begin between the two ROS nodes. When you run a ROS program, ros_master always must run it first. You can run ros master by -> terminal-> roscore.
Message: ROS nodes can communicate with each other by sending and receiving data in the form of ROS mesage. ROS message is a data structure used by ROS nodes to exchange data. It is like a protocol, format the information sent to the nodes, such as string, float, int …
Topic: One of the methods for communicating and exchanging messages between two nodes is called ROS Topic. ROS Topic is like a message channel, in which data is exchanged by ROS message. Each topic will have a different name depending on what information it will be in charge of providing. One Node will publish information for a Topic and another node can read from the Topic by subcrible to it. Just like you want to watch your videos, you must subcrible your channel. If you want to see which topics you are running on, the command is rostopic list, if you want to see a certain topic see what nodes are publishing or subcrible on it. Then the command is rostopic info / terntopic. If you want to see if there is anything in that topic, type rostopic echo / terntopic.
Service: Service is a different type of communication method from Topic. Topic uses a publish or subcrible interaction, but in the service, it interacts in a request – response fashion. This is exactly like the network side. One node will act as a server, there is a permanent server run and when the Node client sends a service request to the server. The server will perform the service and send the result to the client. The client node must wait until the server responds with the result. The server is especially useful when we need to execute something that takes a long time to process, so we leave it on the server, when we need it we call.
Wikipedia defines Robot as a machine capable of carrying out complex series of actions automatically. The advantages and importance of Robots are contentious, the robotics field is evolving every day and the benefits of robots are becoming inevitable. This article is not meant to discuss the advantages of robots, but to get you started with ROS(Robot Operating System).
This article describes ROS installation, file system, packages, nodes, topics, messages, service, publishers, subscribers, and ROS GUI tools. The programming language used in this article is Python. Refer to this github repo for the codes in this article.
ROS is an open-source meta operating system or a middleware used in programming Robots. It consists of packages, software, building tools for distributed computing, architecture for distributed communication between machines and applications. It also provides tools and libraries for obtaining, building, writing, and running code across multiple computers. It can be programmed using python, c++, and lisp.
ROS vs Framework vs OS(Operating System)
Operating System(OS) manages communication between computer software and hardware. In the process of managing this communication, it allocates resources like the central processing unit(CPU), memory, and storage. Examples are windows, Linux, android, mac OS, etc.
Framework in computer programming is an abstraction in which software providing generic functionality can be selectively changed by additional user-written code, thus providing application-specific software. Software frameworks may include support programs, compilers, code libraries, toolsets, and application programming interfaces(APIs) that bring together all the different components to enable the development of a project or system. Examples are Django, Laravel, Tensorflow, Flutter, etc.
Robot Operating System(ROS) is not a full-fledged operating system, it is a “meta operating system”. It is built on top of a full operating system. It is called an OS because it also provides the services you would expect from an operating system, including hardware abstraction, low-level device control, implementation of commonly-used functionality, message-passing between processes, and package management. It is a series of packages that can be installed on a full operating system like Ubuntu.
ROS level of concepts
Filesystem level — these are resources located on the disk. For example, packages, package manifests (package.xml), repositories, messages types, service types, etc.
Computation level — these involve the communications between peer to peer networks of ROS. Examples are nodes, master, parameter server, messages, topics, services, bags.
Community level — these involve the exchange of software and knowledge between members of the community. Examples are distributions, repositories, ROS wiki.
catkin is the new build system (generate executable files from source files) for ROS while rosbuild was the build system used in the past. catkin uses CMake more cleanly and only enhances CMake where it falls short on features, while rosbuild uses CMake but invokes it from Makefiles and builds each package separately and in-source. catkin was designed to be more conventional than rosbuild, allowing for better distribution of packages, better cross-compiling support, and better portability.
ROS Distributions, Installation, and File System
ROS distributions are named alphabetically. For instance, the last 3 distributions are Lunar Loggerhead, Melodic Morenia, and Noetic Ninjemys. ROS can be officially built on Linux distributions but it also supports other operating systems. This article uses ROS Melodic distribution on Ubuntu 18 Linux distribution.
You can install other distributions by changing the distribution name. For instance, you can change melodic to noetic but note noetic support Ubuntu Focal Fossa(20.04). This installation installs the full version, you can install smaller versions for instance:
This installation does not contain the GUI tools.
After proper installation, you need to source the ROS setup script. source command reads and executes commands from the file specified as its argument in the current shell environment.
To avoid sourcing the setup file every time a new terminal is opened, you can add the command to the .bashrc file. It will automatically run when you open a new terminal.
ROS packages are saved in a catkin “workspace” folder. The package folders are saved in the “src” folder in the catkin “workspace”.
The catkin_make command builds all packages located in “catkin_ws/src” folder. After running catkin_make command, two new folders “build” and “devel” will be created. Note, you should always run catkin_make command when you are in the “catkin_ws” directory. The “build” folder is where CMake and Make are invoked, while the “devel” folder contains any generated files and targets, including setup.sh files. A “CMackeLists.txt” file is also created in the src folder(I explained more about this file below).
Ros Package — contains libraries, executables, scripts, and other artifacts for a specific ROS program. Packages are used for structuring specific programs. Files in a package also have a specific structure. A ROS package folder could contain:
launch folder — it contains the launch files(launch files are used to run multiple nodes).
src folder — it contains the source files for instance python or c++ files.
package.xml — also called manifest file, contains package metadata, dependencies, and other metadata related to the package.
CMakeLists.txt -it contains executables, libraries, etc. it is catkin metapackage.
A ROS package must be in the parent “catkin_ws/src” folder, its folder, and must contain package.xml and CmakeList.txt.
Creating a ros package
This command creates a package called “bio_data_package” with dependencies std_msgs, rospy, and roscpp. This command automatically creates a folder named the package name, this package folder contains the “package.xml”, “CMakeLists.txt”, “include” folder and “src” folder. The “src” folder in the workspace folder is different from the “src” folder created in the package folder. Build all the packages in “catkin/src” by running catkin_make, source the “setup.bash” in the “devel” folder to add new environment variables.
ROS Package command-line tool — rospack
rospack is used to get information about packages. Note: Tab completion, press the tab key once to complete a command, and twice to show you suggestions. For instance, you press tab twice after rospack.
rospack list — list all the ROS packages in your workspace rospack find bio_data_package — to output the path of package “bio_data_package”
The package.xml contains tags that describe the package. The required tags are name, version, description, maintainer and license.
<name> – the name of the package.
<version> – the version of the package, usually it should be three integers separated by dots.
<description> – a description of the package.
<maintainer> – information about the maintainer i.e someone you can contact if you need more information about the package.
<license> – the license to the package.
<buildtool_depend>(build tool dependency) – the build system required to build the package, this is usually catkin or rosbuild.
<build_depend>(build dependency) – the dependencies of the package, each dependency is enclosed in a build_depend tag.
<build_export_depend>(build export dependency) – a dependency that is included in the headers in public headers in the package.
<exec_depend>(Execution Dependency) – a dependency that is among the shared libraries.
<test_depend>(Test Dependency) – a dependency required for unit test.
<doc depend>(Documentation Tool Dependency) – a dependency required to generate documentation.
A ROS node is an executable that uses ROS to communicate with other nodes. The concept of ros node helps in fault tolerance as each node does not depend on another node.
ROS Master — provides naming and registration services to the rest of the nodes in the ROS system. Publishers and Subscribers register to the master, then ROS Master tracks ROS topics being published by the publisher and ROS Topics being subscribed to by the subscribers. It also provides the Parameter Server.
rosout — rosout is the name of the console log reporting mechanism in ROS. rosout subscribes to /rosout topic.
Parameter Server — is a shared, multi-variate dictionary that is accessible via network APIs. Nodes use this server to store and retrieve parameters at runtime.
roscore — master + rosout + parameter server. It controls the entire ROS system. It must be running to enable ROS nodes to communicate. It is a collection of nodes and programs that are pre-requisites of a ROS-based system.
Once roscore is running, you can open a new terminal to run other ros nodes.
ROS node command-line tool — rosnode
ROS Run
rosrun — this is used to run a node in a package
turtlesim_node display a GUI with a turtle.
Run the command on a different terminal
The turtle_teleop_key node provides a way to control the turtle with a keyboard. Click on the terminal where you ran rosrun turtlesim turtle_teleop_key, then press the arrow keys, the turtle moves in the direction of the arrow key pressed.
Ros Topics are the buses used by ROS nodes to exchange messages. Imagine a ROS Topic as a water pipe and ROS Message as the water, the two ends of the pipe are where the nodes are located. Topic transport message between a publisher node and a subscriber node. Ros Topics have anonymous publish/subscribe semantics. Nodes that generate message/ data publish to a specific topic, and nodes that consume or need data subscribed to a specific topic. The relationship between publishers and subscribers is many to many.
In the example above, the turtle_teleop_key node publishes the key pressed to the /turtle/cmd_vel topic and the turtlesim node subscribes to that same topic.
ROS topic command-line tool — rostopic
rostopic hz [topic] (shows how fast the messages are publishing) rostopic hz /turtle/cmd_vel
Nodes communicate by sending ROS messages to each other using ROS Topic. A message can be of primitive type integer, floating-point, boolean, etc. A publisher and subscriber should communicate using the same topic type. The topic type is determined by the message type.
Creating a ROS message
Create a msg folder in your package folder. We created a new package call bio_data_package in the example above. Inside this newly created “msg” folder, create a msg file called name.msg
Step 1
Copy the following command into the “name.msg” file. You can also check on github
Now you should have something like this, please don’t modify other lines.
Step 3
Open the CmakeList.txt file for the bio_data_package package in a text editor. This is needed for steps 3 to 6. Check a sample file on github
Modify the find_package call by adding message generation to its components. Now you should have something similar to this.
Step 4
Modify the catkin_package by adding message_runtine
Step 5
Modify add_message_files by adding the name.msg, this enable CMake to reconfigure the project with the new msg file.
Step 6
Modify generate_message by removing the # symbols to uncomment it.
Step 7
ROS message command-line tool — rosmsg
Show the description of the new message created
ROS service is one to one two way transport, it is suitable for request/reply interactions. A ROS node(server) offers a service, while another ROS node(client) requests for the service. The server sends a response back to the client. Services are defined using srv files. srv files are just like msg files, except they contain two parts: a request and a response. Services also have types like topics.
Creating a ROS Service
Create a srv folder in your package folder. You created a new package call bio_data_package in the example above. Inside this newly created “srv” folder, create a srv file called full_name.srv. A srv file is used to describe a service, srv files are stored in the “srv” folder.
Copy the following command into the “full_name.srv” file. A sample is on github
A srv file has two parts separated by -, the first part is the request while the second part is the response.
Do the steps required in creating a ROS message, but instead of Step 5, do thhe following. Please don’t repeat all the steps if you have done them before.
Step 5(specific for ROS service)
Modify add_service_files by adding the “full_name.srv”, this enables CMake to reconfigure the project with the new srv file.
ROS service command-line tool — rossrv
Show the description of the new service created
ROS Services vs ROS Topic
Involves the communication between any two nodes
Involves the communication between Publishers and Subscribers
It is a two way transport
It is a one way transport
It is one to one
It is many to many
Involves a request/ reply pattern
Does not involves a Request/reply pattern
ROS Publisher and Subscriber
Publisher and subscriber is many to many but one way transport. A node sends out a message by publishing it to a given topic. The topic is a name that is used to identify the content of the message. A node that is interested in a certain kind of data will subscribe to the appropriate topic.
Creating a Publisher
A publisher is a node that publishes messages into a topic. Create a scripts folder in your package folder, we created a new package call bio_data_package in the example above, inside this newly created “script” created folder, create a python file called writer_pub.py
Copy the following code into the “writer_pub.py” file. Sample is on github
Creating a Subscriber
A subscriber is a node that gets messages from a topic. Create a python file called reader_sub.py in the “scripts” folder.
Copy the following code into the “reader_sub.py” file. A sample is on github
Modify the caktin_install_python() call in CMameLists.txt
roswtf is a tool for diagnosing issues with a running ROS file system. It evaluates ROS setup like environment variables, packages , stacks, launch files and configuration issues.
rqt_console is a tool that displays messages being published to rosout. These messages have different level of severity like debug, info, warn, error, fatal.
Terminal 2rosrun turtlesim turtlesim_node
Terminal 3rosrun turtlesim turtle
Now move the turtle to the wall
rqt _graph
This shows nodes and the topics the nodes are communicating on.
rqt _plot
Display the scrolling time plot of data published on a topic
rqt
rqt contain most ROS GUI tools, you can select the on you want in the Plugib tab.
Other ROS concepts
ROS Launch — is used for starting and stopping multiple ros nodes. It is used to execute a ros program which is a .launch file.
ROS Stack — this contain several packages.
rosbag — published topics are saved as .bag file, rosbag command line tool is used to work with bag files.
The Neural network structure is: one, input layer, one output layer, and layers between are hidden layer.
Introduction
An Artificial Neural Network (ANN) is an interconnected group of nodes, similar to the our brain network.
Here, we have three layers, and each circular node represents a neuron and a line represents a connection from the output of one neuron to the input of another.
The first layer has input neurons which send data via synapses to the second layer of neurons, and then via more synapses to the third layer of output neurons.
Suppose we want to predict our test score based on how many hours we sleep and how many hours we study the night before.
In other words, we want to predict output value yy which are scores for a given set of input values XX which are hours of (sleep, study).
XX (sleep, study)
y (test score)
(3,5)
75
(5,1)
82
(10,2)
93
(8,3)
?
In our machine learning approach, we’ll use the python to store our data in 2-dimensional numpy arrays.
We’ll use the data to train a model to predict how we will do on our next test.
This is a supervised regression problem.
It’s supervised because our examples have outputs(yy).
It’s a regression because we’re predicting the test score, which is a continuous output.
If we we’re predicting the grade (A,B, etc.), however, this is going to be a classification problem but not a regression problem.
We may want to scale our data so that the result should be in [0,1].
Now we can start building our Neural Network.
We know our network must have 2 inputs(XX) and 1 output(yy).
We’ll call our output y^y^, because it’s an estimate of yy.
Any layer between our input and output layer is called a hidden layer. Here, we’re going to use just one hidden layer with 3 neurons.
Neurons synapses
As explained in the earlier section, circles represent neurons and lines represent synapses.
Synapses have a really simple job.
They take a value from their input, multiply it by a specific weight, and output the result. In other words, the synapses store parameters called “weights” which are used to manipulate the data.
Neurons are a little more complicated.
Neurons’ job is to add together the outputs of all their synapses, and then apply an activation function.
Certain activation functions allow neural nets to model complex non-linear patterns.
For our neural network, we’re going to use sigmoid activation functions.
Lidar là một công nghệ khảo sát tiên tiến để đo khoảng cách tới mục tiêu bằng cách chiếu mục tiêu đó bằng một tia laze và đo các xung phản xạ bằng một cảm biến. Sự khác nhau về thời gian và bước sóng laser sau đó có thể được sử dụng để tạo các mô hình kỹ thuật số thể hiện mục tiêu trong không gian 3D. LiDAR thường được kết hợp với các loại máy ảnh để thu thập đồng thời hình ảnh của đối tượng và xây dựng lên hình ảnh 3D “như thật” của đối tượng. Lidar được sử dụng rộng rãi để tạo ra các sản phẩm đồ hoạ có độ phân giải cao, với nhiều ứng dụng cao cấp trong các ngành trắc địa, geomatics, khảo cổ, địa lý, địa chất, địa mạo, địa chấn, lâm nghiệp, vật lý, bản đồ… Công nghệ này cũng được sử dụng để kiểm soát và điều hướng cho một số phươpng tiện giao thông tự hành. Lidar đôi khi được gọi là quét laser và quét 3D, và gồm 3 loại: lidar mặt đất, hàng không và di động.
Lidar bao gồm có:
Lidar hàng không
Ưu điểm
Độ chính xác cao
LiDAR có thể thu thập dữ liệu địa hình rất chính xác trong khi bay quét ở độ cao lớn hơn độ cao bay chụp không ảnh. Độ chính xác của dữ liệu bay chụp không ảnh tỷ lệ với độ cao bay chụp trong khi độ chính xác của dữ liệu LiDAR giảm đi không đáng kể khi độ cao bay tăng lên. Hơn nữa, LiDAR thu nhận trực tiếp dữ liệu 3 chiều
Hiệu suất thu thập lớn
LiDAR chỉ cần duy nhất 1 tia laser “gần-vuông góc” với mặt đất để khảo sát địa hình. Tia laser có khả năng xuyên qua tán cây chạm tới bề mặt và phản hồi tới cảm biến trong khi chụp không ảnh lại yêu cầu hiệu ứng lập thể (cùng nhìn thấy 1 điểm trên mặt đất từ hai phía). Như vậy, LiDAR sẽ thu thập được dữ liệu bề mặt địa hình nhiều hơn, đặc biệt khi quét qua các khu vực có thực vật che phủ
Mật độ điểm dầy
LiDAR có thể thu nhận tín hiệu phản hồi đầu tiên và cuối cùng với tần suất trung bình 5.000 tới 33.000 tia/giây, do đó dữ liệu thu được cho phép lập bản đồ bề mặt địa hình và bề mặt tán cây với mật độ dữ liệu dày và độ chính xác cao. Một số hệ thống LiDAR còn cho phép thu nhận các tín hiệu phản hồi trung gian (giữa tín hiệu đầu và cuối) cho phép phân tích cấu trúc đối tượng (cấu trúc tán). Phương pháp không ảnh cũng tạo được các điểm độ cao dày nhưng phải bằng cách tăng dày thủ công (tốn kém và mất thời gian), hoặc bằng phương pháp tương quan ảnh tự động, tuy nhiên phương pháp này chỉ trích xuất được các điểm ngọn cây và nóc nhà mà không tạo ra được các điểm mặt đất
Thời gian thu thập linh hoạt
LiDAR cho phép thu thập dữ liệu cả ngày và đêm trong khi phương pháp không ảnh chỉ thực hiện được trong 1 khoảng thời gian hạn chế ban ngày khi ánh sáng tối ưu
Lidar mặt đất:
Các ứng dụng LiDAR mặt đất sử dụng thiết bị quét laser gắn trên các vị trí trên mặt đất, thường là các giá tripod. Công nghệ quét laser mặt đất trên giá cố định là hình thức khảo sát rất phổ biến trong các ứng dụng quy mô nhỏ như vi địa hình, các công trình, công trường… Dữ liệu đám mây điểm 3D thu được từ các loại máy quét này có thể được kết hợp với hình ảnh kỹ thuật số chụp từ cùng vị trí của máy quét để tạo mô hình 3D thực tế trong một khoảng thời gian tương đối ngắn so với các công nghệ khác. Cách thể hiện sản phẩm 3D dạng này có thể là ảnh số trùm phủ lên đám mây điểm hoặc từng điểm laser được gán mã màu theo giá trị điểm ảnh tương ứng trên sản phẩm ảnh số.
Ưu điểm
Mật độ điểm “siêu” dày
Độ chính xác rất cao
Năng suất thu thập dữ liệu cao
Gọn nhẹ, dễ triển khai
Lidar mobile:
Công nghệ mobile LiDAR là công nghệ gắn các máy quét laser lên các phương tiện đi lại như ô tô, tàu hoả… và chạy dọc các tuyến giao thông để thu thập dữ liệu với tốc độ cao, mật độ dày. Mỗi phương tiện giao thông có thể được gắn 1 hoặc nhiều bộ quét. Những máy quét này hầu như luôn luôn kết hợp với các loại thiết bị khác, chủ yếu là máy ảnh số và các hệ thống dẫn đường chuyên dụng. Ứng dụng phổ biến của công nghệ này là khảo sát các thực thể dạng tuyến như đường phố, đường dây điện, đường sắt, đường thuỷ… Ưu điểm nổi bật của giải pháp là thay vì thu thập các đối tượng một cách riêng lẻ, một mô hình 3D với đám mây điểm thể hiện tất cả các đối tượng trên tuyến sẽ được thành lập, sau đó được sử dụng để thu nhận tất cả các đối tượng cần thiết. Điều này giúp loại bỏ vấn đề thường xả ra với phương pháp truyền thống như đo đạc sót đối tượng, đồng thời tăng độ tin cậy và độ chính xác.
Ưu điểm
Khảo sát toàn diện, năng suất cao, độ chính xác cao
Giảm thiểu công khảo sát thực địa
Mật độ điểm rất cao và có nhiều sản phẩm đồng bộ ( ảnh số và đám may điểm )
Có thể chia sẻ rộng rãi cho các bộ phận nội nghiệp cùng sản xuất
Giải thích nguyên lí hoạt động của Lidar:
Nguyên tắc đằng sau LiDAR thực sự khá đơn giản. Chiếu một ánh sáng nhỏ lên một bề mặt và đo thời gian nó quay trở lại nguồn của nó. Khi bạn chiếu một ngọn đuốc lên một bề mặt mà bạn đang thực sự nhìn thấy thì ánh sáng sẽ được phản xạ và quay trở lại võng mạc của bạn. ánh sáng truyền đi rất nhanh – khoảng 300.000 km mỗi giây, 186.000 dặm mỗi giây hoặc 0,3 mét mỗi nanosecond để biến một ánh sáng trên dường như là tức thời. Tất nhiên, nó không phải! Các thiết bị cần thiết để đo lường nhu cầu này hoạt động cực kỳ nhanh. Chỉ với những tiến bộ trong công nghệ máy tính hiện đại, điều này mới trở nên khả thi.
Tính toán thực tế để đo khoảng cách mà một photon ánh sáng trở lại đã đi đến và đi từ một vật thể khá đơn giản:
Khoảng cách = (Tốc độ ánh sáng x Thời gian bay) / 2
Thiết bị LiDAR bắn ra các xung ánh sáng laze nhanh trên bề mặt, một số có tốc độ lên đến 150.000 xung mỗi giây. Một cảm biến trên thiết bị đo khoảng thời gian cần thiết để mỗi xung phản hồi trở lại. Ánh sáng di chuyển với tốc độ không đổi và đã biết để thiết bị LiDAR có thể tính toán khoảng cách giữa chính nó và mục tiêu với độ chính xác cao. Bằng cách lặp lại điều này liên tiếp, hệ thống xây dựng một ‘bản đồ’ phức tạp về bề mặt mà nó đang đo. Với LiDAR trên không, các dữ liệu khác phải được thu thập để đảm bảo độ chính xác. Khi cảm biến đang di chuyển độ cao, vị trí và hướng của thiết bị phải được bao gồm để xác định vị trí của xung laser tại thời điểm gửi đi và thời điểm quay trở lại. Thông tin bổ sung này rất quan trọng đối với tính toàn vẹn của dữ liệu. Với LiDAR trên mặt đất, một vị trí GPS duy nhất có thể được thêm vào cho mỗi vị trí nơi thiết bị được thiết lập.
Hầu hết các hệ thống LiDAR sử dụng bốn thành phần chính:
Laser
Tia laser được phân loại theo bước sóng của chúng. Laser 600-1000nm được sử dụng phổ biến hơn cho các mục đích phi khoa học, nhưng vì chúng có thể được tập trung và dễ dàng hấp thụ bởi mắt, công suất tối đa phải được giới hạn để làm cho chúng ‘an toàn cho mắt’. Laser có bước sóng 1550nm là một lựa chọn thay thế phổ biến vì chúng không bị tập trung bởi mắt và ‘an toàn cho mắt’ ở mức công suất cao hơn nhiều. Các bước sóng này được sử dụng cho mục đích phạm vi xa hơn và độ chính xác thấp hơn. Một ưu điểm khác của bước sóng 1550nm là chúng không hiển thị dưới kính nhìn ban đêm và do đó rất thích hợp cho các ứng dụng quân sự.
Hệ thống LiDAR trong không khí sử dụng laser YAG bơm điốt 1064nm trong khi hệ thống Bathymetric sử dụng laser YAG bơm điốt kép 532nm, xuyên qua nước với độ suy giảm ít hơn nhiều so với phiên bản 1064nm trong không khí. Có thể đạt được độ phân giải tốt hơn với các xung ngắn hơn với điều kiện bộ phát hiện máy thu và thiết bị điện tử có đủ băng thông để đối phó với lưu lượng dữ liệu tăng lên.
Máy quét và Quang học
Tốc độ hình ảnh có thể được phát triển bị ảnh hưởng bởi tốc độ mà nó có thể được quét vào hệ thống. Một loạt các phương pháp quét có sẵn cho các mục đích khác nhau như góc phương vị và độ cao, gương phẳng dao động kép, máy quét trục kép và gương đa giác. Loại quang học của chúng xác định độ phân giải và phạm vi có thể được phát hiện bởi một hệ thống.
Bộ tách sóng quang và thiết bị điện tử thu
Bộ tách sóng quang là thiết bị đọc và ghi lại tín hiệu đưa về hệ thống. Có hai loại công nghệ máy tách sóng quang chính, máy dò trạng thái rắn, chẳng hạn như điốt quang tuyết lở silic và bộ nhân quang.
Hệ thống định vị và dẫn đường
Khi một cảm biến LiDAR được gắn trên một nền tảng di động như vệ tinh, máy bay hoặc ô tô, cần phải xác định vị trí tuyệt đối và hướng của cảm biến để giữ lại dữ liệu có thể sử dụng được. Hệ thống Định vị Toàn cầu cung cấp thông tin địa lý chính xác về vị trí của cảm biến và Đơn vị đo lường quán tính (IMU) ghi lại hướng chính xác của cảm biến tại vị trí đó. Hai thiết bị này cung cấp phương pháp chuyển dữ liệu cảm biến thành các điểm tĩnh để sử dụng trong nhiều hệ thống khác nhau.
Cảm ơn các bạn đã quan tâm, nếu có câu hỏi gì xin để lại trong phần bình luận.
Vì thấy các bạn từ Việt Nam có sự quan tâm đến phần này nên hôm nay mình sẽ update nội dung tiếp về Robot operating system nhé, cảm ơn đã ủng hộ mình.
Robot operating system is a dedicated software system for programming and controlling robots, including tools for programming, visualizing, directly interacting with hardware, and connecting robot communities around the world. In general, if you want to program and control a robot, using ROS software will make the execution much faster and less painful. And you don’t need to sit and rewrite things that others have already done, but there are things that you want to rewrite are not capable. Like Lidar or Radar driver.
ROS runs on Ubuntu, so to use ROS first you must install Linux. For who do not know how to install Linux and ros, I have this link for you:
Robot operating system là một hệ thống phần mềm chuyên dụng để lập trình và điều khiển robot, bao gồm các công cụ để lập trình, hiển thị, tương tác trực tiếp với phần cứng, và kết nối cộng đồng robot trên toàn thế giới. Nói chung là nếu bạn muốn lập trình và điều khiển một con robot, sử dụng phần mềm ROS sẽ giúp quá trình thực hiện nhanh hơn và bớt đau khổ hơn rất nhiều. Và bạn không cần ngồi viết lại những thứ mà người khác đã làm rồi, mà có những thứ muốn viết lại cũng không có khả năng. Như Lidar hoặc Radar driver chẳng hạn.
ROS chạy trên nền Ubuntu, do đó để sử dụng ROS đầu tiền các bạn phải cài Linux. Cho bạn nào chưa biết cài Linux và ros thì mình có link này cho các bạn:
Dưới đây mình sẽ trình bày về luận văn thạc sĩ của mình, phần dưới là 1 phần trích đoạn phần đầu của luận văn. Nếu bạn nào cần full không che thì pm mình bên dưới phần comment nhé:))
1.1 Đề xuất dự án – Robot tự hành di động
Hệ thống robot được sử dụng trong dự án này đã được phát triển trong quá trình nhiều trước các dự án tổng thể và chuyên môn hóa. Mục tiêu dài hạn của các dự án này là phát triển Các khái niệm robot tự động di động để hỗ trợ mọi người trong môi trường trong nhà, như đổ nước và phục vụ cho con người. Đề tài của luận văn này dựa trên đề tài do GS.TS. Nauth tại Bộ phận Công nghệ Thông tin, nơi gợi ý một số ứng dụng khả thi cho một robot như vậy:
• Robot có thể điều hướng tự động trong môi trường trong nhà, như phòng hoặc hành lang.
• Robot phải tránh chướng ngại vật khi di chuyển từ vị trí A đến B, chướng ngại vật ở đây bao gồm các chướng ngại vật tĩnh và động.
• Robot phải phân loại đối tượng, chẳng hạn như nhận dạng cốc và chai, sau khi robot đó có thể rót nước từ chai này sang cốc khác. Mục đích sử dụng trong bệnh viện và trạm xá.
• Cho phép nhân viên thực hiện kiểm tra và bảo trì từ xa thông qua điều khiển từ xa.
1.2 Tổng quan về triển khai
Quyết định Mục tiêu
Để làm cho robot tự động điều hướng trong môi trường, điều hướng dựa trên tầm nhìn là được chứng minh là một thuật toán nổi bật để lựa chọn. Robot có khả năng xây dựng bản đồ môi trường xung quanh và di dời một cách tự chủ được coi là một điểm khởi đầu tốt để tiếp tục phát triển các giải pháp dựa trên tầm nhìn.
Chọn công cụ và phần cứng
Là phần tiếp theo của dự án Volksbot, robot được trang bị máy quét Laser 2D, Cảm biến SICK LMS100 cho phạm vi đo lên đến 20 m. Để tạo bản đồ 3-D, robot đã được trang bị camera 3D, Kinect cho XBOX 360 có khả năng nhận biết hình ảnh có độ sâu ở mức cao tốc độ khung hình (30Hz). Để sử dụng Kinect, trình điều khiển Kinect cần cài đặt trong ROS, trình điều khiển có thể sử dụng có thể là Freenect hoặc openNI, tuy nhiên cái sau đã lỗi thời ngày nay nên ổ Freenect đã được chọn. Các công việc và giải pháp được trình bày trong luận văn này xoay quanh quá trình tích hợp ROS với robot di động. Cài đặt ROS trên Ubuntu Linux cho đến nay là cách dễ dàng nhất để bắt đầu bằng cách sử dụng khuôn khổ. Vì lý do này, và để tránh can thiệp vào dự án khác trên cùng một robot, người ta quyết định rằng một máy tính bổ sung chạy Linux nên được trang bị cho robot. Cấu hình nền tảng robot mới được thể hiện trong hình 1.1. Hai công cụ hỗ trợ đã được triển khai cùng với phần mềm robot: một khái niệm đơn giản về trạm điều khiển với máy tính từ xa và điều khiển từ xa cầm tay trên điện thoại thông minh hoặc máy tính bảng. Tổng quan về hệ thống hoàn chỉnh được thể hiện trong hình.
1.2. Mục tiêu của luận văn
Mục tiêu của luận án này là thực hiện một nghiên cứu về SLAM và cố gắng tạo ra một bản đồ Khuôn viên Đại học đồng thời xác định vị trí của robot trong bản đồ. Đầu tiên, Một máy ảnh Kinect và máy quét laser 2D SICK sẽ được sử dụng để vẽ bản đồ của ba phòng và hành lang trong tòa nhà 8, Đại học Khoa học Ứng dụng Frankfurt. Toàn bộ hệ thống sẽ được đưa vào rô bốt có bánh xe, bộ mã hóa bánh xe sẽ được sử dụng để cung cấp tính năng đo đường của rô bốt. Đây là một cụ thể ứng dụng dựa trên ROS (Hệ điều hành Robot) để trình diễn chế độ hoạt động của ROS. Lý do chọn bản đồ RTAB để thử nghiệm trên robot bao gồm: Thứ nhất, đây là một cách tiếp cận khá mới trong SLAM, phương pháp này cung cấp bản đồ 3D thay vì bản đồ 2D như các phương pháp khác, vì vậy rất nhiều cơ hội nghiên cứu vẫn còn. Thứ hai, thuật toán RTAB nhằm mục đích tìm ra các đường dẫn tối ưu giữa một số mẫu, vì vậy nó cho phép lưu bộ nhớ dài hạn khi robot thực hiện đa ánh xạ.
Chức năng
1.3. CẤU TRÚC LUẬN VĂN
• 1. Bản địa hóa và ánh xạ đồng thời dựa trên thị giác máy tính.
• 2. Lập bản đồ qua nhiều phiên.
• 3. Điều hướng tự động đến một mục tiêu đơn giản.
• 4. Tránh chướng ngại vật 3D và 2D trong chế độ điều hướng.
• 5. Có thể điều khiển robot từ bàn phím trên bo mạch.
• 6. Robot có thể được điều khiển bằng Điều khiển từ xa.
• 8. Robot có thể nhận lệnh vận tốc qua WiFi.
Above is my project with RTAB, HECTOR-SLAM and ROS to program to Volksbot and NAO humanoid robot, all code of the robot in the video above was full describe in the github link:
Feel free to use these code for your project. And I wish you very success!
Trên đây là dự án của tôi với RTAB, HECTOR-SLAM và ROS để lập trình cho Volksbot và rô bốt hình người NAO, tất cả mã của rô bốt trong video trên đều được mô tả đầy đủ trong liên kết github.
Có thể tải sử dụng code này cho dự án của bạn. Chúc bạn rất thành công!
Bạn nào nếu muốn tham khảo luận văn thì mình có chia sẻ dưới dạng file pdf đính kèm cùng code của mình ở link github phía dưới nha:D
One of the more difficult challenges in robotics is the so-called “kidnapped robot problem.” Imagine you are blindfolded and taken by car to the home of one of your friends but you don’t know which one. When the blindfold is removed, your challenge is to recognize where you are. Chances are you’ll be able to determine your location, although you might have to look around a bit to get your bearings. How is it that you are able to recognize a familiar place so easily?
It’s not hard to imagine that your brain uses visual cues to recognize your surroundings. For example, you might recognize a particular painting on the wall, the sofa in front of the TV, or simply the color of the walls. What’s more, assuming you have some familiarity with the location, a few glances would generally be enough to conjure up a “mental map” of the entire house. You would then know how to get from one room to another or where the bathrooms are located.
Over the past few years, Mathieu Labbé from the University of Sherbrooke in Québec has created a remarkable set of algorithms for automated place learning and SLAM (Simultaneous Localization and Mapping) that depend on visual cues similar to what might be used by humans and other animals. He also employs a memory management scheme inspired by concepts from the field of Psychology called short term and long term memory. His project is called RTAB-Map for “Real Time Appearance Based Mapping” and the results are very impressive.
Real Time Appearance Based Mapping (RTAB-Map)
The picture on the left is the color image seen through the camera. In this case, Pi is using an Asus Xtion Pro depth camera set at a fairly low resolution of 320×240 pixels. On the right is the same image where the key visual features are highlighted with overlapping yellow discs. The visual features used by RTAB-Map can be computed using a number of popular techniques from computer vision including SIFT, SURF, BRIEF, FAST, BRISK, ORB or FREAK. Most of these algorithms look for large changes in intensity in different directions around a point in the image. Notice therefore that there are no yellow discs centered on the homogeneous parts of the image such as the walls, ceiling or floor. Instead, the discs overlap areas where there are abrupt changes in intensity such as the corners of the picture on the far wall. Corner-like features tend to be stable properties of a given location and can be easily detected even under different lighting conditions or when the robot’s view is from a different angle or distance from an object.
RTAB-Map records these collections of visual features in memory as the robot roams about the area. At the same time, a machine learning technique known as the “bag of words model” looks for patterns in the features that can then be used to classify the various images as belonging to one location or another. For example, there may be a hundred different video frames like the one shown above but from slightly different viewpoints that all contain visual features similar enough to assign to the same location. The following image shows two such frames side by side:
Here we see two different views from essentially the same location. The pink discs indicate visual features that both images have in common and, as we would expect from these two views, there are quite a few shared features. Based on the number of shared features and their geometric relations to one another, we can determine if the two views should be assigned to the same location or not. In this way, only a subset of the visual features needs to be stored in long term memory while still being able to recognize a location from many different viewpoints. As a result, RTAB-Map can map out large areas such as an entire building or an outdoor campus without requiring an excessive amount of memory storage or processing power to create or use the map.
Note that even though RTAB-Map uses visual features to recognize a location, it is not storing representations of human-defined categories such as “painting”, “TV”, “sofa”, etc. The features we are discussing here are more like the receptive field responses found in lower levels of the visual cortex in the brain. Nonetheless, when enough of these features have been recorded from a particular view in the past, they can be matched with similar features in a slightly different view as shown above.
RTAB-Map can stitch together a 3-dimensional representation of the robot’s surroundings using these collections of visual features and their geometric relations. The Youtube video below shows the resulting “mental map” of a few rooms in a house:
The next video demonstrates a live RTAB-Map session where Pi Robot has to localize himself after been set down in a random location. Prior to making the video, Pi Robot was driven around a few rooms in a house while RTAB-Map created a 3D map based on the visual features detected. Pi was then turned off (sorry dude!), moved to a random location within one of the rooms, then turned on again. Initially, Pi does not know where he is. So he drives around for a short distance gathering visual cues until, suddenly, the whole layout comes back to him and the full floor plan lights up. At that point we can set navigation goals for Pi and he autonomously makes his way from one goal to another while avoiding obstacles.
RoboCup is an annual international robotic competition proposed in 1997 and founded in 1997. The aim is to promote robotics and AI research, by offering a publicly appealing, but formidable challenge. The name RoboCup is a contraction of the competition’s full name, “Robot Soccer World Cup”, but there are many other stages of the competition such as “RoboCupRescue”, “RoboCup@Home” and “RoboCupJunior”. In 2015 the world’s competition was held in Heifei, China. RoboCup 2016 will be held in Leipzig, Germany. The official goal of the project:
“By the middle of the 21st century, a team of fully autonomous humanoid robot soccer players shall win a soccer game, complying with the official rules of FIFA, against the winner of the most recent World Cup”.
As a Master student of Frankfurt University, I aslo have a project with the Robot who is the best choice for for the Robot Cup as the moment, his name is NAO.
Nao (pronounced now) is an autonomous, programmable humanoid robot developed by Aldebaran Robotics, a French robotics company headquartered in Paris. The robot’s development began with the launch of Project Nao in 2004. On 15 August 2007, Nao replaced Sony’s robot dog Aibo as the robot used in the Robot Cup Standard Platform League, an international robot soccer competition. The Nao was used in RoboCup 2008 and 2009, and the NaoV3R was chosen as the platform for the SPL at RoboCup 2010. Nao robots have been used for research and education purposes in numerous academic institutions worldwide. As of 2015, over 5,000 Nao units are in use in more than 50 countries.