Embedded Motion Control 2018 Group 8: Difference between revisions

From Control Systems Technology Group
Jump to navigation Jump to search
Line 115: Line 115:


'''Old method'''
'''Old method'''
Then in the section between splits the wall is consecutive, however there could be corners inside that section. These corners need to be found.
Then in the section between splits the wall is consecutive, however there could be corners inside that section. These corners need to be found.



Revision as of 11:33, 5 June 2018

Group members

Name: E-mail Student id:
Srinivasan Arcot Mohanarangan (S.A.M) s.arcot.mohana.rangan@student.tue.nl 1279785
Sim Bouwmans (S.) s.bouwmans@student.tue.nl 0892672
Yonis le Grand y.s.l.grand@student.tue.nl 1221543
Johan Baeten j.baeten@student.tue.nl 0767539
Michaël Heijnemans m.c.j.heijnemans@student.tue.nl 0714775
René van de Molengraft & Herman Bruyninckx René + Herman Tutor

Initial Design

The initial design file can be downloaded by clicking on the following link:File:Initial Design Group8.pdf.

A brief description of our initial design is also given below in this section. PICO has to be designed to fullfill two different tasks, namely the Escape Room Competition (EC) and the Hospital Competition (HC). When either EC or HC is mentioned in the tekst below, it means that the corresponding design criteria is only needed for that competition. If EC or HC is not mentioned, the design criteria holds for both challenges.

Requirements

Functions

Components

Specifications

Interfaces

MORE ON TASK SKILL MOTION ETC????

Initial idea Escape Room Competition

Perception

Monitoring

Planning

Other

Initial idea Hospital Competition

World Model

Our strategy is to store the least information as possible as to not strain memory. There are two classes of objects which are stored in memory, nodes and vertices. Nodes are the x and y coordinates of end points of lines. Vertices are straight lines between nodes and are stored as a pair of the connecting node numbers. These are subclasses of the class Room. These objects have other attributes and methods which will be described here below.

Nodes

Nodes are categorized according to the following table. This categorization is represented as boolean attributes of the node objects.\\\\

Node type Subtype Definition
Open Node The unconfirmed end of a line
closed Node Inward Corner Confirmed intersection of two lines.The angle the node vector (which is always relative to PICO) and each of the intersecting lines is less than 90 degrees at moment of detection.
Outward corner Confirmed intersection of two lines.The angle the node vector (which is always relative to PICO) and at least one of the intersecting lines is more than 90 degrees at moment of detection.

Vertex

As mentioned here above a vertex is stored in memory as a reference to the end nodes that define them. A vertex object does have some methods:

  • getParameters:
    • This gets the parameters a,b of the line in the form ax + by +c = 0. This can be done when vector operations are necessary

The parameters of the equation ax + by +c = 0. can easily be transformed to the vector representation: [math]\displaystyle{ \lambda \cdot \begin{bmatrix} a \\b \end{bmatrix}+ \begin{bmatrix}0\\c\end{bmatrix} }[/math]

Which is useful for angle checks and other vector operation.

Room

A room consists of a number of nodes and a list of the existing connections. The room thus contains a vector of nodes. Room nodes are updated until the robot leaves the room. The coordinates are than stored relative to the door. This is further described under monitoring. There are two types of hypothesized doors. The strongest hypothesized door is identified by at least one outward corner. The other is identified as adjacent to an open node.


Perception

Firstly the data from the sensors is converted to Cartesian coordinates and stored in the LaserCoord class within Perception. From the testing it became clear that Pico can also detect itself for some data points and that the data at the far ends of the range are unreliable. Therefor the attribute boolean Valid in LaserCoord is set to false in those cases. When using the data it can be decided if the invalid points should be ex- or included.

For the mapping, the corner nodes and nodal connectivity should be determined as defined in the worldmodel. To do this, the laser range data will be examined. The first action is to do a "split and merge" algorithm where the index of the data point is stored where the distance between to points is larger than a certain threshold. The laser scans radially, therefor the further an object is, the further the measurements differ from each other in the Cartesian system. The threshold value is therefor made dependent on the polar distance.

The point before and after each split is hypothesized as a outward corner. This might be a corner, but can also be part of a (unseen) wall. The corner is stored as a invalid node, until it is certain that it is actual outward corner.

Old method

Then in the section between splits the wall is consecutive, however there could be corners inside that section. These corners need to be found.

The original idea was to check if the lines at the begin and end of the section with three hypothesis:

  • They belong to the same line. No further action
  • They are parallel lines. Two corners must lay in this section. Do a recursive action by splitting the section in two.
  • To different lines. The intersection is most likely a corner.

To determine the lines a linear least squares method is used. This is done for a small selection of points at the beginning and the end of the section. If the error from the fit is too large the selections of points is moved until the error is satisfied.

