1. Trang chủ
  2. » Luận Văn - Báo Cáo

design an automatic mapping vehicle using rplidar

71 0 0
Tài liệu đã được kiểm tra trùng lặp

Đang tải... (xem toàn văn)

Tài liệu hạn chế xem trước, để xem đầy đủ mời bạn chọn Tải xuống

THÔNG TIN TÀI LIỆU

Thông tin cơ bản

Tiêu đề Design An Automatic Mapping Vehicle Using RPLidar
Tác giả Tran Quang Thien, Tran Phi Vu
Người hướng dẫn Truong Ngoc Son, Ph.D
Trường học Ho Chi Minh City University of Technology and Education
Chuyên ngành Electronics and Communications Engineering
Thể loại Graduation Project
Năm xuất bản 2023
Thành phố Ho Chi Minh City
Định dạng
Số trang 71
Dung lượng 5 MB

Cấu trúc

  • CHAPTER 1. OVERVIEW (13)
    • 1.1 Introduction (13)
    • 1.2 Robot’s objective (14)
    • 1.3 Research method (14)
    • 1.4 Thesis’s content (15)
  • CHAPTER 2. THEORETICAL BASIS (16)
    • 2.1 Holonomic robot (16)
      • 2.1.1 Introduction (16)
      • 2.1.2 Compare omni wheel robot with normal wheel robot (17)
      • 2.1.3 Compare omni 3 wheel with 4 wheels (19)
      • 2.1.4 Dynamic Kinematic of the mobile robot (21)
        • 2.1.4.1 Forward kinematic (21)
        • 2.1.4.2 Inverse kinematic (22)
    • 2.2 ROS – Robot Operating System (23)
      • 2.2.1 Introduce to ROS [3] (23)
      • 2.2.2 ROS structure (24)
        • 2.2.2.1 ROS filesystem (24)
        • 2.2.2.2 ROS Computation Graph Level (25)
    • 2.3 SLAM (26)
      • 2.3.1 Introduce to SLAM (Simultaneous localization and mapping) (26)
      • 2.3.2 Hector SLAM (26)
        • 2.3.3.1 Costmap 2D (28)
        • 2.3.3.2 Costmap configuration process (28)
    • 2.4 Algorithm for global planner and local planner (29)
      • 2.4.1 A* algorithm for global planner (29)
      • 2.4.2 Dynamic Window Approach algorithm to avoid object for local planner (33)
        • 2.4.2.1 The search spaces (33)
        • 2.4.2.2 Optimize (34)
    • 2.5 Protocol (35)
      • 2.5.1 ROS communication (35)
    • 2.7 Low-pass Filter (39)
      • 2.7.1 Calculation (39)
  • CHAPTER 3. DESIGN OF ROBOT (41)
    • 3.1 Overview robot hardware (41)
      • 3.1.1 General diagram of the system (41)
      • 3.1.2 Wiring diagram (41)
    • 3.2 Devices used in the project (44)
      • 3.2.1 Calculate power for choosing motor (44)
      • 3.2.2 Raspberry Pi 4 – 2GB (47)
      • 3.2.3 H bridge L298N (48)
      • 3.2.4 Arduino Mega 2560 (49)
      • 3.2.5 RPLidar A1 (51)
      • 3.2.6 Battery (52)
      • 3.2.7 Omni wheel (52)
  • CHAPTER 4. SOFTWARE DESIGN (53)
    • 4.1 Robot control program (53)
      • 4.1.1 Robot control program in ROS (53)
      • 4.1.2 The PID control program (55)
    • 4.2 Integrate system in ROS (56)
      • 4.2.1 Mapping (56)
        • 4.2.1.1 Hector SLAM mapping algorithm (57)
        • 4.2.1.2 Save map (map server) (60)
      • 4.2.2 Navigation (60)
  • CHAPTER 5. EXPERIMENTS AND RESULTS (62)
    • 5.1 Survey kinetic (62)
    • 5.2 Survey navigation (63)
    • 5.3 Comment (65)
  • CHAPTER 6. CONCLUSION AND IMPROVEMENT (67)
    • 6.1 Conclusion (67)
    • 6.2 Improvement (67)

Nội dung

Figure 1-1: Some self-propelled robot products 1.2 Robot’s objective The objective of the thesis:  Build a holonomic robot using the 4 omni-directional wheels model.. 1.4 Thesis’s conte

OVERVIEW

Introduction

In the age of advancing technology and continuous scientific breakthroughs, the prospect of personal robots becoming as ubiquitous as PCs or mobile phones is on the horizon Robots have evolved into a crucial and integral aspect of daily life, with autonomous robots emerging as effective tools in various fields The progress in mechatronics has led to the refinement of self-propelled robots, finding widespread applications in industries, commerce, healthcare, and science They offer numerous advantages to society, gradually replacing human labor in hazardous and toxic environments, rapidly enhancing labor productivity, and actively contributing to the industrialization and modernization processes globally.Given the immense benefits robots bring to humanity, their usage is increasingly prevalent today, featuring diverse sizes, designs, and operational methods, all aimed at aiding humans Autonomous robots employ various navigation techniques, such as recognizing floor barcodes, capturing environmental images, or utilizing laser-scanning sensors However, regardless of their form, these robots grapple with three fundamental challenges Firstly, they must determine their position within a reference coordinate system Secondly, they need to autonomously devise a plan to navigate and avoid obstacles Lastly, during the execution of these tasks, robots must comprehend their surroundings through sensors, constituting the cognitive process.Understanding and addressing these challenges demand significant time and effort for in-depth study and research, requiring researchers with high levels of expertise and extensive knowledge In Vietnam, the utilization of self-propelled cars is not yet widespread due to technological accessibility challenges However, to meet the evolving needs of life, there is a compelling need to further promote the development and application of autonomous robots Hence, the research team has chosen the topic "A holonomic mobile robot for transportation of goods in a warehouse using RPLiDAR" to delve into and expand their knowledge, aiming to accumulate valuable experience for the prospective advancement of autonomous vehicles

Figure 1-1: Some self-propelled robot products

Robot’s objective

