Embedded Motion Control 2014 Group 8

From Control Systems Technology Group
Jump to navigation Jump to search

This is the WIKI of group #8.

Group members

Name Student ID Email
Harm van Deursen 0707393 h.j.b.v.deursen@student.tue.nl
Lex Hoefsloot 0718252 a.v.hoefsloot@student.tue.nl
Teun Melief 0656886 t.j.melief@student.tue.nl
Robin Smit   r.smit@student.tue.nl
Paul Verhoeckx 0663727 p.b.verhoeckx@student.tue.nl

PICO Knowns

PICO.png

1. 1080 laser points for distance measurement
2. approximately 250 degrees of measurement direction
3. The datapoint at the left (930), front (540) and right (150)
4. The maximum distance measurement is 30 meters
5. ...
6. PICO's velocity and angular velocity can be determined. These are in meters per second and radians per second respectively.
7. ...


The figure on the right shows the location of the laser (distance) measurement points


Tactic

Win!

Master

The Master file is the file which is taking control over everything that happens. Within the master file, there are the executable subfiles and the checking sub files. The checking file "Detection" is constantly sending (with a frequency of 20 Hz) information to the master. The information which is sent is whether there is; nothing special, a corner, a corridor, a T-junction or a plus-crossing.
The checking file "Strategy" is receiving information from the master. This information is about whether something is detected or not and what is detected (by "Detection"). Than within "Strategy" it is determined whether there is an arrow or not. With this information, a desired direction is replied to the master.
Next to the checking sub files there are two executers. Note that either one of both can be executed. The drive block is called when "Strategy" does not give any input to the master. When "Strategy" does however, "Prefered turn" is the program to be executed.

The figure below gives a visual representation of the interaction within the system.

overview


Driving straight

The three possibilities for PICO's position and direction are given in the Figures below. It is either one of these or a combination of two of them.

Desired straight driving Shifted position Turned position

Drive safely

...... [Robin] ......

Detect a corner

The differences between several laser points are used to detect a corner. Five laser points at the side front and five laser points at the side back are in use. When the difference between all front points and back points is larger than some kind of treshold, the corner is detected.
Note that five laser points have been used to robustly detect a corner. When one or two laser points go through a hole in the wall, there should not be a corner detection.
The difference between the two points is taken because else a new corner gets detected whenever a distance is large (for instance right after the turn).
In the figure below, the laser points that are used by PICO are shown. This is the exact moment when the corner to the left is detected.
Gr8 corner detection.png

Detect a T-junction

...... [Harm en Robin] .......
Detect T-junc 1.png Detect T-junc 2.png

Take the corner

...... [Robin en Paul] ......

Arrow detection

These are the steps taken by 'arrowDetection':

  1. Converting ROS image to an OpenCV image.
  2. Converting the RGB OpenCV image to an HSV image.
  3. Thresholding the HSV image in order to create a binary image of environment in which only bright right objects are 'white' and the rest is 'black'.
  4. Dilate the image to remove any black spots in white surfaces.
  5. Erode the image to create sharper edges
  6. Preform template matching: matching images of left and right arrows to check wether they are present in the picture. Only if the similarity between the template and the camera footage is above a certain threshold, the template is considered 'found' in the image.
  7. Matching of the two types of arrows is compared. The one with most similarity to the arrow in the camera feed is chosen.
  8. Depending on the result, either 0 (no arrow), 1 (left arrow) or 2 (right arrow) is being sent to the strategy of pico.

Algorithm to solve the maze

In order to complete the maze as fast as possible the program uses a fixed strategy. When the robot detects a situation where it can continue in multiple directions it chooses a preferable one. This decision is made based on two parameters, namely which options it detects and whether or not an arrow is observed.
When an arrow is detected in a direction which is a subset of the detected options this will be the preferred new direction. In the case the robot observes an arrow in a direction which is not part of the found options, the arrow is ignored and a direction is chosen based on the rules explained below.
When a crossing is observed without the detection of an arrow, the program chooses the new direction according to a fixed sequence. If possible it chooses to go right, otherwise to go straight. This ensures that every corridor of the maze is evaluated before returning to the same crossing.


