uvic-aero / onboard-computer

0 stars 1 forks source link

Ground Control Commands #22

Open avesk opened 5 years ago

avesk commented 5 years ago

This issue will be split up into several smaller issues. The purpose of this is to consolidate the specifications of the ground control module.

Overview

On the ground vehicle there will be an arduino that controls the motors of the vehicle. The GroundControl application is responsible for translating commands from computer vision system to the arduino. To do so information is transmitted over a serial port.

Calculating the Path

The computer vision application is responsible for identifying targets in a scene. Once it has found a point of interest it will send the coordinates of the target to the ground control application.

Ground control must then identify what the most appropriate path is for the vehicle to take in order to get to the target. Typically a straight line would not be appropriate since the vehicle should be lined up with the target prior to reaching it. There is a lot of information online about calculating paths for autonomous vehicles and they should studied for this problem. There is a great medium article that looks at important factors for path planning that can be found here. Note this is a fairly difficult task which requires 'camera math' to calculate distance to the target and much more funky math so work in a group and collaborate.

Constructing Serial Packets

To control the speed and direction of the vehicle, onboard computer will be sending packets to the arduino which controlls the motors directly. GroundControl will be generating packets that contain information on how the motor speed should be set in order for the vehicle to travel along the computed path. These packets follow a specific structure that is illustrated bellow. The structure is a 16 Bit packet where the first bit is a flag indicating if the ground vehicle should do a 180, the second bit is a flag indicating if the vehicle should break, and the rest of the structure is for setting motor speed and directions.

180 brake dir1 speed dir2 speed2
0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0

Sending Packet Over Serial Port

To transport this packets to the arduino we will use a serial protocol. There is a good tutorial on using serial with the raspberry py here. In order to package the large set of bits to send to the arduino we will convert the bits into a hexidecimal value and send the information in that form. There is an example of this being done on a form here

Specific Manuevers