The objective of the thesis:

 Build a holonomic robot using the 4 omni-directional wheels model

 Research and implement ROS into the mobile robot for remote control

 Implement Hector SLAM algorithm to map the working environment

 Implement Navigation Stack package to navigate.

Research method

Considering the indoor operating environment of the robot, our group delved into researching and designing the hardware to support a robot capable of carrying a circular load on top, facilitating seamless movement within indoor spaces Achieving precise and smooth movement necessitates that the robot's motors can handle both loaded and unloaded conditions In the initial phase of our research, we focused on selecting a controller for the robot, exploring options like fuzzy controllers, sliding controllers, PID controllers, among others Opting for the PID controller was a strategic choice, given its established effectiveness and wide application in industrial control systems

Subsequently, we delved into researching the ROS (Robot Operating System) model and its relevance to our project Our team studied and implemented ROS on the Ubuntu operating system, installed on the embedded Raspberry Pi computer

In addition, we conducted research on utilizing the lidar sensor, engaged in map scanning, and configured the robot's axis using ROS Our investigation extended to exploring algorithms for determining the shortest path, optimizing obstacle avoidance for the robot, and validating our findings.Furthermore, research how to use the lidar sensor, performed map scanning, and set up the robot's axis using ROS They searched for algorithms to find the shortest path, optimize obstacle avoidance for the robot, and verified their findings.

Thesis’s content

This thesis includes the following:

Chapter 1: Overview (Introduction to current research and proposals relating to the project, choose the suitable devices for application, introduction to the software)

Chapter 2: Theoretical basis (Introduce omni wheel robot model and ROS systems)

Chapter 3: Hardware Design (Requirements of the system, hardware design, connect the hardware and software)

Chapter 4: Software Design (Requirements of the system, software design)

Chapter 5: Experiments and Results (Survey PID controller, robot kinetic and navigation) Chapter 6: Conclusion and Improvement.

THEORETICAL BASIS

Holonomic robot

This thesis supplies base knowledge about four omni wheel robot, the basic structure of an omni robot and the simple method to control

Robot omni wheel which able to move to any direction, any angle without rotation need before move

In general, robots want to gain that ability to move; it means that there are 3 degrees of freedom in the moving plane (temporarily called the Oxyz plane) including: moving independently along the x, y axes and rotating according to the x, y axes z-axis So, a minimum of 3 Omni wheels with independently controlled motors are required because each motor gives the ability to control one degree of freedom (in case of more than 3 wheels, the speed vectors of those wheels are not are linearly independent vectors, in other words, the wheels will have to be constrained to limit the number of degrees of freedom to 3)

Figure 2-1: Three-wheel omni robot movement

To let the robot can move in all directions, it is necessary to use a special wheel Includes a large wheel and small wheels have an axis tangential to the big wheel and perpendicular

Figure 2-2: Some type of omni wheel

2.1.2 Compare omni wheel robot with normal wheel robot

Figure 2-3: Robot using normal wheel

Figure 2-4: Robot using omni wheel

Advantage Enhanced”Maneuverability: Omni wheels allow for multidirectional movement without the need for complex steering mechanisms They can move in any direction, including forward, backward, sideways, and diagonally, making them highly maneuverable

Improved Lateral Movement: Omni wheels can move laterally with ease, allowing for efficient sidestepping and precise positioning This makes them beneficial in applications that require tight turns or lateral movements

Reduced Turning Radius: Omni wheels can rotate in place, enabling vehicles or robots equipped with them to perform quick and tight turns within a small radius This is advantageous in crowded or confined spaces.”

Simplicity:”Normal wheels have a simpler design, consisting of a central hub and a tire, which makes them easier to manufacture, maintain, and repair Their simplicity also leads to lower costs compared to omni wheels

Stability: Normal wheels offer greater stability due to their wider contact area with the ground This stability can be advantageous in applications where maintaining balance and preventing tipping or tilting is important.”

Disadvantage Reduced”Traction: Due to their design, omni wheels often have reduced traction compared to normal wheels The presence of rollers or small wheels at an angle can cause slippage and reduce the overall grip, especially on slippery or uneven surfaces.”

Limited”Maneuverability: Normal wheels generally enable movement in a single direction, requiring additional steering mechanisms for turning This can limit their maneuverability, especially in tight spaces or when precise lateral movements are required

Limited Maneuverability: Normal wheels generally enable movement in a single direction, requiring additional steering mechanisms for turning This can limit their maneuverability, especially in tight spaces or when precise lateral movements are required.”

2.1.3 Compare omni 3 wheel with 4 wheels

Figure 2-5: Four-wheel omni robot movement

Advantage Maneuverability:”A three-wheel omni robot typically has a single wheel at the front and two wheels at the rear This configuration allows the robot to rotate on the

Increased stability:”The presence of four wheels offers better stability to the robot, making it more suitable for carrying heavy loads or operating on rough terrains The weight spot, making it highly maneuverable and capable of navigating tight spaces with ease

Simplicity: With fewer wheels, the overall mechanical structure of a three-wheel omni robot tends to be simpler compared to a four-wheel omni robot This can result in lower manufacturing and maintenance costs

Lighter weight: Having one less wheel often means that the three- wheel omni robot is lighter than its four-wheel counterpart This can be beneficial when it comes to energy efficiency, battery life, and ease of transportation.” distribution across multiple wheels enhances balance and reduces the risk of tipping

Enhanced payload capacity: Four- wheel omni robots generally have a higher maximum load capacity compared to their three-wheel counterparts This makes them suitable for applications that require transportation of bulky or heavy objects

Redundancy: Having four wheels provides redundancy in case of failure or damage to one or more wheels The robot can continue to function and maintain stability even if one wheel becomes non- functional.”

ROS – Robot Operating System

The Robot Operating System (ROS) is a versatile and robust software framework widely employed in the realm of robotics research and development Originally developed by Willow Garage and currently overseen by Open Robotics, ROS has established itself as a standard in the field of robot development

Featuring a distributed architecture, ROS enables seamless communication among robot components through message passing This facilitates a conducive environment for the development, testing, and integration of various robot functionalities

Furthermore, ROS provides an extensive ecosystem of software packages, encompassing libraries, tools, and utilities that significantly aid in the process of robot development Some notable packages within ROS include:

