Download as pdf or txt
Download as pdf or txt
You are on page 1of 6

CENG 407: Robotics and Robot Autonomy

OSTIM Technical University


Fall 2023
13th December 2023
NAME: ABDULLAHI BASHIR DANEJO
STUDENT NUMBER: 200201821

THE3_bonus Report Tangent Bug Algorithm for Differential Drive Robot

1. Introduction;
The main goal of this report is to examine and implement various bug algorithms, including
Bug 0, Bug 1, Bug 2, and the Tangent Bug algorithm. The objective is to understand the algorithms,
implement them, and evaluate their performance in different environments. The goal is to achieve
a comprehensive understanding of bug algorithms and their effectiveness in navigating robots to a
target position.

2. Tangent Bug:
2.1) Examine and explain the LidarSensor class:
The LidarSensor class represents a Lidar sensor that provides information about the robot's
surroundings. It uses beams to detect obstacles and calculate distances. The update_position method
adjusts the sensor's position based on the robot's orientation. The generate_readings method
produces Lidar readings for each beam, considering obstacles and adding noise. The cast_ray
method calculates the distance from the sensor to an obstacle along a specific beam.
2.2) Explain the Tangent Bug algorithm:
The Tangent Bug algorithm combines motion-to-goal and wall-following phases. In the
motion-to-goal phase, the robot moves directly towards the goal. If an obstacle is encountered during
wall-following, the robot temporarily switches back to motion-to-goal until it finds a point on the
obstacle boundary to continue wall-following.
2.3) Implement Tangent Bug function in bug_planners.py:
def tangent_bug(robot, lidar_sensor, target_position):
if robot.fsm == "m2g":
if any(sensor.activated for sensor in lidar_sensor):
robot.fsm = "wf"
else:
robot.fsm = "m2g"
elif robot.fsm == "wf":
if check_obstacle(robot.position, target_position):
robot.fsm = "m2g"
else:
# Add Tangent Bug specific logic here
tangent_bug_logic(robot, lidar_sensor, target_position)

# Add any additional functions required for Tangent Bug

def tangent_bug_logic(robot, lidar_sensor,


target_position):
# Implement the specific logic for the Tangent Bug algorithm
here
# You can use lidar_sensor readings and robot information to
navigate

# For example, you can calculate the angle to the target and
adjust the robot's movement
angle_to_target = np.degrees(np.arctan2(target_position[1]
- robot.position.y, target_position[0] - robot.position.x))
# Determine if the robot needs to turn left or right based
on the angle
if angle_to_target > robot.position.theta:
# Turn right
robot.input.vel = 0
robot.input.omega = 20
else:
# Turn left
robot.input.vel = 0
robot.input.omega = -20
the tangent_bug function is called during the "wf" state, and the specific logic for the Tangent Bug
algorithm is implemented in the tangent_bug_logic function.

2.4) Create different environments that show the performance of Tangent Bug. Provide at least
one example that the path does not exist and the algorithms returns the message "Path does not
exist.":
3. Conclusion:
The Tangent Bug algorithm presents a hybrid approach to robotic path planning by incorporating
both reactive and memory-based strategies. Through the following observations and conclusions,
we can assess the strengths and limitations of Tangent Bug:
Achievements of Tangent Bug:

Tangent Following Behavior: Tangent Bug effectively utilizes tangent-following behavior, allowing
the robot to trace the obstacle boundary in search of an opening. This behavior enables the
algorithm to navigate along complex obstacle layouts.

Reactive Response: The algorithm exhibits reactive responses to obstacles, making it suitable for
dynamic environments. By following the tangent, Tangent Bug maintains proximity to obstacles
while actively seeking a route to the target.

Partial Memory Integration: While not as memory-dependent as Bug 2, Tangent Bug incorporates
elements of memory by following the obstacle boundary. This enables the robot to maintain
context about its surroundings and backtrack if necessary.

Challenges and Considerations:

Parameter Sensitivity: Tangent Bug may require careful tuning of parameters such as robot speed,
turning angles, and proximity thresholds. Fine-tuning is essential to balance the trade-off between
obstacle following and efficient path planning.

Complex Environments: In highly complex environments with narrow passages or dead ends,
Tangent Bug may face challenges in finding optimal paths. The algorithm's reliance on boundary
following might lead to longer routes in intricate scenarios.

Optimality Trade-off: While Tangent Bug improves path planning compared to purely reactive
algorithms, it may not always find the most optimal path. The algorithm prioritizes reaching the
target while navigating along the obstacle boundary, which can result in suboptimal trajectories.

In conclusion, Tangent Bug presents a valuable approach to robotic path planning, especially in
environments with intricate obstacle configurations. Its combination of reactive and memory-
based elements allows it to handle dynamic scenarios and navigate around complex obstacles.
Understanding the algorithm's parameter sensitivity and trade-offs is crucial for its effective
implementation in diverse robotic applications. Tangent Bug stands as a versatile solution that
strikes a balance between reactivity and memory-based path tracking, contributing to its
adaptability in various robotic navigation tasks.

You might also like