This method proved to be not robust. For horizontal or vertical fits the lines y=ax+b do not produce the correct coefficients. Even with a swap, so x=ay+b this method fails in some cases. It would probably be possible to continue with this method, but it is decided to abandon this search method within the section and adopt to an alternative. This will be a good example of a learning curve.

Current implementation

Monitoring

The monitoring stage of the software architecture is used to check if it is possible to fit objects to the data of the perception block. For instance by combining four corners into a room. The room is then marked as an object and stored in the memory of the robot. The same is done for doors and corridors. This way it is easier for the robot to return to a certain room instead of exploring the whole hospital again. Monitoring is thus responsible for the creation of new room instances, setting of the room attribute explored to 'True' and maintaining the hypotheses of reality. Also the monotoring skill will send out triggers for the planning block if the robot is probably colliding with an object/wall. Montoring reads the WorldModel.Rooms vector with a (low) frequency of TBD hz. States:

  • Explore

This is the sate with which the robot starts and is triggered when the robot enters a room with explored='false'. The robot will remain in the explore mode until explored is set to 'true' by the function is_complete() which is explained in the function list.

  • Exit

drive to wards the identified door way point. When at the way point. Check if the door is connected to an existing Room object. If not the creation of a new Room instance is triggered. The coordinates of the currentexisting room are flipped along the y axis with respect to the door. The WorldModel now switches to the new room object.

  • Goto

This state is triggered when travelling through a room that is already explored.

  • Park
  • Detect object

Hypotheses:


Functions:

  • Detect if and how far a wall is in front of the robot
  • Detect object and distance
  • Make objects of rooms the rooms with coordinates and dimensions
  • Make objects of the doors with their coordinates and dimensions
  • Make object of the hallway
  • is_complete()

This function loops over the \textit{array} connectivity to check if all the nodes are connected to each other. In the case of an outward corner, it will pass to the next corner by checking the doors.

Output:

  • List with objects and their coordinates relative to the starting position.
  • Trigger for planning if robot is possibly colliding with an object
  • Trigger for planning if robot is driving towards a wall while following one

Planning

Other

Escape Room Competition

For the Escape Room Competition, a simple algorithm was used as code. This was done so that the groupmembers without many C++ programming experience could get used to it while the more experienced programmers already worked on the perception code for the Hospital Competition. Therefore, the code used for the Escape Room Competition was a little bit different than the initial design because the aimed perception code was not fully debugged before the Escape Room Competition so that it could not be implemented in the written main code for the Escape Room Competition.

Perception

For the perception of the world for PICO, a simple space recognition code was used. In this code, the LRF data is split into three beam ranges. A left beam range, a front beam range and a right beam range. Around PICO, two circles are plotted. One is the ROBOT_SIZE circle which has a radius so that PICO is just encircled by the circle. The other circle is the MIN_DISTANCE_WALL circle which has a bigger radius than the ROBOT_SIZE circle. For each of the three laser beam ranges, the distance to an obstacle is checked for each beam, and the lowest distance which is larger than the radius of the ROBOT_SIZE circle is saved and checked if it is smaller than the radius of the MIN_DISTANCE_WALL circle. If that is true, the value TRUE is given to the corresponding laser beam range, else the value FALSE is given to that laser beam range. This scan is done with a frequency of FREQ, and by each scan, the previous values are deleted.

Monitoring

For the Escape Room Competition, PICO would only monitor its surroundings between the ROBOT_SIZE circle and the MIN_DISTANCE_WALL circle by giving a meaning to its sensor data (Left, Right, Front). The four meanings are:

  • Nothing: All sensor data has the value FALSE
  • Obstacle: At least one of the sensors has the value TRUE
  • Wall: The Right sensor has value TRUE, while the Front sensor has value FALSE
  • Corner: The Right and Front sensor has value TRUE

The monitored data is only stored for one moment and the old data is deleted and refreshed with each new dataset.

Planning

For the planning, a simple wall following algorithm is used. As design chose, the right wall is chosen as the wall to follow. As initial state it is assumed that PICO sees nothing. PICO will than check if there is actually nothing by searching at its position for an obstacle. If no obstacle is detected at its starting position, PICO will hypothesize that there is an obstacle in front of him and will drive forward until he has validated its hypothesis by seeing an obstacle. This hypothesis will always come true at a certain moment in time due to the restrictions on the world PICO is put into.

As soon as an obstacle is detected, PICO will assume that this obstacle is a wall and will rotate counter-clockwise until its monitoring says that this obstacle is a wall, so that only the right sensor gives the value TRUE. Due to the fact that the world only consists of walls and corners, and corners are build out of walls, this hypothesis will again always come true when rotating.

The values

The results

More / list on the differences with initial idea

Lessons learned

Hospital Competition

perception

monitoring

planning

The values

Results

More / list of differences on initial idea

Evaluation

Final Design???

Diferences with initial design and link to file (if not yet discussed in earlier sessions)????

Group Review

Code snippets