0% found this document useful (0 votes)
12 views

Line follower robot using ros report-

The document presents a project report on a line-following robot developed using the Robot Operating System (ROS) and Arduino, aimed at demonstrating basic robotic concepts. It details the methodology, components, circuit design, and results of the project, highlighting the integration of sensors and control algorithms for effective navigation. The project showcases the successful implementation of a ROS-based system that enhances the robot's capabilities for autonomous path following, setting a foundation for future advancements in robotics.

Uploaded by

soulful2502
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
12 views

Line follower robot using ros report-

The document presents a project report on a line-following robot developed using the Robot Operating System (ROS) and Arduino, aimed at demonstrating basic robotic concepts. It details the methodology, components, circuit design, and results of the project, highlighting the integration of sensors and control algorithms for effective navigation. The project showcases the successful implementation of a ROS-based system that enhances the robot's capabilities for autonomous path following, setting a foundation for future advancements in robotics.

Uploaded by

soulful2502
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 15

LINE FOLLOWING ROBOT USING ROS

MHC4372 ROBERTIC OPERATING SYSTEM

Submitted by
G. ANIRUDH 21130030
K. LOKESH 21130049
Under the guidance of
Ms. N. SEENU
in partial fulfilment for the award of the degree
of
Bachelor of Technology
in
MECHATRONICS

DEPARTMENT OF MECHATRONICS ENGINEERING


SCHOOL OF MECHANICAL SCIENCES
HINDUSTAN INSTITUTE OF TECHNOLOGY AND SCIENCE
PADUR - 603 103
MAY 2024
BONAFIDE CERTIFICATE

Certified that this project report titled LINE FOLLOWING ROBOT USING
ROS is the Bonafide work of Mr.G.ANIRUDH(21130030),
Mr.K.LOKESH(21130049) who carried out the project work under my
supervision during the academic year 2023-2024.

SIGNATURE
Ms. N. SEENU
SUPERVISOR
Department of Mechatronics Engineering,
Hindustan Institute of Technology and Science,
Padur,
Chennai-603103

INTERNAL EXAMINER EXTERNAL EXAMINER

Name: Name:

Designation: Designation:

Project Viva-voce conducted on


ACKNOWLEDGEMENT
First and foremost, we would like to thank the Lord Almighty for his presence and immense blessings
throughout the project work. It’s a matter of pride and privilege for me to express my deep gratitude to
the management of HITS for providing me the necessary facilities and support. We are highly elated in
expressing my sincere and abundant respect to the Vice-Chancellor Dr. S. N. Sridhara, for giving me this
opportunity to bring out and implement my ideas in this project. We wish to express my heartfelt
gratitude to Dr. S. JANAKI RAMAN, Professor and HoD (i/c), Department of Mechatronics Engineering
for much of his valuable support and encouragement in carrying out this work. We would like to thank
my guides, Dr. N. Seenu, Assistant professor, Department of Mechatronics Engineering for continually
guiding and mentoring us by giving valuable suggestions to complete the project work. Last, but not least,
my thanks and thanks additionally go to my partner in building up the venture and individuals who have
energetically gotten me out with their capacities. We are deeply indebted to my parents who have been
the greatest support throughout the project.

G. ANIRUDH (21130030)
K. LOKESH (211300349)
TABLE OF CONTENTS
CHAPTER TITLE PAGE
NO. NO.

1 INTRODUCTION 1

2 METHODOLOGY 2

3 COMPONENTS REQUIRED 3-4

4 CIRCUIT DIGRAM OF THE ROBOT 5

5 HARDWARE OF THE ROBOT 6

6 RESULT AND DISCUSSION 7

APPENDIX 8-10
I

TABLE OF FIGURES

FIG LIST OF FIGURES PAGE NO.


NO.

3(a) Wooden Pad/Base 3

3(b) Wheels 3

3(c) L298N Driver 3

3(d) Infrared Sensors: 3