- MoveIt: A motion planning framework that allows robots to plan and execute complex manipulation tasks efficiently and safely

- OpenCV: A computer vision library that provides extensive tools and algorithms for image and video processing, essential for tasks like object recognition and tracking

- Gazebo: A high-fidelity robot simulator that enables developers to create realistic virtual environments for testing and validating robot behaviors and algorithms

- ROS Navigation Stack: A set of navigation-related packages that offer capabilities such as mapping, localization, and path planning to enable autonomous navigation for robots

- ROS Control: A package that provides a standardized interface for controlling robot hardware, allowing developers to easily integrate and control various robotic systems

One of the major benefits of ROS is its large and active user community and the sharing of open knowledge The ROS community is highly engaged and willing to share software packages, tutorials, and experiences, enabling users to quickly access and apply the latest technologies

Due to its flexibility, ease of use, and capacity for facilitating communication among robot components, ROS has emerged as a crucial tool in the arena of robotics research and development This system enables developers to concentrate on crafting specific robot functionalities without the need to reinvent fundamental functions Given its noteworthy influence and ongoing potential for development, ROS plays a pivotal role in propelling the progress of robotics

Figure 2-8: Robot model with ROS

When considering the structure and ecosystem of ROS, three important concepts are: Filesystem, Computation Graph and Community [2]

First concept – Filesystem: explain about the minimum folder structure, file to make ROS work

Second concept – Computation Graph: is the communication between processes and systems This content will show the communicate management between multiple computers, …

Third concept – Community: ROS has a vibrant and active community of developers, researchers, and robotics enthusiasts The ROS community contributes to the development and improvement of ROS by creating packages, sharing code, providing support, and collaborating on projects

Packages: It is the primary unit for organizing software in ROS A package can contain nodes, libraries, files, or any other files

The purpose of a package is to create as small as possible program size for easy to reuse

Metapackage: It is a specialized package which used to represent the relationship between a group of packages

Stacks: When packages are combined with specific function, it is called Stack In ROS, there are many stacks with different purposes Similarly, to packages, the place where information of stack is stored is called Stack Manifests

Figure 2-9: Stack structure in ROS

Message types: It is a description of a message sent back and forth between processes, stored in the format my_package/msg/myMessagetype.msg A message defines the data structure for the messages being sent

The Computation Graph functions as an interconnected network of processes within ROS Each node within the system can connect to this network, engage with other nodes, and share data seamlessly Key elements of the Computation Graph encompass nodes, Master, Parameter Server, messages, services, topics, and bags

Nodes: A node is an individual process for computation and control A node can be created when a package is successfully compiled, and multiple nodes can be created within the same package When a node wants to communicate and interact with other nodes, it needs to be connected to the ROS network In a system, each node serves a different function

Master: the ROS Master provides a registration and lookup service for the rest of the

Computation Graph Without the ROS Master, nodes would not be able to discover each other, exchange messages, or call services The ROS Master acts as a central coordination point for the system, enabling nodes to find and communicate with one another effectively

Parameter Server: allows data to be stored by keywords in a centralized location With these variables, nodes can be configured while they are running or to modify the behavior of nodes The Parameter Server provides a way to store and retrieve configuration parameters, allowing nodes to access and update shared data during runtime

Messages: is a simple data structure that consists of defined fields such as integers, floating points, Booleans, and so on Messages can also include nested structures and arrays (similar to structs in C) User can develop custom message types based on standard messages, allowing them to define our own message structures tailored to specific application requirements

Services: The publish/subscribe model in ROS is highly flexible for one-way communication with multiple entities However, it may not be suitable for request/reply style communication, which is often used in distributed systems Therefore, for request/reply communication, services are utilized Services are defined by a pair of data structures: one for the request and one for the reply A node provides a service through a named interface, and a client uses the service by sending a request message and waiting for a response Services enable synchronous and bidirectional communication between nodes, facilitating a request/reply pattern in ROS.

SLAM

2.3.1 Introduce to SLAM (Simultaneous localization and mapping)

Simultaneous localization and mapping (SLAM) is a popular technique used in robotics to enable robots to navigate and build maps of their environment in real time In ROS, there are various SLAM algorithms and packages available that utilize sensor data to perform localization and mapping tasks These algorithms allow robots to move autonomously, perceive their surroundings, and create accurate maps for navigation and planning purposes

Hector SLAM is a method using laser sensor or distance sensor Laser sensors typically generate 2D or 3D points, known as a point cloud, which is used to represent the shape and distance of the environment around the robot Due to the high accuracy of laser sensors, the point cloud provides crucial information for constructing accurate and ideal maps for the SLAM process

Lidar is a sensor commonly used in indoor environments that can help robots build maps and navigate autonomously The laser-based SLAM system calculates the distance traveled lidar has high accuracy, minimal errors, and can be directly used for localization and navigation purposes [4]

2D Navigation stack is used to gather the information, data from odometry, sensor, setpoint and setpoints, and then generate velocity commands to control the robot’s movement When using the Navigation stack, there are certain hardware requirements:

 Odometry: The robot should be equipped with odometry sensors, such as encoders or wheel sensors, to estimate its position and velocity based on wheel rotations

 Laser Range Finder or Lidar: A laser range finder or lidar sensor is typically used to provide accurate and reliable distance measurements for obstacle detection and mapping This sensor helps the robot perceive its surroundings and avoid collisions

 IMU (Inertial Measurement Unit): An IMU sensor, which consists of accelerometers and gyroscopes, is often used to provide information about the robot's orientation and angular velocity This data is important for sensor fusion and accurate localization

 Actuators: The robot should have actuators, such as motor controllers or servos, to control its motion based on the velocity commands generated by the Navigation stack These actuators enable the robot to move and navigate through the environment

Navigation stack only send velocity directly to robot controller to gain the robot’s setpoint values such as linear velocity in x-axis, y-axis and angular velocity

Figure 2-10: Navigation stack model in ROS [5]

The”Costmap 2D package is used to generate a cost map by incorporating sensor data from the environment It stores information about obstacles and inaccessible areas for the robot The Costmap 2D utilizes sensor data from a pre-built map and updates the costmap with obstacle information

