1. Trang chủ
  2. » Giáo Dục - Đào Tạo

Design an indoor holonomic mobile robot using lidar

114 7 0

Đ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 Indoor Holonomic Mobile Robot Using Lidar
Tác giả Nguyen Thanh Tam, Tran Minh Quan
Người hướng dẫn Ph.D. Vu Van Phong
Trường học Ho Chi Minh City University of Technology and Education
Chuyên ngành Automation and Control Engineering
Thể loại Graduation Thesis
Năm xuất bản 2023
Thành phố Ho Chi Minh City
Định dạng
Số trang 114
Dung lượng 5,57 MB

Cấu trúc

  • CHAPTER 1.OVERVIEW (15)
    • 1.1 Introduction (15)
    • 1.2 Robot’s objective (16)
    • 1.3 Research method (16)
    • 1.4 Thesis’s content (17)
  • CHAPTER 2.THEORETICAL BASIS (18)
    • 2.1 Holonomic robot (18)
      • 2.1.1 Introduction (18)
      • 2.1.2 Compare omni wheel robot with normal wheel robot (19)
      • 2.1.3 Compare omni 3 wheel with 4 wheels (21)
      • 2.1.4 Dynamic Kinematic of the mobile robot (23)
        • 2.1.4.1 Forward kinematic (23)
        • 2.1.4.2 Inverse kinematic (24)
    • 2.2 ROS – Robot Operating System (25)
      • 2.2.1 Introduce to ROS [3] (25)
      • 2.2.2 ROS structure (26)
        • 2.2.2.1 ROS filesystem (26)
        • 2.2.2.2 ROS Computation Graph Level (28)
    • 2.3 SLAM (29)
      • 2.3.1 Introduce to SLAM (Simultaneous localization and mapping) (29)
      • 2.3.2 Hector SLAM (29)
        • 2.3.3.1 Costmap 2D (30)
        • 2.3.3.2 Costmap configuration process (30)
    • 2.4 Algorithm for global planner and local planner (32)
      • 2.4.1 A* algorithm for global planner (32)
      • 2.4.2 Dynamic Window Approach algorithm to avoid object for local planner (35)
        • 2.4.2.1 The search spaces (35)
        • 2.4.2.2 Optimize (36)
      • 2.5.1 UART (37)
      • 2.5.2 ROS communication (39)
    • 2.6 Control motor with PID algorithm (40)
      • 2.6.1 Introduce PID controller (40)
      • 2.6.2 Tunning PID parameters Ziggler – Nichols II (42)
    • 2.7 Low-pass Filter (43)
      • 2.7.1 Introduce Low-pass Filter (43)
      • 2.7.2 Calculation (43)
  • CHAPTER 3.HARDWARE DESIGN (45)
    • 3.1 Overview robot hardware (45)
      • 3.1.1 General diagram of the system (45)
      • 3.1.2 Wiring diagram (45)
    • 3.2 Design robot frame (47)
      • 3.2.1 Layer 1 (48)
      • 3.2.2 Layer 2 (50)
      • 3.2.3 Layer 3 (51)
      • 3.2.4 Full robot frame (52)
    • 3.3 Devices used in the project (53)
      • 3.3.1 Motor bracket (53)
      • 3.3.2 Copper pillar (53)
      • 3.3.3 Calculate power for choosing motor (54)
      • 3.3.4 Raspberry Pi 4 – 2GB (57)
      • 3.3.5 H bridge L298N (58)
      • 3.3.6 Arduino Mega 2560 (59)
      • 3.3.7 RPLidar A1 (61)
      • 3.3.8 Battery (62)
      • 3.3.9 Omni wheel (62)
  • CHAPTER 4.SOFTWARE DESIGN (63)
    • 4.1 Robot control program (63)
      • 4.1.2 The PID control program (65)
    • 4.2 Integrate system in ROS (66)
      • 4.2.1 Mapping (66)
        • 4.2.1.1 Hector SLAM mapping algorithm (67)
        • 4.2.1.2 Save map (map server) (69)
      • 4.2.2 Navigation (70)
  • CHAPTER 5.EXPERIMENTS AND RESULTS (72)
    • 5.1 Survey PID controller parameter (72)
      • 5.1.1 Motor 1 (72)
      • 5.1.2 Motor 2 (73)
      • 5.1.3 Motor 3 (74)
      • 5.1.4 Motor 4 (75)
      • 5.1.5 Full robot base (76)
    • 5.2 Low-Pass Filter (77)
      • 5.2.1 Choosing cut off frequency (77)
      • 5.2.2 The result of motor’s speed after applying lowpass filter (78)
    • 5.3 Survey kinetic (80)
    • 5.4 Survey navigation (82)
    • 5.5 Comment (86)
  • CHAPTER 6.CONCLUSION AND IMPROVEMENT (87)
    • 6.1 Conclusion (87)
    • 6.2 Improvement (87)

Nội dung

Introduction

In today's rapidly advancing technological landscape, personal robots are becoming essential tools, akin to PCs and mobile phones Autonomous robots, in particular, play a crucial role across various sectors such as industry, commerce, healthcare, and science, significantly enhancing productivity and replacing human labor in hazardous environments Their diverse applications contribute to the industrialization and modernization of societies worldwide As the popularity of robots grows, they exhibit a wide range of designs and operational methods, all aimed at assisting humans Autonomous robots utilize various navigation techniques, including barcode recognition, environmental imaging, and laser-scanning sensors, while addressing three fundamental challenges: determining their position, planning routes to navigate and avoid obstacles, and perceiving their surroundings through cognitive processes Despite the potential of self-propelled vehicles in Vietnam being limited due to technological access barriers, there is a pressing need to promote their development and application Consequently, a research team has chosen to focus on "Home Autonomous Vehicles Using Lidar Sensors" to deepen their knowledge and experience in advancing the field 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

The group conducted research on the hardware design of an indoor robot capable of carrying components arranged in a circular form for enhanced mobility To ensure accurate and smooth movement, it is essential that the robot's motors perform effectively under both loaded and unloaded conditions Initially, the team explored various controller options, including fuzzy, sliding, and PID controllers Ultimately, they selected the PID controller for its reliability and extensive use in industrial control systems.

The team researched the Robot Operating System (ROS) model and its application for their project, successfully setting it up on the Ubuntu operating system running on an embedded Raspberry Pi computer.