3(e) Jumper Wires 4

3(f) Arduino Uno 4

3(g) Lithium Batteries 4

4(a) Circuit diagram 5

5(a) Hardware 6

II
CHAPTER 1

INTRODUCTION

A line follower robot is an autonomous machine designed to follow a visual line


embedded on the floor, typically painted or made with tape. These robots are widely used in
educational and industrial applications to demonstrate basic robotic concepts involving sensors
and motion control systems. Utilizing the Robot Operating System (ROS), a flexible
framework for writing robot software, can significantly enhance the capabilities and
performance of a line follower robot. ROS (Robot Operating System) is an open-source
middleware suite that provides libraries and tools to help software developers create robot
applications. It offers a structured communications layer over which various processes with
high-level capabilities such as hardware abstraction, low-level device control, implementation
of commonly-used functionalities, message-passing between processes, and package
management can be integrated.

Integrating ROS in the development of a line follower robot allows for sophisticated control
mechanisms, easier scalability, and reusability of code across various robotic projects. The use
of ROS enhances the robot's ability to perform complex tasks, makes debugging simpler, and
leverages the vast array of tools and community support available. Whether for educational
purposes, industrial applications, or research, a ROS-based line follower robot represents a
robust platform for exploring advanced robotics concepts. Through this report, we aim to
provide an overview of the line-following robot's architecture, the integration of ROS into its
development process, and the potential applications of such robots in various domains.

1
CHAPTER 2

METHODOLOGY

The hardware setup is the first step in the ROS and Arduino method of building a line-
following robot. This includes choosing a viable robot stage, like a differential drive or wheeled
robot, and introducing line location sensors, like infrared sensors, on the robot suspension.
Furthermore, the sensors and motors are interconnected with the Arduino microcontroller
board. Moving on to the software setup, the Arduino IDE is installed on the development
computer, and ROS serial communication libraries are configured to make it easier to
communicate with ROS. Joining is then accomplished by laying out bidirectional
correspondence among ROS and Arduino utilizing ROS sequential, trailed by the improvement
of ROS hubs to connect with the Arduino board. Implementing signal processing techniques to
interpret sensor data and incorporating control algorithms like PID to adjust motor speeds and
maintain alignment with the line are the next steps in the line-following algorithm design
process. At last, ROS hub execution involves making hubs to buy into sensor information
distributed by the Arduino, handling this information to produce control orders for the robot's
engines, and guaranteeing powerful mistake taking care of to successfully address startling
situations. The essential sensors utilized in a line supporter robot are commonly infrared (IR) or
ultrasonic sensors that distinguish the line on the floor. The ground is continuously scanned by
the sensors for contrast between the line and the floor around it. ROS topics are used to publish
sensor data. There may be a separate node for publishing sensor data for each sensor. ROS hubs
for sensor information help in reflection, where the information handling rationale is decoupled
from information assortment. The sensor data topics are subscribed to by a control system
node. In light of the information got (e.g., position of the line comparative with the robot), the
control framework processes the fundamental guiding orders to follow the line. The robot's
actuators, which are typically motors, receive instructions from the control system to alter the
robot's trajectory. ROS messages provide the actuators with instructions to maintain, increase
or decrease speed, or steer left or right. This methodology comprehensively outlines the
sequential steps involved in constructing a line-following robot, emphasizing hardware setup,
software integration, algorithm development, and ROS node implementation.

2
CHAPTER 3

Components Required

Wooden Pad/Base:
• Wooden plank is used as a base of the line follower robot.

Fig -3a

Wheels and Hobby Motors:


• Hobby motor and the particular wheels suitable with it are selected with the motor.

Fig-3b

L298N Driver:
• Motor driver module to control the speed and direction of the motors. Wheels: Pair of
wheels suitable for the chosen robot platform. Motor Mounts: Structures to securely attach
the motors to the robot's base.

Fig-3c
Infrared Sensors:
• Sensors capable of detecting the line on the surface.

