Difference between revisions of "Helicopter flight and mission"

From BP Wiki
Jump to: navigation, search
(General control b-threads)
Line 19: Line 19:
 
*Paint cans may be re-filled. This is simulated by a user clicking on a button on the screen.
 
*Paint cans may be re-filled. This is simulated by a user clicking on a button on the screen.
  
== Events ==  
+
== Events ==
  
== General control events ==  
+
== General control events ==
 
BeginPainting: Start the painting process
 
BeginPainting: Start the painting process
 
StopPainting: End the painting process
 
StopPainting: End the painting process
MoveDown: Move down a fixed number of pixels.  
+
MoveDown: Move down a fixed number of pixels.
EndOfColUp: End painting wall going up  
+
EndOfColUp: End painting wall going up
DoColDownL Start painting wall going down  
+
DoColDownL Start painting wall going down
EndOfColDown: End painting wall going up  
+
EndOfColDown: End painting wall going up
DoRowRight: Start painting wall going right  
+
DoRowRight: Start painting wall going right
EndOfRowRight: Stop moving right.  
+
EndOfRowRight: Stop moving right.
ChangeColor: The time has come to change color  
+
ChangeColor: The time has come to change color
UpdateArrived: simulate information from a GPS with actual helicopter location
+
UpdateArrived: simulate information from a GPS with actual helicopter location
  
=== Move Events ===  
+
=== Move Events ===
  
The following events indicate the desire to move a fixed number of pixels in the desired direction. These events have a data field - indicating whether the movement is for a mission or for maintenance, which serves in correcting wind shifts.  
+
The following events indicate the desire to move a fixed number of pixels in the desired direction. These events have a data field - indicating whether the movement is for a mission or for maintenance, which serves in correcting wind shifts.
  
 
MoveUp: Move down a fixed number of pixels
 
MoveUp: Move down a fixed number of pixels
 
MoveLeft: Move left a fixed number of pixels
 
MoveLeft: Move left a fixed number of pixels
 
MoveRight: Move right a fixed number of pixels
 
MoveRight: Move right a fixed number of pixels
DoColUp: Start painting wall going up  
+
DoColUp: Start painting wall going up
  
  
== BPJ b-threads ==  
+
== BPJ b-threads ==
  
 
=== General control b-threads ===
 
=== General control b-threads ===
Line 59: Line 59:
 
MovingRight, MovingLeft, MovingDown, MovingUp: These b-threads wait for the corresponding move event and call the helicopter API (or the simulator) to cause the actual movement.
 
MovingRight, MovingLeft, MovingDown, MovingUp: These b-threads wait for the corresponding move event and call the helicopter API (or the simulator) to cause the actual movement.
  
=== Color control b-threads ===  
+
=== Color control b-threads ===
 
ChangePaintingColor: Waits for the need to change color and changes the color randomly.
 
ChangePaintingColor: Waits for the need to change color and changes the color randomly.
  
=== Location correction b-threads ===  
+
=== Location correction b-threads ===
 
FixWind: When a report comes in that the helicopter is not where it is supposed to be - stop painting movement and return to last known location.
 
FixWind: When a report comes in that the helicopter is not where it is supposed to be - stop painting movement and return to last known location.
  
=== Environment Simulation ===  
+
=== Environment Simulation ===
  
ColorControl: Counts movements and announces the need to change color.  
+
ColorControl: Counts movements and announces the need to change color.
 
Wind: Every certain random number of steps, report a random location of the helicopter
 
Wind: Every certain random number of steps, report a random location of the helicopter
 +
 +
 +
= Inceremental Development Notes = [[File:Example.jpg]]

Revision as of 09:23, 15 April 2014

Helicopter Flight Example

This example demonstrates the control of a toy helicopter. The mission here is to paint a wall with different colors. This can be considered as an analogy to a photography mission where a particular area as to be covered.

Requirements

The requirements below were added incrementally, and b-threads were added to deal with each requirement. In the simulator - the painting of the wall is by drawing a line on the screen.


  • The helicopter should go up and down along the wall.
  • When the helicopter reaches the ceiling or the floor it should move to the right
  • Every fixed number of pixels the paint color should be changed
  • Since the line drawn by the helicopter is thin, after every small vertical move, the helicopter should move right and left with horizontal brush strokes, before moving vertically again.
  • The helicopter may move from its present location due to wind.
  • If the helicopter is moved by wind, it should return to its last known location.

In the integration with LSC, two more requirements were added

  • The amount of paint is limited. After a certain number of points is painted - the paint runs out.
  • When paint of a certain color runs out, this color can no longer be used.
  • When all paint colors run out, the helicopter must stop.
  • Paint cans may be re-filled. This is simulated by a user clicking on a button on the screen.

Events

General control events

BeginPainting: Start the painting process StopPainting: End the painting process MoveDown: Move down a fixed number of pixels. EndOfColUp: End painting wall going up DoColDownL Start painting wall going down EndOfColDown: End painting wall going up DoRowRight: Start painting wall going right EndOfRowRight: Stop moving right. ChangeColor: The time has come to change color UpdateArrived: simulate information from a GPS with actual helicopter location

Move Events

The following events indicate the desire to move a fixed number of pixels in the desired direction. These events have a data field - indicating whether the movement is for a mission or for maintenance, which serves in correcting wind shifts.

MoveUp: Move down a fixed number of pixels MoveLeft: Move left a fixed number of pixels MoveRight: Move right a fixed number of pixels DoColUp: Start painting wall going up


BPJ b-threads

General control b-threads

DoColD2U: Controls coloring in the up direction; YAxis: Reports when helicopter reaches top or bottom end of wall (ceiling of floor) EndColUp: Handle reaching of ceiling. Stop moving vertically, start moving right. DoRowL2R: Left to right painting - waits for DoRowRight and then repeatedly requests movement to the right until end of right movement is reached. XAxis: Monitor horizontal coordinates. Report reaching of right and left borders of wall, and report end of movement right to start a new column DoColU2D: Controls coloring in the up direction EndColDown: Handles reaching the floor - requests a movement to the right BrushMove: Move the brush right and left (horizontal moves) to create a thicker line and paint continuous area. This b-thread performs its actions between any two vertical moves.


Actuator b-threads

MovingRight, MovingLeft, MovingDown, MovingUp: These b-threads wait for the corresponding move event and call the helicopter API (or the simulator) to cause the actual movement.

Color control b-threads

ChangePaintingColor: Waits for the need to change color and changes the color randomly.

Location correction b-threads

FixWind: When a report comes in that the helicopter is not where it is supposed to be - stop painting movement and return to last known location.

Environment Simulation

ColorControl: Counts movements and announces the need to change color. Wind: Every certain random number of steps, report a random location of the helicopter


= Inceremental Development Notes = Example.jpg