The team conducted research on utilizing lidar sensors for map scanning and configured the robot's axis through ROS They explored algorithms to determine the shortest path and enhance obstacle avoidance, subsequently validating their results.

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)

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

To enable robots to move effectively, they require three degrees of freedom in the Oxyz plane, which includes independent movement along the x and y axes, as well as rotation around the z-axis Achieving this necessitates a minimum of three Omni wheels, each equipped with independently controlled motors, as each motor facilitates control over one degree of freedom Using more than three wheels would result in non-linearly independent speed vectors, thereby constraining the robot's movement and limiting its degrees of freedom to three.

Figure 2-1: Three-wheel omni robot movement example

To enable a robot to move in all directions, a specialized wheel design is essential This design features a large wheel complemented by smaller wheels that are positioned tangentially to the large wheel and perpendicular to its axis Consequently, the omni wheel allows for movement in any direction parallel to the robot's axis.

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

Omni wheels offer enhanced maneuverability by enabling multidirectional movement without complex steering systems They can easily move forward, backward, sideways, and diagonally, making them exceptionally versatile for various applications.

Omni wheels enhance lateral movement by enabling smooth sidestepping and accurate positioning, making them ideal for applications that necessitate tight turns and agile lateral maneuvers.

Omni wheels allow vehicles and robots to rotate in place, significantly reducing their turning radius This capability enables quick and tight turns, making them ideal for maneuvering in crowded or confined spaces.

Normal wheels feature a straightforward design comprising a central hub and tire, facilitating easier manufacturing, maintenance, and repair This simplicity not only enhances usability but also results in lower costs compared to omni wheels.

Normal wheels provide enhanced stability thanks to their broader contact area with the ground, making them ideal for applications where maintaining balance and preventing tipping or tilting is crucial.

Omni wheels, while innovative, often suffer from reduced traction compared to traditional wheels Their unique design, featuring rollers or small wheels positioned at an angle, can lead to slippage and diminished grip, particularly on slippery or uneven surfaces.

Normal wheels offer limited maneuverability as they primarily facilitate movement in one direction This necessitates the use of additional steering mechanisms for turning, which can restrict movement in tight spaces and hinder precise lateral maneuvers.

Normal wheels restrict movement to a single direction, necessitating extra steering mechanisms for turning, which can hinder maneuverability in tight spaces and complicate precise lateral movements.

2.1.3 Compare omni 3 wheel with 4 wheels

Figure 2-5: Compare the efficiency of 3 wheels robot and 4 wheels robot

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

The addition of four wheels enhances the robot's stability, enabling it to effectively carry heavy loads This design allows for on-the-spot rotation, significantly improving maneuverability and facilitating navigation in tight spaces.

A three-wheel omni robot features a simpler mechanical structure than its four-wheel counterpart, leading to reduced manufacturing and maintenance costs.

Three-wheel omni robots are typically lighter than their four-wheel counterparts, leading to improved energy efficiency, extended battery life, and easier transportation Additionally, the weight distribution across the wheels enhances balance and minimizes the risk of tipping, making them effective for operation on rough terrains.

Four-wheel omni robots offer a greater maximum load capacity than three-wheel models, making them ideal for transporting bulky or heavy objects in various applications.

Having four wheels offers crucial redundancy, ensuring that a robot can maintain stability and continue functioning even if one or more wheels fail or become damaged.

ROS – Robot Operating System

The Robot Operating System (ROS) is a versatile software framework widely utilized in robotics research and development Originally created by Willow Garage and now overseen by Open Robotics, ROS has established itself as the industry standard for robot development.

ROS has a distributed architecture, allowing robot components to communicate with each other through message passing This creates a convenient environment for developing, testing, and integrating robot functionalities

ROS offers a rich ecosystem of software packages, including libraries, tools, and utilities that greatly assist in 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

The Robot Operating System (ROS) boasts a vibrant and active user community that fosters the sharing of open knowledge This engaged community readily provides access to software packages, tutorials, and shared experiences, allowing users to swiftly adopt and implement the latest technologies in their projects.

ROS has emerged as a crucial tool in robotics research and development due to its flexibility and convenience, enabling seamless interaction among robot components This system empowers developers to concentrate on creating specific functionalities without the need to recreate fundamental processes With its substantial influence and ongoing development potential, ROS is instrumental in driving the progress of robotics technology.

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, …

The ROS community is a dynamic network of developers, researchers, and robotics enthusiasts dedicated to enhancing the Robot Operating System This vibrant community plays a crucial role in the advancement of ROS by creating packages, sharing code, offering support, and collaborating on various projects Their collective efforts significantly contribute to the continuous improvement and innovation within the ROS ecosystem.

Filesystem in ROS mainly consists of resources executed in system storage memory, including:

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

Figure 2-9: Package structure in ROS

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

In ROS, a Stack refers to a collection of packages that are combined to serve a specific function Each Stack has its own purpose, and the details about these Stacks are stored in Stack Manifests.

Figure 2-10: Stack structure in ROS

Message types refer to the structured format used for communication between processes, specifically stored in my_package/msg/myMessagetype.msg Each message defines the data structure necessary for the effective exchange of information.

The Computation Graph serves as a network that interconnects processes within the Robot Operating System (ROS), allowing any node in the system to access and interact with other nodes while exchanging data Key components of the Computation Graph include nodes, the Master, the Parameter Server, messages, services, topics, and bags, which collectively facilitate efficient communication and data management in ROS.

A node represents a distinct process for computation and control within a system, and it is created upon the successful compilation of a package Multiple nodes can exist within a single package, each fulfilling a unique function For nodes to communicate and interact with one another, they must connect to the ROS network.

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

The ROS Master serves as a crucial coordination hub in a computation graph, allowing nodes to discover each other, exchange messages, and call services efficiently Without the ROS Master, effective communication and interaction between nodes would be impossible.

The Parameter Server enables centralized storage of data using keywords, facilitating the configuration of nodes either during operation or to alter their behavior It serves as a mechanism for storing and retrieving configuration parameters, empowering nodes to access and update shared data in real-time.

Messages are a straightforward data structure comprising defined fields such as integers, floating points, and Booleans They can incorporate nested structures and arrays, akin to C structs Users have the flexibility to create custom message types derived from standard messages, enabling them to tailor message structures to meet specific application needs.