3 Fig-3d
Jumper Wires:
• Used for connecting the sensors to the Arduino and other components.

Fig-3e

Arduino Uno:
• Microcontroller board responsible for processing sensor data and controlling motor
movements. Breadboard: Provides a convenient platform for prototyping and connecting
electronic components. Jumper Wires: Used for interconnecting components on the
breadboard and Arduino. Power Supply: Battery or external power source to supply power
to the Arduino and motors.

Fig- 3f

Lithium Batteries:
• Power source for the robot, providing the necessary voltage and current for operation.

Fig-3g

4
CHAPTER 4

CIRCUIT DIAGRAM OF THE ROBOT

Fig- 4a

We can observe in the circuit diagram that the four intermission pins of the motor driver are
connected to the digital pins of the Arduino, both output sides of motor driver are connected
to the dc motors, +12V input and -Ve are connected to battery, the +5V output is connected to
IR sensors and Arduino, the GND of IR sensors is connected to the GND of Arduino and
L298N motor driver and lastly the signal of IR sensor is connected to the digital pins of the
arduino.Under the robot, sensors like infrared or reflective optical sensors are shown in the
ROS line-following robot circuit diagram. These sensors detect the line on the surface and
send data to a ROS-interfaced microcontroller, typically an Arduino or Raspberry Pi. The
microcontroller processes sensor information to decide engine orders for following the line.
Based on these commands, motor driver circuitry controls the robot's motors, ensuring precise
line navigation. This mix with ROS considers progressed functionalities and execution of the
line-following robot.

5
CHAPTER 5

HARDWARE OF THE ROBOT

Fig- 5a