The costmap represents different levels of cost or "inflation" around obstacles, indicating how difficult it is for the robot to navigate through those areas The cost values help the robot's navigation algorithm to plan paths that avoid obstacles and prefer areas with lower costs

By continuously updating the costmap with sensor data, the robot can perceive its surroundings and adapt its path planning accordingly, ensuring safe and efficient navigation in dynamic environments.”

In”robot navigation, there are two main approaches to path planning: global navigation and local navigation

Global Navigation: Global navigation involves planning a path for the robot to reach a target or goal location within the map It is typically used for longer distances or when the target location is far away The global navigation algorithm considers the entire map and computes an optimal path that takes into account obstacles and the desired destination This path is planned in advance and can be adjusted if the environment changes Global navigation helps the robot efficiently navigate to distant targets

Local Navigation: Local navigation focuses on generating a path in the immediate vicinity of the robot It is used for short distances or to avoid obstacles encountered during robot movement Local navigation algorithms take into account real-time sensor data, such as from a laser range finder or other obstacle detection sensors, to generate a path that avoids obstacles and leads the robot towards its goal Local navigation enables the robot to react quickly to its immediate surroundings and make necessary adjustments to ensure safe and obstacle-free movement

Global navigation utilizes the global costmap, while local navigation utilizes the local costmap Each costmap has its own specific parameters and shared parameters

The "obstacle_range" attribute is used to define the maximum distance at which the sensor can read and update obstacle information in the costmap If the robot detects an obstacle within a distance smaller than "obstacle_range," it will place an obstacle in the costmap from the laser information on the obstacle surface can be updated without identifying the entire obstacle With this information, we can construct a map

The "inflation_radius" attribute is used to maintain the minimum distance between the robot's center and the obstacle in the costmap

The "laser_scan_sensor" attribute is used to declare information about the sensor type and is used to add/remove obstacles in the costmap

Information for declaring variables in the "global_costmap_params.yaml" file:

- The "global_frame" and "robot_base_frame" attributes define the global frame and the frame attached to the mobile base, respectively

- The "update_frequency" attribute is used to declare the update frequency for the costmap

- The "static_map" attribute is used to declare whether or not to use a pre-built map Information for declaring variables in the "local_costmap_params.yaml" file:”

- The "publish_frequency" attribute is used to determine the frequency of updating information

- The "rolling_window" attribute is used to keep the costmap centered on the robot as it moves.

Algorithm for global planner and local planner

A* is a search algorithm in graph theory [3], used to find a path from a current vertex to a goal vertex by utilizing a heuristic function to estimate the distance, also known as the Heuristic function

From the current state, A* constructs all possible paths using the Heuristic function to evaluate the best possible path The Heuristic function is evaluated differently depending on the specific problem A* always finds the shortest path if such a path exists

A* maintains a set of paths through the graph, from the starting vertex to the goal vertex The priority order for a path is determined by the evaluation of the Heuristic function:

- f(x) represents the total cost of the path The lower value of f(x), the higher priority

- g(x) represents the cost of the path from the starting vertex to the current vertex

- h(x) represents the estimated cost from the current vertex to the goal vertex

For clearly understand the algorithm, this is an example:

Question: Given a chessboard of size n x n, find the shortest path from point 〇 to point △ under the following conditions:

- White cells represent valid paths

- Black cells represent obstacles and cannot be traversed

- At any given cell, movement is only allowed in the upward, downward, leftward, or rightward directions, without diagonal movement

In the given problem, we can observe that the shortest path is a diagonal line connecting point 〇 to △

The length of the diagonal path can be calculated using the formula:

When moving through each cell, the value of the cell increases by 1 unit

Since f(x) = g(x) + h(x), so the table will be:

Next, starting from position 0, we will explore its neighboring cells to find the shortest path

For example, considering point P(0,0), it has two adjacent points: P(1,0) to the right and P(0,1) below The value of f(x) = g(x) + h(x) = 3.2 Since both values are equal, either point can be chosen In Step 2, we select point P(1,0)

Point P(1,0) has two neighboring points with the following values: P(2,0) = 5.2 and P(1,1)

= 4.8 Adding P(0,1), which is already available, we have three points: P(0,1) = 3.2, P(2,0)

The value of P(2,0) is closest to the value of 8.6 Therefore, P(2,0) is chosen as the next point to be evaluated By following the same steps, we obtain the image table above After reach the △, we have the shortest path below:

Figure 2-15: Shortest path for robot tu run from 〇 to △

2.4.2 Dynamic Window Approach algorithm to avoid object for local planner

The Dynamic Window Approach (DWA) algorithm is used to find an appropriate control signal to send to the robot in order to navigate it to the destination safely and quickly, based on a pre-planned global path This algorithm consists of two main steps: reducing the search space for velocity and finding the optimal velocity within that search space [3]

The permissible velocities are determined based on the following three steps in the search space reduction:

Circular Trajectory: The algorithm considers a circular trajectory defined uniquely by a pair of linear velocity ( )v and angular velocity ( ) This circular trajectory represents the robot's potential path within the search space

Feasible Velocities: Feasible velocities are selected to generate a safe trajectory for the robot to avoid obstacles A pair of velocities (v, w) is considered feasible if the robot can stop before the nearest obstacle without collision along the corresponding trajectory Feasible velocities are defined as follows:

Va is a string of velocity values ( , )v allow robot stop before the obstacle without collision

( , ) dist v  is the lowest distance that robot stop in front of obstacle without collision v b and  b is the maximum allowable acceleration of the linear velocity and rotational velocity for robot moving without collision

Figure 2-16: Allowed velocity Va in DWA

Dynamic Window: The dynamic window represents the intersection between the robot's feasible velocities and the permissible velocities within the search space It is obtained by limiting the linear and angular velocities to the feasible range based on the robot's dynamic constraints, such as maximum acceleration and maximum angular velocity

Figure 2-17: Velocity Vd in DWA After completing the three steps, we find the search space

To optimize the output velocity, the objective function should have a maximum value To