In the Robot Operating System (ROS), services are essential for enabling request/reply communication, particularly in distributed systems where the publish/subscribe model may fall short Services consist of two data structures: one for the request and another for the reply, allowing for structured interaction A node offers a service through a named interface, while a client interacts with this service by sending a request message and awaiting a response This mechanism supports synchronous and bidirectional communication between nodes, effectively facilitating the request/reply pattern within ROS.

SLAM

2.3.1 Introduce to SLAM (Simultaneous localization and mapping)

Simultaneous Localization and Mapping (SLAM) is a key technique in robotics that allows robots to navigate and create real-time maps of their environment Within the Robot Operating System (ROS), numerous SLAM algorithms and packages leverage sensor data for effective localization and mapping These advanced algorithms empower robots to operate autonomously, understand their surroundings, and generate precise maps essential for navigation and planning.

Hector SLAM utilizes laser or distance sensors to create a point cloud, which generates 2D or 3D representations of the surrounding environment This high-precision data is essential for producing accurate maps, enhancing the SLAM (Simultaneous Localization and Mapping) process.

Lidar is an essential sensor for indoor robotics, enabling accurate map building and autonomous navigation By employing a laser-based SLAM system, it measures distances and tracks changes in the lidar's position by comparing point clouds over time, ensuring precise localization within the generated map The high accuracy and low error rates of lidar-generated maps make them ideal for effective localization and navigation.

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

A laser range finder, also known as a lidar sensor, is essential for delivering precise distance measurements, crucial for obstacle detection and mapping This technology enables robots to effectively perceive their environment and navigate safely, minimizing the risk of collisions.

An Inertial Measurement Unit (IMU) sensor, comprising accelerometers and gyroscopes, is essential for determining a robot's orientation and angular velocity This critical data enhances sensor fusion and ensures precise localization of the robot.

To ensure effective movement and navigation, robots must be equipped with actuators, including motor controllers and servos, which respond to velocity commands generated by the Navigation stack These essential components allow the robot to maneuver through its environment seamlessly.

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-11: Navigation stack model in ROS [5]

The Costmap 2D package generates a detailed cost map by integrating environmental sensor data, effectively storing information about obstacles and areas that are inaccessible to robots By utilizing data from a pre-built map, the Costmap 2D continuously updates the costmap to reflect current obstacle information, ensuring safe navigation for robotic systems.

The costmap illustrates varying levels of cost, or "inflation," surrounding obstacles, which signifies the difficulty a robot faces when navigating these regions These cost values are essential for the robot's navigation algorithm, enabling it to plan optimal paths that steer clear of obstacles while favoring 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 is essential for robots to plan efficient paths to target locations on a map, particularly over long distances This algorithm evaluates the entire map, calculating an optimal route that considers obstacles and the desired destination By planning the path in advance, global navigation allows for adjustments in response to environmental changes, enabling robots to effectively reach distant targets.

Local navigation is essential for robots as it creates pathways in their immediate environment, facilitating short-distance travel and obstacle avoidance By utilizing real-time sensor data from devices like laser range finders, local navigation algorithms generate routes that steer clear of obstacles while guiding the robot toward its destination This capability allows robots to swiftly respond to their surroundings and make necessary adjustments, ensuring safe and unobstructed 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 determines the maximum distance for sensor readings and obstacle updates in the costmap When a robot detects an obstacle within this range, it marks it in the costmap As the robot navigates, it can clear and refresh the costmap to reflect free space Updates can be made using values from the laser data on the obstacle's surface without needing to identify the entire obstacle, enabling effective map construction.

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 graph theory search algorithm designed to identify the shortest path from a starting vertex to a goal vertex It employs a heuristic function to estimate the distance, enhancing the efficiency of the search process.

A* algorithm generates all potential paths by utilizing a heuristic function tailored to the specific problem, ensuring the evaluation of the most efficient route When a shortest path exists, A* guarantees its identification.

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

- 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

In this example, we analyze point P(0,0), which has two neighboring points: P(1,0) to the right and P(0,1) below The function value at these points is f(x) = g(x) + h(x) = 3.2 Given that both values are equal, we can choose either point; for this analysis, we select point P(1,0) in Step 2.

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) = 5.2, and P(1,1) = 4.8

The value of P(2,0) is approximately 8.6, making it the next point for evaluation Continuing with the same methodology, we generate the image table displayed above.

After reach the △, we have the shortest path below:

Figure 2-16: 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 efficiently determines the best control signal for robot navigation, enabling safe and swift movement towards a predetermined destination It operates through two key steps: first, it narrows down the velocity search space, and then it identifies the optimal velocity within that refined range.

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 are crucial for ensuring a robot can navigate safely by avoiding obstacles A velocity pair (v, w) is deemed feasible if the robot can halt before reaching the nearest obstacle along its trajectory, thereby preventing collisions.

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

The minimum stopping distance, denoted as dist v, is the shortest distance at which a robot can halt before colliding with an obstacle Additionally, v b and ω b represent the maximum permissible acceleration for the robot's linear and rotational velocities, ensuring safe movement without collision.

Figure 2-17: Allowed velocity Va in DWA

The dynamic window is a crucial concept in robotics, representing the overlap between a robot's feasible velocities and the allowable velocities in its search space This window is determined by constraining both linear and angular velocities to a feasible range, taking into account the robot's dynamic limitations, including maximum acceleration and angular velocity.

Figure 2-18: 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 achieve this, the following steps are performed:

The heading of a robot signifies its progress towards a destination, achieving maximum value when the robot moves directly towards it The heading value, denoted as ℎ𝑒𝑎𝑑𝑖𝑛𝑔(𝑣, 𝜔), is determined by the formula 180 − 𝜃, where 𝜃 represents the angle between the robot's current direction and the target destination.

Figure 2-19: Heading of robot in DWA

The function 𝑑𝑖𝑠𝑡(𝑣, 𝜔) measures the distance from the robot to the nearest obstacle along its curved trajectory A large value indicates an obstacle-free path, while a smaller value suggests a higher probability of encountering an obstacle, prompting the robot to navigate around it.

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

To achieve optimal performance, the coefficients 𝛼, 𝛽, and 𝛾 are carefully selected based on the robot's characteristics and its operating environment The algorithm identifies the optimal trajectory by maximizing the objective function, resulting in the best velocity parameters (𝑣, 𝜔).