The hardware of the system consists of IR Sensors, wheels, motor drivers, dc hobby motors,
Arduino, and batteries. We connected the same side motors in series and connected the series
point to the motor driver on their respective sides, and we have connected IR sensors, Arduino,
motor driver based on the circuit diagram. The motor is controlled (connected to Arduino's
digital output pins for direction control) by connecting two sensors on the sides of the robot to
the analog input pins (VCC to 5V, GND to GND). Connected to the motor driver outputs
(positive wire to motor driver's 5V, negative wire to motor driver outputs). Think about
purchasing a separate battery pack for the motors (positive to the motor driver's Vin and negative
to GND).

6
CHAPTER 6

RESULT AND DISCUSSION

ROS (Robot Operating System) and Arduino were used in the design of the line-following
robot, which is now fully operational. Developed with a strong wooden base, it uses side interest
engines and wheels for development, driven by a L298N engine driver for successful impetus.
The line's path can only be detected and followed by strategically mounted infrared sensors on
the robot's chassis. These sensors associate with the Arduino microcontroller through jumper
wires, working with solid information transmission. The Arduino Integrated Development
Environment (IDE) is used to program the Arduino board. It is designed to use the ROS serial
libraries to communicate with ROS better. This significant incorporation takes into consideration
a consistent and proficient trade of information between the Arduino and ROS, laying out a
sound framework activity. At the heart of its navigation capabilities, the robot employs a custom-
developed line-following algorithm that incorporates PID (Proportional, Integral, Derivative)
control. This algorithm intelligently processes the input received from the infrared sensors to
continually adjust the motor speeds. Such adjustments ensure the robot remains aligned with the
line, compensating dynamically for any deviations detected during its movement. On the ROS
side, specific nodes are dedicated to subscribing to the sensor data relayed from the Arduino.
These nodes are responsible for processing the incoming data and subsequently generating
appropriate motor control commands. The system is designed with robust error handling
mechanisms, which significantly enhance the robot’s reliability and performance across a variety
of operational scenarios. In conclusion, this line-following robot exemplifies the successful
integration of ROS and Arduino, achieving autonomous path following with high precision and
stability. This accomplishment not only marks a significant milestone in robotic design but also
sets a solid foundation for further exploration and experimentation in the field of robotics. By
leveraging the modular and scalable nature of both ROS and Arduino, future enhancements and
additional functionalities can be easily integrated, paving the way for more sophisticated robotic
applications.

7
APPENDIX
#include <ros.h>
#include <std_msgs/String.h>

ros::NodeHandle nh;

const int irPin1 = 2;


const int irPin2 = 4;

const int ledPin = 13; // LED pin

std_msgs::String str_msg;
ros::Publisher ir_pub("/ir_state", &str_msg);

void movCallback(const std_msgs::String& cmd_msg) {


String command = cmd_msg.data;

if (command == "forward") {
digitalWrite(7, 0);
digitalWrite(8, 1);
digitalWrite(9, 0);
digitalWrite(10, 1);
} else if (command == "right") {
digitalWrite(7, 0);
digitalWrite(8, 0);
digitalWrite(9, 0);
digitalWrite(10, 1);
} else if (command == "left") {
digitalWrite(7, 0);
digitalWrite(8, 1);
digitalWrite(9, 0);
digitalWrite(10, 0);
} else if (command == "cright") {
digitalWrite(7, 0);
digitalWrite(8, 0);
digitalWrite(9, 0);
digitalWrite(10, 1);
} else if (command == "cleft") {
digitalWrite(7, 0);
digitalWrite(8, 1);
digitalWrite(9, 0);
digitalWrite(10, 0);
} else if (command == "sright") {
digitalWrite(7, 0);
digitalWrite(8, 0);
digitalWrite(9, 0);
digitalWrite(10, 1);
} else if (command == "sleft") {
digitalWrite(7, 0);
digitalWrite(8, 1);
digitalWrite(9, 0);
digitalWrite(10, 0);
8
} else if (command == "mright") {
digitalWrite(7, 0);
digitalWrite(8, 0);
digitalWrite(9, 0);
digitalWrite(10, 1);
} else if (command == "mleft") {
digitalWrite(7, 0);
digitalWrite(8, 1);
digitalWrite(9, 0);
digitalWrite(10, 0);
} else if (command == "stop") {
digitalWrite(7, 0);
digitalWrite(8, 0);
digitalWrite(9, 0);
digitalWrite(10, 0);
} else {
digitalWrite(7, 0);
digitalWrite(8, 0);
digitalWrite(9, 0);
digitalWrite(10, 0);
digitalWrite(11, 0);

}
}

ros::Subscriber<std_msgs::String> sub("mov_state", &movCallback);

void setup() {
pinMode(irPin1, INPUT);
pinMode(irPin2, INPUT);

pinMode(ledPin, OUTPUT);

pinMode(7, OUTPUT);
pinMode(8, OUTPUT);
pinMode(9, OUTPUT);
pinMode(10, OUTPUT);

nh.initNode();
nh.advertise(ir_pub);
nh.subscribe(sub);
}

void loop() {
int irState1 = digitalRead(irPin1);
int irState2 = digitalRead(irPin2);

if (irState1 && irState2 ) {


str_msg.data = "00";
} else if (!irState1 && irState2 ) {
str_msg.data = "01";
} else if (!irState1 && !irState2 ) {
str_msg.data = "10"; 9
} else if (!irState1 && !irState2 ) {
str_msg.data = "11";

ir_pub.publish(&str_msg);
nh.spinOnce();

// Wait for incoming messages from ROS


delay(100);
}

For creating node in python


#!/usr/bin/env python3

import rospy
from std_msgs.msg import String

def ir_state_callback(msg):
if msg.data == "00":
led_pub.publish("forward")
elif msg.data == "01":
led_pub.publish("right")
elif msg.data == "10":
led_pub.publish("left")
elif msg.data == "11":
led_pub.publish("stop")

rospy.init_node('line_following_control')

rospy.Subscriber('/ir_state', String, ir_state_callback)


led_pub = rospy.Publisher('/mov_state', String, queue_size=10)

rospy.spin()

10

You might also like

pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy