# Future Improvements

## Improving Obstacle Avoidance Algorithm

Currently, our obstacle avoidance algorithm is not really sophisticated. It can only tell whether there is an obstacle right in front of the Lidar, but not the ones on its side. Additionally, the next turning direction and the turning angle are also inflexible: only three directions are supported (left, right, straight) and the next turning direction is always the opposite as the previous one.

The possible future improvements for the obstacle avoidance algorithm includes:

1. Detect obstacles in a wider range (maximum 180 degrees)
2. Calculate the turning direction based on the Lidar input in real time to make turning more efficient
3. Improve the granularity of the turning angles

## Shortening Reaction Time of Object Tracking Algorithm

The algorithm find_object_2d publishes the coordinates of the object at a low frequency, only once every second or so. Such a delay makes the reaction time of our algorithm really long and limits our goal of tracking an object at higher speed and accuracy. We found the rough delay time of each message but we couldn’t find the exact line to change it in the algorithm yet. If the message of the detected object can be obtained faster, we can improve the tracking feature a lot.

## Recognizing Object Rotations and Speed Changes

Currently, our algorithm only takes in the horizontal coordinate of the object. However, the information matrix of the detected object uses Affine matrix which has nine coordinates. It is able to identify more complicated movements of the object, such as rotation and change of speed, by providing object shape and size information. This part is done in the algorithm find_object_2d, which is useful for our algorithm to detect the changes in the object in higher dimensions.

## Combining Obstacle Avoidance and Object Detection

We developed both the obstacle avoidance and the object tracking algorithms, but unfortunately, we did not incorporate them together as planned. The main issue was that the Lidar and the Camera were both working on their own, and there was a lack of communication between the two algorithms. Thus, when the object being tracked is right in the front of the car, the Lidar might label it as an obstacle that the car needs to avoid.

Directions of future improvements include:

1. Implement a communication system between the Lidar and the Camera to incorporate the information gained from the two ends.
2. Implement a coordinate system that works for both the Lidar and the Camera to make them operating on the same reference frame, which makes it easier for the communication.
3. Send the control signals to the Arduino based on some rules of priority so the two algorithms don’t conflict.