UART (Universal Asynchronous Receiver-Transmitter) is a widely utilized protocol for serial communication between electronic devices, known for its simplicity and effectiveness It facilitates the transmission and reception of data, making it ideal for short-distance communication applications.

The UART protocol facilitates a bidirectional data link using two wires: a transmit line (TX) and a receive line (RX) It operates asynchronously, allowing data transmission without requiring a shared clock signal between connected devices.

The key characteristics of the UART protocol:

- Start Bit: A UART transmission begins with a start bit, which is always a low logic level (0) It indicates the start of a new data frame

In UART communication, the data bits follow the start bit and can vary in number from 5 to 8, based on the configuration These data bits are crucial as they convey the actual information being transmitted.

A parity bit can be added after data bits to facilitate error detection, using either odd or even parity depending on the count of logic high bits This mechanism enables the receiver to verify if any errors occurred during transmission.

- Stop Bit: After the data and optional parity bits, the UART protocol concludes each frame with one or more stop bits The stop bit(s) is always a high logic level

(1) It provides a buffer period before the next start bit

Control motor with PID algorithm

Figure 2-22: PID controller for system

PID, or Proportional-Integral-Derivative, is a widely utilized control algorithm in engineering and industrial applications such as temperature regulation, motor speed control, robotics, and flow management This algorithm stabilizes processes by continuously adjusting control parameters based on real-time feedback from the system The PID controller computes an error value, which is the difference between the desired setpoint and the actual output of the system.

There are three components of a PID controller:

Proportional (P) Control generates an output that is directly related to the error between the desired setpoint and the actual measured value by applying a gain factor (Kp) While this method effectively minimizes steady-state error, relying solely on proportional control can result in overshoot and instability.

- Integral (I) Control: The integral term considers the accumulated error over time

Integral control combines the error signal with a gain factor (Ki) to produce a control signal, effectively eliminating steady-state errors and addressing system disturbances and biases.

Derivative (D) Control measures the rate of change of error over time by applying a gain factor (Kd) to the derivative, which is then added to the control signal This approach not only anticipates future error trends but also mitigates rapid changes, minimizes overshoot, and enhances overall system 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 advancement of digital control systems necessitates the implementation of discrete-time controllers, making the PID control algorithm a popular choice for both computer and embedded system applications Each control step involves converting signals into the discrete-time domain.

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

2.6.2 Tunning PID parameters Ziggler – Nichols II

Tuning a PID controller for a control system can be achieved through several methods, including manual tuning, the Ziegler-Nichols II method, and software-assisted PID tuning The selection of the appropriate tuning method is influenced by the system's complexity and its specific requirements.

In this research, the method used for motor control is Ziggler Nichol II:

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 Kp value (Ku) at this point

Step 3: Measure the digital oscillation period (Tu):

- 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-2: 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

Low-pass Filter

A low-pass filter is an essential electronic component that permits low-frequency signals to pass while attenuating higher frequencies This filter acts as a gatekeeper, making it crucial in various applications such as audio systems, telecommunications, image processing, and control systems In audio, it eliminates high-frequency noise for clearer sound reproduction, while in telecommunications, it ensures efficient signal transmission In image processing, low-pass filters enhance image quality by smoothing out high-frequency noise Furthermore, they are vital in control systems, as they help maintain stability by filtering out high-frequency disturbances Overall, low-pass filters are indispensable tools in electronics and signal processing, allowing for the optimization of signals to meet specific needs.

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

Overview robot hardware

3.1.1 General diagram of the system

A self-driving 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

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

Figure 3-3: Wiring diagram of robot base

The wiring configuration for the robot base involves connecting the Arduino to the motors via the L298N driver The motors are equipped with two wires, C1 and C2, which serve as encoder signals to provide feedback to the Arduino, enabling the creation of a closed-loop control system.

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

Connecting an Arduino to a Raspberry Pi or integrating a Raspberry Pi with a Lidar sensor is straightforward To establish the connection, use a USB cable to link the Arduino to the Raspberry Pi, while the Lidar sensor requires a Micro USB cable for its connection.

Design robot frame

The robot features a compact polygonal design measuring 25x25cm and is equipped with four omni wheels arranged at right angles, enhancing its kinematic capabilities This configuration allows for precise distance measurements to obstacles in all directions, enabling the robot to navigate through tight spaces and efficiently avoid obstacles.

The base frame of the robot, depicted in Figure 3-5, houses essential components such as the Arduino, driver, and motors that facilitate the robot's movement Detailed specifications regarding the dimensions of this base will be provided in the following sections.

Figure 3-6: Technical parameters of layer 1 This layer also designed with many holes to fix the components and three hole in the middle is used to for wiring purpose

On layer 2, are designed to contain PC (raspberry) and raspberry’s power supply to work and send the command to controller at layer 1 Layer 2 has the same size with layer 1

Layer 3 is exclusively dedicated to Lidar sensors, which necessitate ample space to function effectively without interference from any obstructive components This design guarantees that the sensor maintains a clear and unobstructed view, enabling precise perception of the surrounding environment Additionally, Layer 3 shares the same dimensions as Layer 1.

Figure 3-9: Full robot frame The overview of robot design after assembly in 3D model

Figure 3-10: Practical robot model The complete design and assemble of the robot model in realife.

Devices used in the project

Design motor bracket for robot to make it more solid with adding two small triangular brackets

This used to connect layers of robot together

3.3.3 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 dX(mm)

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

Figure 3-13: 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

P 1 is the gravitational force that the wheel is carried 1

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 applications requiring low-speed and non-high-performance motion, a DC motor with excellent load-bearing capacity and cost-effectiveness is essential The JGB-520 178rpm Encoder DC motor stands out as an ideal option for such needs.

The quadrature encoder features two output channels, A and B, which are phase-shifted to determine motor rotation The manufacturer specifies the number of pulses per revolution, while the phase relationship between channels A and B indicates the direction of the motor's rotation, with channel A leading or lagging channel B.

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

Figure 3-15: Last motor is suitable for robot

Due to the low budget, the group decided to choose the Raspberrypi 4 2GB

The Raspberry Pi 4 features significant enhancements in processor speed, multimedia capabilities, memory, and connectivity over previous models, all while maintaining backward compatibility and similar power consumption This model delivers desktop performance that rivals entry-level x86 PC systems.

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