- Target heading: heading represents the progress towards the destination of the robot The value will be maximized when the robot moves directly towards the destination The value of ℎ𝑒𝑎𝑑𝑖𝑛𝑔(𝑣, 𝜔) is calculated using the formula 180 − 𝜃, where 𝜃 is the angle between the robot's direction and the destination point

Figure 2-18: Heading of robot in DWA

- Clearance: The function 𝑑𝑖𝑠𝑡(𝑣, 𝜔) represents the distance from the robot to the nearest obstacle along its curved trajectory This value will be very large if there are no obstacles on its path The smaller this value, the higher the likelihood of the robot facing an obstacle, and it will move around that obstacle

- Velocity: The function 𝑣𝑒𝑙(𝑣, 𝜔) is the straight-line velocity of the robot and supports faster movement

- The coefficients 𝛼, 𝛽, 𝛾 are chosen to be appropriate for the characteristics of the robot and the operating environment When the objective function has the highest value, the optimal trajectory will be selected with the best velocity (𝑣, 𝜔), which is the result of the algorithm.

Protocol

ROS Serial is a communication library that allows the exchange of data between a computer running the Robot Operating System (ROS) and a microcontroller or embedded system It enables the integration of ROS with low-level hardware platforms that do not have native support for ROS

ROS Serial provides a lightweight and flexible protocol for serial communication, allowing ROS nodes to send and receive messages and commands over a serial port It supports both asynchronous and synchronous communication modes, depending on the requirements of the application

One of the key use cases for ROS Serial is connecting ROS to microcontrollers or single- board computers like Arduino, Raspberry Pi, or BeagleBone By using ROS Serial, these low-power devices can act as ROS nodes, enabling them to interact with other ROS nodes and take advantage of the rich ecosystem of ROS libraries and tools

ROS Serial is typically used when there is a need for real-time or close-to-real-time communication between a ROS-enabled computer and a microcontroller This could include applications such as robotic control, sensor integration, and data logging [6]

Figure 2-99: Integrate ROS for robot

2.6 Control motor with PID algorithm

Figure 2-20: PID controller for system

ROS Serial Node structured XML_RPC protocol

Microcontroller Microcontroller structured XML_RPC protocol

R os se ri al p ro to co l se ri al iz ed

OtherProtocols motors, robotics, flow control, and many other industrial processes It is designed to regulate and stabilize processes by continuously adjusting control parameters based on feedback from the system being controlled The PID controller calculates an error value as the difference between a desired setpoint and the measured value of the system's output There are three components of a PID controller:

- Proportional (P) Control: The proportional term produces an output that is directly proportional to the error between the setpoint and the measured value It applies a gain factor (Kp) to this error to generate the control signal Proportional control helps reduce the steady-state error, but it can lead to overshoot and instability if used alone

- Integral (I) Control: The integral term considers the accumulated error over time It integrates the error signal and multiplies it by a gain factor (Ki) to generate the control signal Integral control is effective in eliminating steady-state errors and helps in handling system disturbances and biases

- Derivative (D) Control: The derivative term calculates the rate of change of the error over time It applies a gain factor (Kd) to the derivative and adds it to the control signal Derivative control anticipates the future trend of the error and helps in dampening rapid changes, reducing overshoot, and improving stability

The output of PID controller is the sum of three: output out out out

The proportional control step is the multiplication between current error and the constant gain Kp

The integral control step is the multiplication between the integral of the instantaneous error over time and the gain constant Ki

The derivative control step is the multiplication between the rate of change of error over time and the gain constant Kd out D ( )

The transfer function of the continuous controller:

The development of digital control systems requires the use of discrete-time controllers Therefore, the PID control algorithm is also widely used on computers as well as embedded systems The signal conversion to discrete-time domain for each control step is as follows: Proportional step:

With T being the sampling period (in seconds), the output u(kT) can be defined as follows:

2.6.2 Ziggler Nichol II: Tunning PID parameters Ziggler – Nichols II

There are various methods to tune a PID controller for a control system, such as manual tuning, using the Ziegler-Nichols II method, or using software-assisted PID tuning The choice of method depends on the complexity and specific requirements of the system

In this research, the method used for motor control is

Step 1: Start the system and set up the PID controller:

- Set all PID coefficients (Kp, Ki, Kd) to 0

- Enable the PID control mode with only the proportional gain (Kp)

- Ensure that the controller is started and the system is operating in auto-tuning mode

Step 2: Increase the proportional gain (Kp) until the system starts oscillating at a frequency f₀:

- Gradually increase Kp until reaching the maximum value at which the system remains stable

- Record the time for one complete oscillation cycle (T₀) in time units

- Calculate the oscillation period (Tu) by dividing T₀ by the number of complete cycles (N) in one second

Step 4: Calculate the PID parameters:

Controller Kp Ti Td Ki Kd

PID 0.6Ku 0.5Tu 0.125Tu 1.2 Ku

Table 2-1: Parameters when applying Ziggler-Nichols Step 5: Set the calculated PID parameters in the PID controller

- Switch the controller to proportional-integral-derivative (PID) mode

- Set the calculated Kp, Ki, Kd values obtained in the previous step

Step 6: Test and fine-tune the controller:

- Test the performance of the newly tuned PID controller by measuring and recording the system's feedback response

- Verify if further adjustments are needed to optimize the controller's performance [7]

Low-pass Filter

The most common way to characterize the frequency response of a circuit is to find its

H s  V s Taking the Laplace transform of our differential equation and solving for H s( )we get:

Because the robot system is a discrete system so the transfer function has to transform from (s) domain to (z) domain:

So, the Discrete Transfer Function is:

DESIGN OF ROBOT

Overview robot hardware

3.1.1 General diagram of the system

A mobile robot for indoor use is a system designed with a compact frame, peripherals, and control circuits to meet the requirements of sensor processing, obstacle avoidance, and remote control

From above requirement, the hardware of the robot includes a Mica frame, Lidar sensor, Arduino microcontroller, computer, DC encoder motors, H-bridge circuit for motor control, IMU sensor, and power supply

Figure 3-1: General diagram of robot

This is the block diagram show how supply the power for robot modules

Figure 3-2: Detail block diagram robot modules Power supply for robot operation is battery 12V and for raspberry is a power bank

