Ipsj Apris2022003
Ipsj Apris2022003
Abstract: This paper aims to develop autonomous driving vehicle based on robot operating system (ROS). ROS
nodes are defined relative to model-based control and each node computes as the same period. For control system
based on ROS, the structure of the feedback loop is designed based on the block diagram, which is not convenient for
the complex system. The conceptual design of SysML may be more useful than block diagram. The feedback con-
trol with obstacle avoidance system is extracted to subsystems such as obstacle avoidance system, trajectory tracking,
and motion control system. The communication between the subsystem is defined as subscription and publication in
ROS. MATLAB/Simulink and Arduino IDE are used to develop ROS code. The obstacle avoidance node and trajec-
tory tracking nodes subscribed the necessary data and they publish the desired velocity and the desired steering angle.
The motion control node consists of velocity control and steering control, which are programmed to Arduino board
and communicate with other nodes through UART communication. Gaussian potential function is applied to detect
the obstacle and define the direction to avoid the obstacle. The prototype vehicle is developed as small vehicle and
it is used to perform by the algorithms. The experiment result presents that the vehicle can detect the obstacle and
avoid the obstacle successfully. The maximum of detection range is varied to observe the behavior and the steering
angle is bounded +/- 20 degrees. As summary, the avoidance performance depends on the radius of detection, steering
mechanisms, and communication speed between the nodes, which effects to sampling rate of control system.
Keywords: Obstacle avoidance system, Robot operating system, ROS node, MATLAB/Simulink, SysML
1. Introduction
Robot operating system (ROS) is one of open source platform
for develop mobile robot and autonomous vehicle[1], [2], [3],
which is familiar with computer engineering and it may not con-
cern about dynamic of vehicle. The comparison of control sys-
tem based on ROS [1], [2], [3] and conventional control system
[4], [5], [6], [7], [8] is that ROS consists of several nodes and
each node performs only one task. The published data of each
node is shared in the core and the data will be used by data sub-
scription. Then, the operation of each node is parallel computing
with others.
By the way, conventional control system is well known as feed-
back control system and it is usually constructed based on block Fig. 1: Prototype vehicle is used in experiment.
diagram so that the operation will perform as serial computing
process that sensing, computing, and acting, respectively. tem and the communication between the nodes is defined rela-
Then, autonomous vehicle system becomes complex system tive to the sampling rate. Therefore, this paper will introduce the
and subsystems are performed in the same time. control system obstacle avoidance system, which constructs based on ROS by
based on ROS may be useful than conventional control system. MATLAB/Simulink and Arduino IDE. ROS nodes are designed
The processor should be organized the resource and it should con- relative to the modeling language, and then the system is demon-
cern about the sampling rate of sensor. The sampling rate is very strates in experiment.
important for conventional control as presented in the paper [9]
because the sampling rate of sensor will response the precision of 2. Control System
feedback control too. The prototype vehicle is developed as shown in Figure 1. It
To design the control system, System Modeling Language contains mini computer, embedded board, motor controller for
(SysML) [10] is applied to separate the task of the control sys- steering and powertrain mechanisms. 2D-Lidar is used to detect
1
the obstacle, range of which is less than 8 meters.
Department of Mechanical Engineering, King Mongkut’s University of
Technology Thonburi, Bangkok, 10140, Thailand The overall control system is designed as feedback control sys-
a)
[email protected] tem and the system is separated to two parts as shown in Figure
2a. Software part includes the mapping and localization, obstacle tion. ROS message is defined to subscribe data from sensor nodes
avoidance system, and trajectory tracking system. 2D Lidar and and publish desire condition to vehicle node by Rosserial. Vehicle
IMU nodes provide raw data such as point cloud of environment node contains the motion control system for speed and steering
detection and yaw of vehicle, respectively. Obstacle avoidance control.
aims to revise the trajectory to goal position for avoiding the ob-
stacle if the obstacle is detected. It received data from every node 2.1 Hardware
in order to know the status of vehicle, environment, and obsta- As above sentences, the system requires a computer, a vehi-
cle. Then, desired speed (vd ) and new desired direction (φ) are cle, 2D lidar, and IMU sensor. Specification of computer is that
compute and they are published to hardware. Intel core i5 processor, 8 GB of Ram, and SSD 256GB. ROS
Hardware part obtains as vehicle, which includes the position Noetic distribution and MATLAB/Simulink 2021 are installed
controller for steering system and the speed controller for power- in the computer and connect to hardware by USB interface and
train system. Then, the hardware requires the desired condition UART communication. 2D lidar is YDlidar X4, the detection
from software part such as speed and steering angle. range is from 0.12 to 10 meters and scan frequency is fixed at
To redesign the control system, the paper [10] suggested to de- 12 Hz. It communicates with computer at 115,200 bit/sec. IMU
sign the system based on task and operation so that ROS nodes sensor is MPU9250 and the data output frequency is up to 500
are organized as Figure 3 that the system includes 5 nodes such as Hz. Vehicle is controlled by ATmega2560, which with computer
way point node, obstacle avoidance node, vehicle node, 2D Lidar at 115,200 bit/sec.
node, and IMU node.
2D Lidar node and IMU node are grouped as sensor nodes, 2.2 Obstacle Detection Algorithms
which measure raw data. The way point node, the obstacle avoid- To detect the obstacle and define the position of obstacle, 2D
ance node are constructed by MATLAB/Simulink as shown in Lidar is used to survey the area as shown in Figure 4. Lidar trans-
Figure 2b, Simulink model is deployed to ROS code for opera- mits the laser around the sensor and it will measure distance from
3. Experiment Result
In this study, the speed of vehicle is fixed as constant speed at
0.5 m/s. The vehicle starts at initial position and the obstacle is
in front of the vehicle at 2.50 meters as shown in Figure 5. The
original trajectory is from (0,0) to (4,0). It is revised by obstacle
avoidance system to avoid the obstacle by setting the detection
length.
Fig. 4: Obstacle detection using 2D Lidar. After the raw data from 2D lidar is input to ROS node in com-
puter, the input frequency is reduced to 10-11 Hz by commu-
sensor. The data will be sent as array of detection angle (θ) and nication. Then, obstacle avoidance will calculate the total field
distance (d) and the size of array is k × 2, which can be used equation as shown in Figure 5a, it presents the field values ver-
to calculate the position of obstacle (Po,x , Po,y ) in XY coordinate sus scanning angle (θ) that red and blue lines present repulsive
that and attractive values from Equation (7) and (9), respectively. The
Po,x = dθ,k cos(θk ) (1) summation of both values is total field value, which is shown as
Po,y = dθ,k sin(θk ) (2) yellow line. The minimum of the total field value means to avoid-
ance angle, which is pointed by the red arrow. It will be pub-
where, dθ,i denotes distance from sensor to object at θk angle. θk lished to the vehicle by UART communication at 115,200 bit/sec
is angle of 2D Lidar at k step. as shown in Figure 5b. The frequency of transmitting data is 0.15
The angle of obstacle width (ϕ) denotes the range of laser scan, Hz or 6.42 times per sec.
which detect the obstacle is defined as When the obstacle is placed in front of vehicle at 2.50 meters
ϕ = θmax − θmin (3) as shown in Figure 5c, the obstacle detection is set at 1.50, 1.75,
and 2.00 meters for avoiding the disturbance from outdoor light
Then, the direction from Lidar to obstacle is given as
and then, the results in XY coordinate system are shown in Fig-
θmax − θmin ure 5c as red, blue, and pink solid lines, respectively. The dashed
ϕob = (4)
2 line represented the starting position of turning, which the desired
where, θmin , θmax denote the minimum and maximum scanning
steering position is changed from straight line.
angle of Lidar, which found the obstacle.
For obstacle detection range is set at 2.00 meters, the motion
To compensate the width of vehicle during the steering, the an-
is shown as pink line and the vehicle starts to turn at (0, 0.46)
gle of obstacle width will be included the width of vehicle (Wv )
position and the desired steering is highest at 57.99 degree. The
that
vehicle can start the turning immediately when it detected the ve-
dav tan( ϕ2 ) + Wv
hicle.
Φ = 2atan 2
(5)
dav By the way, the obstacle detection range is set at 1.50 meters,
where, dav denotes average distance from Lidar to obstacle. the motion is shown as red line and the vehicle starts to turn at
References
[1] B Abhishek, S Gautham, D Varun Rufus Raj Samuel, K Keshav,
U.P. Vignesh, Shyam R Nair: ROS based stereo vision system for
autonomous vehicle, Proceedings of 2017 IEEE International Con-
ference on Power, Control, Signals and Instrumentation Engineering
(ICPCSI), DOI: 10.1109/ICPCSI.2017.8392121 (2017).
[2] Kento Hasegawa, Kazunari Takasaki, Makoto Nishizawa, Ryota
(b) Example of desired steering result is published to vehicle Ishikawa, Kazushi Kawamura, Nozomu Togawa: Implementation of
node. a ROS-Based Autonomous Vehicle on an FPGA Board, Proceedings
of 2019 International Conference on Field-Programmable Technology
(ICFPT), DOI: 10.1109/ICFPT47387.2019.00092 (2019).
[3] W. Eric Wong, Yue Chen, Dennis Kengo Oka, Martin Soukup, Ger-
man Ros, Min Xie, Zijiang Yang, Mohammad Zulkernine, Ming
J. Zuo: Panel on Safety, Security, and Reliability of Autonomous
Vehicles, Proceeding of 2020 Asia-Pacific International Symposium
on Advanced Reliability and Maintenance Modeling (APARM), DOI:
10.1109/APARM49247.2020.9209498 (2020).
[4] Park J-M, Kim D-W, Yoon Y-S, Kim HJ, Yi K-S.: Obstacle avoid-
ance of autonomous vehicles based on model predictive control,
Proceedings of the Institution of Mechanical Engineers, Part D:
Journal of Automobile Engineering. 2009;223(12):1499-1516. DOI:
10.1243/09544070JAUTO1149 (2009).
[5] Madhavan T.R.;Adharsh M.: Obstacle Detection and Obstacle Avoid-
ance Algorithm based on 2-D RPLiDAR, Proceeding of 2019 Interna-
tional Conference on Computer Communication and Informatics (IC-
(c) Graph shows the position of obstacle and vehicle during the CCI), DOI: 10.1109/ICCCI.2019.8821803 (2019).
avoidance. [6] Jang-Ho Cho ,1 Dong-Sung Pae ,1 Myo-Taeg Lim ,1 and Tae-Koo
Kang: A Real-Time Obstacle Avoidance Method for Autonomous Ve-
Fig. 5: Experiment result of the obstacle avoidance. hicles Using an Obstacle-Dependent Gaussian Potential Field, Journal
of Advanced Transportation, Volume 2018, Article ID 5041401, DOI:
110.1155/2018/5041401 (2018).
(0, 1.1) position and the desired steering is highest at 61.31 de-
[7] Deepali Ghorpade, Anuradha D. Thakare, Sunil Doiphode: Obstacle
gree. The control system should be detected the obstacle at (0, Detection and Avoidance Algorithm for Autonomous Mobile Robot
1.0) position but it has delay time before the control publish the using 2D LiDAR, Proceeding of 2017 International Conference on
Computing, Communication, Control and Automation (ICCUBEA),
message to avoid the obstacle. However, the vehicle can avoid the DOI: 10.1109/ICCUBEA.2017.8463846 (2018).
obstacle successfully but the motion of vehicle can not be turned [8] Siddharth Bansal, Fatemeh Alimardani, John S. Baras: Model-Based
Systems Engineering Applied to the Trajectory Planning for Au-
hasty because the limitation of steering mechanism so that it may tonomous Vehicles, Proceeding of 2018 IEEE International Systems
be cause of accident. Engineering Symposium (ISSE), DOI: 10.1109/SysEng.2018.8544452
(2018).
[9] Danai Phaoharuhansa, Akira Shimada: Multi-rate discrete control for
4. Conclusion omni-directional robot in intelligent space, Proceeding of SICE An-
nual Conference 2014, DOI: 10.1109/SysEng.2018.8544452 (2014).
As summary for control system based on ROS, the prototype [10] Danai Phaoharuhansa, Akira Shimada: An approach to SysML
vehicle is performed by position control for steering system and and Simulink based motion controller design for inverted pendulum
robots, Proceeding of SICE Annual Conference 2011, 2011.
speed control for powertrain system. ROS node is designed based
on task, and then every nodes are performed as parallel comput-
ing and the result showed that the vehicle can avoid the obstacle
successfully.
By designing the communication, the sampling control system