This product boasts a powerful 64-bit quad-core processor, supports dual-display output through two Micro HDMI ports, and delivers stunning visuals with up to 4K resolution It features hardware video decoding at 4Kp60, offers up to 4GB of RAM, and includes dual-band wireless connectivity (2.4/5.0 GHz), Bluetooth 5.0, Gigabit Ethernet, USB 3.0, and PoE capability for enhanced performance and versatility.

The Raspberry Pi 4 needs a 3.0A USB-C power supply due to its increased power demands If you already own a 3.0A-rated power supply, you can use a microUSB to USB-C adapter to connect your existing MicroUSB power supply to the Raspberry Pi 4.

The Raspberry Pi 4 replaces the standard HDMI port found in earlier models with two Micro HDMI ports, enabling dual monitor support To utilize this feature, a 4K60P Micro HDMI to HDMI cable is necessary, or two cables for simultaneous dual monitor operation.

To enable the robot's flexible movement indoors, it is essential to control the rotation direction, motor speed, and target position The electrical circuit must be designed to reverse the current direction and regulate the current intensity flowing through the motor for optimal performance.

Motor run forward Motor run reverse

Figure 3-17: Schematic diagram of H bridge

Controlling the switches S1, S2, S3, and S4 enables the alteration of current direction through the motor, facilitating a change in its rotation Selecting the appropriate H-bridge is essential for optimal motor control, which is why the L298N module has been chosen as the ideal H-bridge solution.

The L298N board is a versatile dual full-bridge motor driver IC, ideal for controlling DC motors It operates efficiently across a broad voltage range and supports a maximum current of 2A, making it particularly suitable for one-way DC motor control.

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

The chosen module effectively manages current and is ideal for controlling the robot system It has shown stable operation without overheating during use, ensuring reliability Furthermore, its cost-effective nature and ease of replacement enhance the robot's overall performance.

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

The Arduino™ Mega 2560 is a versatile microcontroller board featuring the ATmega2560, equipped with 54 digital I/O pins (14 of which support PWM outputs), 16 analog inputs, and 4 UARTs for serial communication It operates at 16 MHz and includes essential components like a USB interface, power connection, ICSP header, and a reset button To begin using the board, simply connect it to a computer via USB or power it with an AC/DC adapter or battery.

Figure 3-19: 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 technology measures distances to objects by emitting pulsed laser beams and detecting the reflected light with sensors By analyzing the time of flight and wavelength differences, it effectively calculates and constructs detailed object models.

Lidar technology is extensively utilized across multiple fields, including geology and archaeology, for generating digital maps and enhancing laser-based navigation systems A key application of Lidar in contemporary times is its integration into autonomous vehicles and self-driving robots, significantly advancing their operational capabilities.

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

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 enables the mapping of a robot's working area, utilizing omni wheels for versatile movement across various angles The ros_joystick package is ideal for this application, as it allows a joystick to transmit coordinate points to the robot Subsequently, the robot converts these points into a polar coordinate system, with the joystick's plane axis set at (50,50).

Ox robot speed and angle

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

After the robot receives data on set speed and angle, it only reflects the overall velocity rather than the individual motor speeds To achieve the specific velocities for each wheel, a conversion step is necessary At this point, a PID controller is implemented to ensure that the motors operate at the intended setpoint.

Lowpass Filter e4 u4 v4_filt Figure 4-4: PID diagram

The Raspberry Pi transmits the designated speed command to the Arduino, which then translates this data into four distinct motor speed settings Subsequently, the robot employs a PID controller to maintain the speed at the accurate setpoint.

• The sampling frequency: fs = 1 kHz

 = f = From (2.25), the equation will be:

= +  − + +  + +  − (4.2) Substitude the parameter with cut off frequency fs = 20 Hz

Integrate system in ROS

Mapping the environment is essential for mobile robotics, as it allows robots to autonomously navigate unknown spaces By creating a map, robots can determine their position, plan efficient paths, identify destinations, and execute tasks effectively This capability is crucial for enhancing the operational efficiency of autonomous robots in various applications.

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

The "hector_slam" package on the ROS platform utilizes odometry data and a laser sensor to create real-time maps This essential tool facilitates the generation of static maps, allowing robots to navigate autonomously within their surroundings.

Figure 4-5: Build a static map from laser

Hector SLAM employs a grid map model to effectively represent the environment, with each grid cell corresponding to a section measured by a laser sensor The algorithm enhances the map's quality through advanced smoothing and interpolation techniques.

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

In the scan matching process, the robot utilizes data from Lidar to create a map in Rviz, optimizing the alignment of previously drawn points with newly scanned points to minimize occupancy values.

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

Once you've navigated the environment and generated the optimal map, you can save it using the terminal command: rosrun map_server map_saver [-f mapname].

In this process, "mapname" refers to the designated title for the map Upon saving, two files are generated: a pgm format image file and a YAML file containing supplementary details about the saved map.

The image file illustrates the environmental layout, where white pixels indicate unoccupied space, black pixels signify occupied areas like walls and obstacles, and gray pixels denote regions that the robot has yet to explore.

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

Accurate and safe navigation for vehicles, essential for avoiding obstacles, relies on the use of sensors to collect environmental data One key sensor utilized in this process is Lidar, which helps the vehicle effectively navigate its path and detect potential obstacles.

Using odometry data and the Map Server, we direct the robot towards specific target points with a pre-determined path generated by the A* algorithm In the event of obstacles, the robot will dynamically re-plan its route to the destination Control information, such as linear and angular velocities, is communicated via UART for effective motor control Detailed parameter setup instructions can be found in the Appendix.

AND RESULTS

Survey PID controller parameter

To calculate the proportional gain (Kp), integral gain (Ki), and derivative gain (Kd) using the Ziegler-Nichols II method, there are some several step to follow:

After increase the Kp up to 6.6845, the given values: Ku = 6.6845; Tu = 4 ms

Substitute the values of Ku and Tu to obtain:

After calculate the PID parameters and apply to the Arduino code to run Forward, the speed of the robot will show as follow:

Figure 5-1: Original speed vector and Robot’s forward movement

V2 and V3 go to the opposite direction in comparison of its original, V1 and V4 keep the same direction while moving forward

Figure 5-2: Motor 1’s speed without filter

To calculate the proportional gain (Kp), integral gain (Ki), and derivative gain (Kd) using the Ziegler-Nichols method, there are some several step to follow:

After increase the Kp up to 6.6845, the given values: Ku = 5.9842; Tu = 4 ms

Substitute the values of Ku and Tu to obtain:

After calculate the PID parameters and apply to the Arduino code, the speed of the robot will show as follow:

Figure 5-3: Motor 2’s speed without filter

To calculate the proportional gain (Kp), integral gain (Ki), and derivative gain (Kd) using the Ziegler-Nichols method, there are some several step to follow:

After increase the Kp up to 6.6845, the given values: Ku = 5.411268; Tu = 3 ms

Substitute the values of Ku and Tu to obtain:

After calculate the PID parameters and apply to the Arduino code, the speed of the robot will show as follow:

Figure 5-4: Motor 3’s speed without filter

To calculate the proportional gain (Kp), integral gain (Ki), and derivative gain (Kd) using the Ziegler-Nichols method, there are some several step to follow:

After increase the Kp up to 6.6845, the given values: Ku = 5.411268; Tu = 3 ms

Substitute the values of Ku and Tu to obtain:

After calculate the PID parameters and apply to the Arduino code, the speed of the robot will show as follow:

Figure 5-5: Motor 4’s speed without filter

In the omni wheel model, motors 2 and 3 operate with a negative setpoint of -100 rpm, while all other motors maintain a set speed of 100 rpm This configuration highlights the unique dynamics of the system, emphasizing the distinct operational parameters for each motor.

All four motors exhibit a settling time of approximately 50 milliseconds, achieving full stability within 100 milliseconds, which ensures high accuracy in the movement of the mobile robot.

Although the robot applied PID controller but the speed feedback still oscillate wildly eventhough at the steady state.

Low-Pass Filter

Figure 5-7: Default Frequency Resolution for Motor 1

Figure 5-8: Default Frequency Resolution for Motor 2

Figure 5-9: Default Frequency Resolution for Motor 3

Figure 5-10: Default Frequency Resolution for Motor 4

Base on four figures above, the system started to fluctuate so the cut off frequency should be 20 Hz

Substitute the parameter with cut off frequency fs = 20 Hz and  t = 0.001(s):

5.2.2 The result of motor’s speed after applying lowpass filter

Four figures below is to survey four motors speed while applying PID and Lowpass Filter

Figure 5-11: Speed of motor 1 after applying filter

Figure 5-12: Speed of motor 2 after applying filter

Figure 5-13: Speed of motor 3 after applying filter

Figure 5-14: Speed of motor 4 after applying filter

After using the lowpass filter, the graph line improved significantly in which all four lines have no more fluctuation when its reach the steady state

Figure 5-15: Full robot’s speed after apply filter

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-16: Omni robot base running with angle = 63.435 o

In this survey, we will verify the accuracy of the omni-wheel algorithm when using an omni-wheel The robot will be moved at an angle of arctan (4/2) = 63.435 o

Figure 5-17: 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-18: Clone the git into the Raspberry

Figure 5-19: Type catkin_make command

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

• Run the command roslaunch to launch the hector_slam package

Figure 5-21: Map on Rviz After run the command above, it will open the Rviz panel

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

Figure 5-23: Robot navigate and avoid obstacle

After acquiring the map from Hector SLAM, the team implemented the A* pathfinding algorithm, designating a destination point and the robot's rotation angle on the saved map The robot was then directed to navigate to this specified point Upon arrival, the team assessed the robot's position and rotation angle against the expected values on the map.

Survey running with two obstacles:

Figure 5-24: Running to a position behind the second object

In this survey, the DWA algorithm enables the robot to perceive only the initial obstacle, prompting it to generate a global planner (indicated by the green line) to navigate around it However, the robot remains unaware of the presence of a second obstacle.

Figure 5-25: Robot see the second object After avoid first obstacle, robot has seen the second one Therefore, in the map has update the map with new obstacle (grey cloud)

Figure 5-26: Robot create local planner to avoid obstacle

Finally, robot has created a local planner (purple line) to avoid the obstacle and go to the target point.

Comment

The PID controller is designed for a robot with high stability Additionally, parameters such as settling time, overshoot, and steady-state error are adjusted appropriately according to the robot's responsiveness

In the testing phase, the robot effectively navigated to its designated target by employing an algorithm designed for shortest path optimization across diverse scenarios The research team noted its stable performance, as the robot consistently fulfilled the movement requirements for various points and directions, even in environments with interference It adeptly managed the conditions and complied with the modified parameters.

However, after each movement, the robot's rotation angle had a slight deviation due to the accumulated error from the encoder.

AND IMPROVEMENT

Conclusion

The research team has successfully developed a robot that can map its surrounding environment and navigate effectively using data processed from a lidar sensor, following the design of the hardware and the establishment of the ROS platform.

The team has successfully designed a compact robot frame optimized for indoor navigation, featuring a stable control circuit that enables flexible movement throughout the home However, the robot's relatively tall height may hinder its ability to detect obstacles below the lidar's scanning range, increasing the risk of potential collisions.

The team's experiments demonstrate that the robot's mapping capability produces maps that closely resemble the actual environment However, limitations exist due to the use of a Raspberry Pi with only 2 GB of memory, leading to challenges in map collection caused by memory overflow Additionally, the robot's mapping range is restricted; if it moves too far, it risks losing connection and failing to accurately map its surroundings.

The robot's obstacle avoidance capability is significantly enhanced by its use of omni wheels, allowing it to effortlessly navigate around both static and dynamic obstacles This advanced feature ensures effective obstacle avoidance, improving the robot's overall navigation performance.

The research team has achieved notable advancements in hardware design, ROS integration, and mapping and navigation functionalities Nonetheless, challenges remain, particularly in memory management for map collection and the need to extend the scanning range for effective mapping.

Improvement

To enhance the robot's optimization, stability, and performance across diverse environmental conditions for commercial viability, the team must focus on advancing several key areas of development.

Enhance the hardware design to ensure robustness, compactness, aesthetics, and better load-bearing capacity, allowing for transportation of goods or personal belongings for users

Integrate internet-based remote control applications to allow users to effortlessly manage the robot using a laptop, tablet, or smartphone Furthermore, the team should focus on researching and developing interactive features that enhance the user-robot experience through an intuitive control interface.

Increase the robot's scanning and mapping capabilities This involves improving the speed of movement while maintaining the highest possible accuracy

Improve obstacle avoidance and navigation capabilities to enable the robot to navigate around obstacles and reach the destination quickly and accurately

By concentrating on these key areas, the team can significantly improve the robot's performance, functionality, and user experience, thereby increasing its commercial viability and catering to the varied requirements of users across different settings.

[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

Bài viết của 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," đăng trong tạp chí khoa học công nghệ giao thông vận tải số 27 + 28 năm 2018, trình bày về phương pháp hoạch định và bám đường cho robot di động Nghiên cứu này tập trung vào việc ứng dụng điều khiển nối tiếp ảnh để cải thiện khả năng tự động hóa và độ chính xác trong việc di chuyển của robot.

[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,

[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,

// globals long prevT1 = 0; int posPrev1 = 0; float preve1; long prevT2 = 0; int posPrev2 = 0; float preve2; long prevT3 = 0; int posPrev3 = 0; float preve3; long prevT4 = 0; int posPrev4 = 0; float preve4;

// Set a target float vt1; float vt2; float vt3; float vt4; float v;

// Use the "volatile" directive for variables

The article discusses the use of volatile variables in an interrupt-driven system, specifically for tracking positions and velocities of multiple inputs (pos_i1 to pos_i4 and velocity_i1 to velocity_i4) It highlights the importance of maintaining previous timestamps (prevT_i1 to prevT_i4) for accurate calculations Additionally, it introduces various filtering mechanisms (vFilt, vFiltt) to stabilize velocity readings and integrate error calculations (e, eintegral, and derivatives) for improved control The content also mentions parameters related to distance, speed, angles, and wheel positions (wheel1t to wheel4t), emphasizing their roles in the overall system performance.

// Handles startup and shutdown of ROS ros::NodeHandle nh;

To monitor wheel ticks, we utilize std_msgs::Float32 for omni_speed, omni_distance, and omni_angle Three publishers are created: pub_speed for omni_speed, pub_angle for omni_angle, and pub_dis for omni_distance A geometry_msgs::Twist message, cmd_vel_msg, is also defined, and a callback function, cmdVelCallback, processes incoming geometry_msgs::Twist messages.

} ros::Subscriber cmd_vel_sub("/cmd_vel",

In the setup function, various pins are configured for input and output, including encoder inputs (ENCA1 to ENCA4 and ENCB1 to ENCB4) and PWM outputs (PWM1 to PWM4) Additionally, control pins (IN1 to IN8) are set as outputs The code also establishes interrupts for each encoder input, enabling the system to respond to rising signals from the encoders, which is crucial for accurate motion control.

// ROS Setup nh.getHardware()->setBaud(57600); nh.initNode(); nh.advertise(pub_speed); nh.advertise(pub_angle); nh.advertise(pub_dis); nh.subscribe(cmd_vel_sub);

// read the position in an atomic block

// to avoid potential misreads pos1 = 0; pos2 = 0; pos3 = 0; pos4 = 0;

ATOMIC_BLOCK(ATOMIC_RESTORESTATE){ pos1 = pos_i1; pos2 = pos_i2; pos3 = pos_i3; pos4 = pos_i4;

To compute velocity using method 1, record the current time at four intervals using the `micros()` function Calculate the time differences for each interval by subtracting the previous time values from the current time values, then convert these differences into seconds by dividing by 1.0e6 The resulting time intervals, `deltaT1`, `deltaT2`, `deltaT3`, and `deltaT4`, will provide the necessary data for further velocity calculations.

//Serial.print (deltaT1);Serial.print(deltaT2);Serial.println(deltaT3); float velocity1 = (pos1 - posPrev1)/deltaT1; float velocity2 = (pos2 - posPrev2)/deltaT2; float velocity3 = (pos3 - posPrev3)/deltaT3; float velocity4 = (pos4 - posPrev4)/deltaT4;

//Serial.print(velocity1);Serial.println(velocity3); posPrev1 = pos1; posPrev2 = pos2; posPrev3 = pos3; posPrev4 = pos4; prevT1 = currT1; prevT2 = currT2; prevT3 = currT3; prevT4 = currT4;

// Convert count/s to RPM float v1 = velocity1/616.0*60; float v2 = velocity2/616.0*60; float v3 = velocity3/616.0*60; float v4 = velocity4/616.0*60;

// Low-pass filter (25 Hz cutoff) v1Filt = 0.854*v1Filt + 0.0728*v1 + 0.0728*v1Prev; v1Prev = v1; v2Filt = 0.854*v2Filt + 0.0728*v2 + 0.0728*v2Prev; v2Prev = v2; v3Filt = 0.854*v3Filt + 0.0728*v3 + 0.0728*v3Prev; v3Prev = v3; v4Filt = 0.854*v4Filt + 0.0728*v4 + 0.0728*v4Prev; v4Prev = v4;

In this control signal computation, the parameters are defined as follows: for the first set, the proportional gain (kp1) is 2.4064, integral gain (ki1) is 9.6228, and derivative gain (kd1) is 0.6038; for the second set, kp2 is 2.1543, ki2 is 8.5818, and kd2 is 0.5382; the third set has kp3 at 2.0626481, ki3 at 10.313734, and kd3 at 0.3666; while the fourth set mirrors the third with kp4 at 2.0626481, ki4 at 10.313734, and kd4 at 0.3666 The error values are calculated as the difference between the target voltages (vt) and the filtered voltages (vFilt), specifically e1 equals vt1 minus v1Filt, e2 equals vt2 minus v2Filt, e3 equals vt3 minus v3Filt, and e4 equals vt4 minus v4Filt.

// Compute the integral term eintegral1 = eintegral1 + e1 * deltaT1; eintegral2 = eintegral2 + e2 * deltaT2; eintegral3 = eintegral3 + e3 * deltaT3; eintegral4 = eintegral4 + e4 * deltaT4;

To compute the derivatives for control signals, the following calculations are performed: derivative1 is determined by the difference between e1 and preve1 divided by deltaT1, and similarly for derivative2, derivative3, and derivative4 The updated control signals are calculated using the formulae: u1 equals kp1 multiplied by e1 plus ki1 multiplied by eintegral1 plus kd1 multiplied by derivative1; u2, u3, and u4 are computed in the same manner for their respective variables Finally, the previous error values are updated to the current error values for e1, e2, e3, and e4.

// Set the motor 1 speed and direction dir1 = 1; if (u1 < 0) { dir1 = -1;

} int pwr1 = (int) fabs(u1); if (pwr1 > 255) { pwr1 = 255;

// Set the motor 2 speed and direction dir2 = 1; if (u2 < 0) { dir2 = -1;

} int pwr2 = (int) fabs(u2); if (pwr2 > 255) { pwr2 = 255;

// Set the motor 3 speed and direction dir3 = 1; if (u3 < 0) { dir3 = -1;

} int pwr3 = (int) fabs(u3); if (pwr3 > 255) { pwr3 = 255;

// Set the motor 4 speed and direction dir4 = 1; if (u4 < 0) { dir4 = -1;

} int pwr4 = (int) fabs(u4); if (pwr4 > 255) { pwr4 = 255;

} omni(); if (v0==0) calculate_s(speed, v1, v2, v3, v4, deltaT1); tinhtoan_quangduong_di(speed,angle); omni_speed.data=float(vFilt * 54.2 / 600000); omni_angle.data=float(angle); omni_distance.data=float(distance); // *45/7/1.2533

// pub_speed.publish(&omni_speed);

// pub_angle.publish(&omni_angle);

The code snippet efficiently publishes updates for distance, speed, and angle only when changes are detected, ensuring optimal performance It checks if the filtered velocity, angle, or distance has changed and publishes the corresponding values if they have Additionally, it controls the motors by setting their direction and power levels through specific parameters for each motor.

// Positive angular velocity for clockwise turn around

} void setMotor(int dir, int pwmVal, int pwm, int in1, int in2){ analogWrite(pwm,pwmVal); // Motor speed if(dir == 1){

// Turn one way digitalWrite(in1,HIGH); digitalWrite(in2,LOW);

// Turn the other way digitalWrite(in1,LOW); digitalWrite(in2,HIGH);

// Or dont turn digitalWrite(in1,LOW); digitalWrite(in2,LOW);

// Read encoder B when ENCA rises int b1 = digitalRead(ENCB1); int increment1 = 0; if(b1>0){

// If B is high, increment forward increment1 = 1;

// Read encoder B when ENCA rises int b2 = digitalRead(ENCB2); int increment2 = 0; if(b2>0){

// If B is high, increment forward increment2 = 1;

// Read encoder B when ENCA rises int b3 = digitalRead(ENCB3); int increment3 = 0; if(b3>0){

// If B is high, increment forward increment3 = 1;

// Read encoder B when ENCA rises int b4 = digitalRead(ENCB4); int increment4 = 0; if(b4>0){

// If B is high, increment forward increment4 = 1;

{ num *= 10000000; int num_temp = round(num); return num_temp /= 10000000;

} void tinhtoan_quangduong_di(int v, float degree)//degree integer number pls

{ vt1 = v * cos(3.14/4+degree)+v0; vt2 = v * sin(3.14/4+degree)*(-1)+v0; vt3 = v * cos(3.14/4+degree)*(-1)+v0; vt4 = v * sin(3.14/4+degree)+v0;

} void calculate_s(float s, float v1, float v2, float v3, float v4, float deltaT)

// v(rpm) v=sqrt(pow((abs(v1)+abs(v3))/2,2)+pow((abs(v2)+abs(v4))/2,2)); vFilt = 0.854*vFilt + 0.0728*v + 0.0728*vPrev; vPrev = v;

// distance(count) if (cmd_vel_msg.linear.x < 0) distance = distance - ((vFilt+vFiltPrev)/2 * deltaT) * 54.2 / 10000; else distance = distance + ((vFilt+vFiltPrev)/2 * deltaT) * 54.2 / 10000;

// {Serial.print("Vfilt: ");Serial.print(vFilt);Serial.print("\t");Serial.print("V:

");Serial.print(v);Serial.print("\t");Serial.print("Distance: ");Serial.print(deltad);

Serial.print("\t");Serial.print("speed: ");Serial.print(speed);

// Serial.print("\tTotal distance: ");Serial.println(distance);}

} void go(float d, float angle)

The calculation begins with determining the distance traveled, which is represented as `dis = d * 50` The function `tinhtoan_quangduong_di(speed, angle)` is then called to compute the necessary parameters The variable `deltad` is calculated by subtracting the current distance from `dis` If `deltad` exceeds 300, the speed is set to zero For `deltad` values between 250 and 300, the speed increases linearly based on the difference Similarly, if `deltad` is between 150 and 250, the speed is adjusted according to a different linear equation For `deltad` values between 50 and 150, the speed is modified again based on a specific formula, and if `deltad` is greater than 0, the speed is calculated to gradually increase from zero up to 50.

To calculate the speed and angle of a robot's movement based on velocity commands, we first determine the speed using the formula `speed = sqrt(cmd_vel_msg.linear.x^2 + cmd_vel_msg.linear.y^2) * 16` The angle is then set based on the values of `cmd_vel_msg.linear.x` and `cmd_vel_msg.linear.y`: if `linear.x` is non-negative and `linear.y` is zero, the angle is 1.57 radians; if `linear.x` is negative and `linear.y` is zero, the angle is -1.57 radians For positive `linear.y`, the angle is calculated using the arctangent function, and for negative `linear.y`, the angle is adjusted by adding π to the arctangent result.

{ if (cmd_vel_msg.linear.x > 0.3) speed=float(sqrt(cmd_vel_msg.linear.x*cmd_vel_msg.linear.x + cmd_vel_msg.linear.y

The speed is determined based on the linear velocity values from the cmd_vel_msg If the linear velocity in the y-direction is significant, the speed is calculated by multiplying it by 40 For positive linear velocity in the x-direction, the speed is set to 10, while for negative values, it is set to -10 If the linear velocity in the x-direction is less than -0.3, the speed is calculated using the square root of the sum of the squares of the linear velocities, also multiplied by 40 If none of these conditions are met, the speed defaults to 0 Additionally, the angle is derived from the negative value of the angular velocity from cmd_vel_msg.

{ if ((cmd_vel_msg.angular.z>0)&&(cmd_vel_msg.linear.x==0)) v0 = 0; else if ((cmd_vel_msg.angular.z

Ngày đăng: 28/12/2023, 18:50

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

TÀI LIỆU LIÊN QUAN

w