ENA IN1 IN2 IN3 IN4 ENB

ENA IN1 IN2 IN3 IN4 ENB

This is the detail wiring connection of robot base, Arduino will connect to Motors through Driver L298N Motors have two wiring C1, C2 are Encoder signal to feedback to Arduino to create a close-loop system

Figure 3-4: Wiring diagram for Raspberry, Lidar and Arduino

The connection between Arduino and Raspberry or Raspberry to Lidar are simple, by using the Arduino USB cable and then connect to Raspberry, same with Lidar but the head cable to connect to Lidar is Micro USB

Devices used in the project

3.2.1 Calculate power for choosing motor

Following the theory [8],the working environment of robot is flat surface, assuming to ignore the deformation of the wheels, ignoring the resistance of the air during the robot’s movement

Select omni wheel with diameter d 58(mm)

Analysis of the force acting on a wheel will be displayed as follow:

Figure 3-5: Force analysis diagram With:

Fmsis the friction force between wheel and the floor surface

Fw is the pulling force generated by the torque of the motor

N is the reaction force from the floor surface

M 1 is the torque of the motor m 1 is the weight of the robot each wheel must bear, 1

4 m  m With m is robot weight The force equilibrium:

 When robot moving forward constantly

The constant speed v =0.5 (m/s), so the acceleration a = 0 (m/s 2 ) At the time:

The pulling force is generated by the torque of the motor:

With the coefficient of rolling friction  l 0.015when moving on a concrete floor

The power needed for robot to move stability with velocity 0.5 (m/s) is:

Robot accelerate with a =0.5 (m/s 2 ), the pulling force is generated by torque of the motor:

With the static friction coefficient is  n 1

The required torque to accelerate the robot is:

The power needed for robot to accelerate the robot to 0.5 (m/s) is:

Choose the motion option of the robot as straight motion The four drive wheels move forward at the same speed of 0.5 m/s The angular velocity of the wheel is:

For a low-speed and non-high-performance motion, a DC motor is required to have good load-bearing capability and cost-effectiveness The JGB-520 178rpm Encoder DC motor is a suitable choice

The encoder used is a quadrature encoder with two output channels, A and B, which are phase-shifted The number of pulses per revolution is specified by the manufacturer, and the phase relationship between channels A and B indicates the direction of motor rotation Channel A can lead or lag channel B to determine the motor's rotation direction

Figure 3-6: Encoder motor JGB-520 178rpm Specification:

Due”to the low budget, the group decided to choose the Raspberry Pi 4 2GB

The Raspberry Pi 4 offers ground-breaking increases in processor speed, multimedia performance, memory, and connectivity compared to the prior-generation boards, while retaining backwards compatibility and similar power consumption The Raspberry Pi 4 provides desktop performance comparable to entry-level x86 PC systems The Raspberry

Pi 4 comes in three on-board RAM options for even further performance benefits: 2GB, 4GB and 8GB

This product's key features include a high-performance 64-bit quad-core processor, dual- display output via two Micro HDMI ports, up to 4K resolution, hardware video decoding at up to 4Kp60, up to 4GB of RAM, dual-band 2.4/5.0 GHz wireless LAN, Bluetooth 5.0, Gigabit Ethernet, USB 3.0, and PoE capability

Due to the higher power requirements, the Raspberry Pi 4 requires a 3.0A USB-C power supply (sold separately) If you have an existing power supply that is rated at 3.0A, you may utilize a microUSB to USB-C adapter to utilize your existing MicroUSB power supply to power the Raspberry Pi 4

The standard HDMI port that was part of previous generation Raspberry Pi generation boards is replaced on the Raspberry Pi 4 by two Micro HDMI ports to provide dual monitor support A 4K60P Micro HDMI to HDMI cable is required (or two cables for dual monitor operation).”

With the robot's flexible movement capability indoors, it requires controlling the rotation direction, motor speed, and desired position The electrical circuit should have the ability to reverse the current direction and control the current intensity flowing through the motor

Figure 3-9: Schematic diagram of H bridge

By controlling the switches S1, S2, S3, and S4, the direction of the current through the motor can be changed, thereby allowing the motor's rotation direction to be changed Choosing a suitable H-bridge is a crucial factor in achieving high-quality motor control Therefore, the presenter has chosen the L298N module as the H-bridge solution

The L298N board is a dual full-bridge motor driver IC designed to control DC motors It operates over a wide voltage range and can handle a maximum current of 2A, making it suitable for controlling one-way DC motors

Logic voltage Low from -0.3 to -1.5V; high from 2.3V to

Vss Maximum current for each motor 2A

Current required for control signal 0-36mA

Motor run forward Motor run reverse

Figure 3-10: Internal circuit diagram of module L298N

The”selected module is capable of handling current well and has been chosen to control this robot system Through the usage process, it has demonstrated stable operation without overheating issues Additionally, it offers cost-effective use and easy replacement, contributing to improved performance of the robot.”

Because”of the heavy workload of the process in controlling motors speed and communicate with Raspberry to run realtime So, Arduino Mega 2560 is suitable

Arduino™ Mega 2560 is a microcontroller board based on the ATmega2560 It has 54 digital I/O pins (14 of which can be used as PWM outputs), 16 analogue inputs, 4 UARTs (serial hardware interfaces), a 16-MHz crystal oscillator, a USB interface, a power connection, an ICSP header and a reset button It contains everything you need to accompany the microcontroller Simply connect the board to a computer via USB or run it on an AC/DC adapter or battery to get started.”

Figure 3-11: Arduino mega 2560 board Specification:

Digital I/O pins 54 (of which 14 can be used for PWM output)

Direct current at each I/O pin 40 mA

Direct current at 3.3-V pin 50 mA

Flash memory 256 KB, 8 KB of which is used by the bootloader

For”choosing the sensor to map the environment, all type of lidar are suitable so in this project, RPLidar A1 is satisfied due to the low cost requirement

Lidar is used to measure the distance to objects by emitting pulsed laser beams and then measuring the reflected light using sensors The differences in the time of flight and wavelength are used to calculate and construct object models