Tests

During each test session, several things are tested seperately and observations are done. This chapter is about the logging of all the information.

First test [15/05/2014]

The first goal was to survive the corridor test. This means any corner, left or right, should be detected and taken without any collosion.
There were two main tactics to be tested;

Global tactic (inserted in both programs):
- The corner can be detected by either laser point #150 or #930.
- Safety (not hitting the wall) is inserted for the measurement points 150 - 250, 400 - 540, 540 - 680 and 820 - 970.

first tactic:
1. The distance in front is measured and saved when a corner is detected.
2. Than PICO starts rotating until the distance on the side where the corner has not been measured is equal to the distance that was previously in front
3. PICO drives sidewards until the distance is 30 centimeters less
4. pico drives straight ahead again. The corner is taken

Second tactic:
1. The corner is measured but PICO keeps on driving straight ahead and the timer starts
2. The end of the corner is detected and the timer stops
3. PICO drives backwards for half of the time the timer has measured
4. PICO drives sidewards through the corner
5. PICO turns to get back in its neutral position

Observations;
- All measurement points should be used for safety to ensure safety
- The big mess should be cleaned and divided into seperate files which will be included into the master file
- One point to measure a corner is not robust. This should be done by the use of more points.

However, the second tactic seems to work quite okay and will thus be used for the corridor competition

Corridor test [16/05/2014]

Unfortunately there was not enough time to implement the observations in the code. The second method is used and led to a time to pass the corridor in 32 seconds.

second test [21/05/2014]

In the second test the new safety driving, the new corner detection and the straight driving have been tested. The method to detect a corner was adjusted. Where earlier corners were detected with only one laser point, the new corner detection got a lift. They are detected via the subtraction of five laser points at the side and five laser points at the side a bit more backwards. Parameters such as the difference and the position of these laser points which are used are tuned within this meeting.
To get the exactly desired position where a corner should be detected, PICO is placed at the place where the corner should be detected. Two points that differ half a meter in distance are used as the points for measuring a corner. For robustness this is extended to the five closest measurement points.
The safe driving is used in any of the testing cases. It is working very properly. The only thing is that the safety margin sometimes seems to be less than .3 meters.
The straight driving has also been tested. Whereas it works perfectly in the simulations, it worked properly one out of ten times in the tests. This is given the highest priority to get right for the next test session.

Third test [29/05/2014]

Fourth test

Fifth test

C++ coding

Master

...... [All] ......

Driving straight

...... [Harm] ......

Drive safely

...... [Robin] ......

Detect a corner

...... [Robin] ......

Detect a T-junction

...... [Harm en Robin] .......

Take the corner

...... [Robin en Paul] ......

Arrow detection

Arrow detection is built into a different node than the rest of pico's controllers. This is to make sure that the image processing is not interfering with the pico driving controllers. The master node can subscribe to the image processing node on the topic 'arrowDetection'. ArrowDetection is posting '0' if no arrow is found, 1 if a left arrow is found and 2 if a right arrow is found.

When the arrow detection node is started, it begins processing the camera topic of pico.

Algorithm to solve the maze

...... [Paul] ......

It's a new world

How to load the T-junction:

  1. Open Terminator. Navigate to maze folder.
  2. Run:
     gazebo maze/placearrow_TjuncL.world 
    for left arrow or run:
     gazebo maze/placearrow_TjuncR.world 
    for right arrow and
  3. In another terminal
  4. Run:
    rosrun maze spawn_Tjunc
  5. and run:
    roslaunch pico_gazebo pico.launch
    to load Pico
  6. and run:
    roslaunch arrowDetector arrowDetector
    to run arrow detection
  7. Now you can run Rviz:
    rosrun pico_visualization rviz


.