Lidar is widely used in various practical applications such as creating digital maps in geology, archaeology, laser-based navigation systems, and more One of the prominent applications of Lidar today is in autonomous vehicles and self-driving robots.”

Ranging Accuracy 1% of actual distance (≤3 m); 2% of actual distance (3-5 m); 2.5% of actual distance (5-12m)

Choose the Lipo battery 11.1V 2200 mAh due to the operation of the robot Robot has motors and H bridge which operating at 12V

The robot has a small size so the omni wheel 58mm is suitable

SOFTWARE DESIGN

Robot control program

4.1.1 Robot control program in ROS

Robot avoid obstacle và go to the setpoint

Figure 4-1: Flowchart controlling robot in ROS

The robot is designed with two modes:

Auto mode: is used to move the robot from the initial position to a setpoint using obstacle avoidance algorithms and finding the shortest path

Manual mode: Is used to map the working area of the robot In this mode, robot can run different angle by the advantage of using omni wheel Therefore, ros_joystick package is suitable for this application Joystick will send the coordinate points to the robot, then the robot will convert them to polar coordinate system Joystick plane axis is (50,50)

Figure 4-2: Transfer data from joystick to setpoint for robot

Ox robot speed and angle

After robot transfer the data into set speed and set angle, this is just the velocity of the robot and not the individual motor velocities Therefore, the robot needs a conversion step to obtain the specific velocities for each wheel At this stage, a PID controller is applied to ensure that the motors run at the desired setpoint

In this diagram, the Raspberry will send the set speed command to Arduino, then Arduino convert that data into four different set speed motors After that, robot will use PID controller to keep the speed stay at correct setpoint

 The sampling frequency: fs = 1 kHz

From (2.25), the equation will be:

           (4.2) Substitude the parameter with cut off frequency fs = 20 Hz

Integrate system in ROS

In”the field of mobile robotics, mapping the environment is one of the crucial tasks The robot needs to learn a map of the unknown environment before it can operate autonomously effectively Mapping the environment for robots enables them to perform tasks such as determining their own position within the environment, planning paths, identifying destinations, and executing tasks based on calculated paths in the most efficient manner possible

To construct a 2D map for the Navigation stack to operate, there is a package called

"hector_slam" available on the ROS platform It requires data from odometry and a laser sensor With these inputs, it can generate a real-time map based on the collected data The hector_slam package plays a crucial role in creating static maps that enable robots to navigate autonomously within their environment.”

Figure 4-5: Build a static map from laser

Hector SLAM utilizes a grid map model to represent the map, where each cell in the grid represents a portion of the environment measured by the laser sensor The algorithm employs smoothing and interpolation techniques to refine and enhance the quality of the map

In this project, the robot is equipped with an RPLidar A1 laser scan sensor, which has a scanning range of up to 12 meters to scan the environment for map construction

Step 1: The Lidar sensor will perform a scan of the surrounding environment The returned values from the sensor consist of 360 points corresponding to the 360 degrees of the sensor's scan Each point represents the distance from the Lidar to the obstacle position

Figure 4-6: Start up lidar on Rviz

Step 2: After Rviz utilizes Hector SLAM to interpolate all the above pixel points into corresponding values on the map, it draws them onto the pre-established map

Figure 4-7: Robot take data from Lidar and draw map on Rviz Step 3: The scan matching process will optimize the alignments of the drawn points and newly scanned points to minimize the occupancy value

Figure 4-8: Use scanning matching to extend map

Step 4: By performing lidar movements based on the calculations from the processes, we can obtain the desired map of the environment to be scanned

After moving in the environment and obtaining the best resulting map, we can save it The saving process can be done using the following command in the terminal: rosrun map_server map_saver [-f mapname]

Here, "mapname" is the name we choose for the map After saving, we will receive two files that describe the saved map: an image file in the pgm format and a YAML file that provides additional information

The image file depicts the occupied spaces in the environment According to the standard, white pixels represent empty space, black pixels represent occupied areas (such as walls, obstacles, etc.), and gray pixels represent regions that the robot has not traversed

File yaml will contain information: image: mymap.pgm resolution: 0.050000 origin: [-51.224998, -51.2244998, 0.000000] occupied_thresh: 0.65 free_thresh: 0.196

"image": The path to the image file containing the map information

"resolution": The resolution of the map, measured in meters per pixel

"origin": The coordinates of the bottom-left pixel and the rotation of the map

"negate": If set to 0, white represents free space and black represents occupied space If set to 1, it is the opposite

"occupied_thresh": The threshold value to determine if a pixel is considered occupied

"free_thresh": The threshold value to determine if a pixel is considered free space

To perform accurate and safe navigation (avoiding obstacles) for the vehicle, we also need to use sensors to gather data from the environment Lidar is a sensor directly used when

By using the robot's position from the odometry source and the map from the Map Server, we control the robot's movement towards predefined points The path is pre-determined using the A* algorithm During the movement, if obstacles appear, the robot will re-plan a new path to the destination Control information, including linear and angular velocities, will be transmitted through UART for motor control of the robot [9]

EXPERIMENTS AND RESULTS

Survey kinetic

Using omni wheel to navigate to a given location:

Taking one grid square as one unit

The robot will move directly to the set point without any rotation needed

Figure 5-1: Omni robot base running with angle = 63.435 o

Figure 5-2: Robot can move with any angle

This result show that the advantage of omni wheel robot is a flexible ability to run in any angle with any velocity.

Survey navigation

These are steps to run Hector SLAM:

 Install Hector SLAM: Dowload the Hector SLAM package from the official repository (https://github.com/tu-darmstadt-ros-pkg/hector_slam).

 Build the package and install any dependencies if needed

Figure 5-3: Clone the git into the Raspberry

 Set up ROS workspace environment by using “catkin_make” command

 Run the command roslaunch to launch the hector_slam package

After run the command above, it will open the Rviz panel

 Use manual mode to run robot around the working environment and finished mapping.

Comment

The PID controller is specifically tailored for a robot characterized by high stability Moreover, parameters such as settling time, overshoot, and steady-state error are appropriately tuned based on the robot's responsiveness

Throughout the testing phase, the robot successfully achieved the predefined target using the algorithm designed for finding the shortest path in diverse scenarios The research team observed consistent and effective performance from the robot It precisely met the requirements for various points and directions of movement, even in environments featuring noisy signals The robot adeptly managed situations and adhered to the adjusted parameters

However, post each movement, a slight deviation in the robot's rotation angle was noted, attributed to the accumulated error from the encoder

CONCLUSION AND IMPROVEMENT

Conclusion

After completing the hardware design, establishing the ROS platform, and processing data from the lidar sensor, the research team has successfully created a robot capable of mapping its surrounding environment and navigating based on the generated map The team has also conducted evaluations yielding the following results:

Concerning hardware design, the team has finalized the robot frame, ensuring it is compact and well-suited for indoor movement The stable control circuit system allows for flexible navigation within the household However, the robot's relatively elevated height poses a challenge, as it may not detect obstacles below the lidar's scanning range, potentially leading to collisions

In terms of the robot's mapping capability, experimental results indicate that the generated maps closely align with the actual environment Nevertheless, certain limitations exist in the mapping process The use of a Raspberry Pi with only 4 GB of memory poses challenges for map collection due to memory overflow issues Additionally, the robot's scanning range for mapping is restricted, and excessive movement may result in connection loss, hindering the mapping process

Overall, the research team has made substantial progress in hardware design, ROS integration, and mapping and navigation capabilities However, certain limitations and challenges persist, such as addressing memory management for map collection and extending the scanning range for mapping.

Improvement

To enhance the robot for improved optimization, stability, and performance across diverse environmental conditions, with the goal of commercializing this robot model, the team must focus on developing the following aspects:

Improve the hardware design to ensure durability, compactness, aesthetic appeal, and enhanced load-bearing capacity, facilitating the transportation of goods or personal belongings for users

Integrate remote control applications accessible via the Internet, enabling users to conveniently operate the robot using a laptop, tablet, or smartphone Furthermore, the team should explore and implement interactive features fostering communication between the user and the robot through a control interface.Increase the robot's scanning and mapping capabilities This involves improving the speed of movement while maintaining the highest possible accuracy

By focusing on these aspects, the team can enhance the overall performance, functionality, and user experience of the robot, making it more suitable for commercialization and meeting the diverse needs of users in different environments

[1] CLBRobot, "Giải thuật điều khiển robot omni 4 bánh," Tai Lieu Hay, 2013

[2] H A H R M A G Aghus Sofwan, Development of Omni-Wheeled Mobile Robot Based-on Inverse Kinematics and Odometry, Java Tengah

[3] N D A Le Duc Hanh, "HOẠCH ĐỊNH VÀ BÁM ĐƯỜNG ĐI CHO MOBILE ROBOT ỨNG DỤNG ĐIỀU KHIỂN NỐI TIẾP ẢNH," tạp chí khoa học công nghệ giao thông vận tải số 27 + 28, 2018

[4] A H a D Kartashov, "A SLAM research framework for ROS," the 12th Central and Eastern European Software Engineering Conference in Russia, 2016

[5] J A F a R L Guimaraes, "ROS Navigation: Concepts and Tutorial," Studies in Computational Intelligence, 2016

[6] A Kumar, "How to use Arduino with Robot Operating System," Akshay Kumar, 2020

[7] G C a Y L Kiam Heong Ang, "PID Control System Analysis, Design, and Technology," IEEE, 2005

[8] V P Thiên, "Thiết kế robot tự hành theo vết hoạt động trong nhà xưởng," Linh Bui Khac, 2020

[9] Automaticaddison, "How to set up the ROS navigation stack on a robot," caddison,

Ngày đăng: 07/06/2024, 16:19

Nguồn tham khảo

Tài liệu tham khảo Loại Chi tiết
[1] CLBRobot, "Giải thuật điều khiển robot omni 4 bánh," Tai Lieu Hay, 2013 Sách, tạp chí
Tiêu đề: Giải thuật điều khiển robot omni 4 bánh
[3] N. D. A. Le Duc Hanh, "HOẠCH ĐỊNH VÀ BÁM ĐƯỜNG ĐI CHO MOBILE ROBOT ỨNG DỤNG ĐIỀU KHIỂN NỐI TIẾP ẢNH," tạp chí khoa học công nghệ giao thông vận tải số 27 + 28, 2018 Sách, tạp chí
Tiêu đề: HOẠCH ĐỊNH VÀ BÁM ĐƯỜNG ĐI CHO MOBILE ROBOT ỨNG DỤNG ĐIỀU KHIỂN NỐI TIẾP ẢNH
[4] A. H. a. D. Kartashov, "A SLAM research framework for ROS," the 12th Central and Eastern European Software Engineering Conference in Russia, 2016 Sách, tạp chí
Tiêu đề: A SLAM research framework for ROS
[5] J. A. F. a. R. L. Guimaraes, "ROS Navigation: Concepts and Tutorial," Studies in Computational Intelligence, 2016 Sách, tạp chí
Tiêu đề: ROS Navigation: Concepts and Tutorial
[6] A. Kumar, "How to use Arduino with Robot Operating System," Akshay Kumar, 2020 Sách, tạp chí
Tiêu đề: How to use Arduino with Robot Operating System
[7] G. C. a. Y. L. Kiam Heong Ang, "PID Control System Analysis, Design, and Technology," IEEE, 2005 Sách, tạp chí
Tiêu đề: PID Control System Analysis, Design, and Technology
[8] V. P. Thiên, "Thiết kế robot tự hành theo vết hoạt động trong nhà xưởng," Linh Bui Khac, 2020 Sách, tạp chí
Tiêu đề: Thiết kế robot tự hành theo vết hoạt động trong nhà xưởng
[9] Automaticaddison, "How to set up the ROS navigation stack on a robot," caddison, 2021 Sách, tạp chí
Tiêu đề: How to set up the ROS navigation stack on a robot
[2] H. A. H. R. M. A. G. Aghus Sofwan, Development of Omni-Wheeled Mobile Robot Based-on Inverse Kinematics and Odometry, Java Tengah Khác

TÀI LIỆU CÙNG NGƯỜI DÙNG

TÀI LIỆU LIÊN QUAN

w