Difference between revisions of "Helicopter flight and mission"

From BP Wiki
Jump to: navigation, search
(Incremental Development Notes)
(Downloads)
 
(5 intermediate revisions by 2 users not shown)
Line 3: Line 3:
  
 
= Basic Composite Behavior =
 
= Basic Composite Behavior =
The following movies show flight of the helicopter, as well as simulation. The flight was generated by two independent concurrent LSCs - one directs the helicopter through a rectangular flight path without changing altitude, while the other directs the helicopter to go up and down without changing its horizontal location. The result is a composite motion, traveling the prescribed path while going up and down.
+
The following movies show flight of the helicopter, as well as simulation. The flight was generated by independent concurrent LSCs - where one directs the helicopter through a rectangular flight path without changing altitude, and another directs the helicopter to go up and down without changing its horizontal location. The result is a composite motion, traveling the prescribed path while going up and down.
  
 
{{#ev:youtube|nMTbQc_iq5Y|640}}
 
{{#ev:youtube|nMTbQc_iq5Y|640}}
Line 99: Line 99:
 
{{#ev:youtube|6cSqPGvRWw0|640}}
 
{{#ev:youtube|6cSqPGvRWw0|640}}
  
[http://www.wisdom.weizmann.ac.il/~bprogram/videos/WallPainting.mp4 Movie: Incremental development of the wall painting application]
 
  
With only basic movements and no color change b-threads
+
With only basic movements and no color change b-threads:
  
 
[[Image: Black - thin.jpg]]
 
[[Image: Black - thin.jpg]]
  
  
Basic movements with color changes
+
Basic movements with color changes:
  
 
[[Image: Color-thin.jpg]]
 
[[Image: Color-thin.jpg]]
  
Adding horizontal brush movements
+
Adding horizontal brush movements:
  
 
[[Image: Color-thick.jpg]]
 
[[Image: Color-thick.jpg]]
  
Random movements due to wind, and return by horizontal movement and then vertical to last known location
+
Random movements due to wind, and return by horizontal movement and then vertical to last known location:
  
 
[[Image: FixWind.jpg]]
 
[[Image: FixWind.jpg]]
Line 146: Line 145:
  
 
= Download =
 
= Download =
# Click [[Media:Helicopter.zip | here]] to download the helicopter example.
+
== Download the wall painting example ==
 +
# Click [[Media:Helicopter.zip | here]] to download the wall painting example.
 
# Installation Instructions:
 
# Installation Instructions:
 
##Import the downloaded project to your workspace:
 
##Import the downloaded project to your workspace:
Line 154: Line 154:
 
###Click 'Finish'.
 
###Click 'Finish'.
 
##The helicopter example projects are now part of your workspace.
 
##The helicopter example projects are now part of your workspace.
### The example includes three projects:  
+
### The example includes three projects:
 
#### BDrone - The main project that includes the b-threads that implement the drawing/scanning tasks.
 
#### BDrone - The main project that includes the b-threads that implement the drawing/scanning tasks.
 
#### HeliSim - A simple java-based simulator.
 
#### HeliSim - A simple java-based simulator.
 
#### il.ac.wis.cs.rovtool.blender - A blender-based simulator.
 
#### il.ac.wis.cs.rovtool.blender - A blender-based simulator.
 
##Refer to the BDrone/HowToRun.txt file for execution instructions.
 
##Refer to the BDrone/HowToRun.txt file for execution instructions.

Latest revision as of 07:32, 20 May 2014

Helicopter Flight Examples

The examples below demonstrates the control of a toy helicopter - AR DRONE by Parrot Inc.

Basic Composite Behavior

The following movies show flight of the helicopter, as well as simulation. The flight was generated by independent concurrent LSCs - where one directs the helicopter through a rectangular flight path without changing altitude, and another directs the helicopter to go up and down without changing its horizontal location. The result is a composite motion, traveling the prescribed path while going up and down.


Detailed Example: Wall Painting

In this example, 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.

The example is implemented with a simulator.

Below we describe the requirements and the associated b-threads, along with screen images and a movie of the helicopter behavior as it evolves with the addition of new b-threads.


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: This is an event class of which there are four events, indicating a request to change the painting color to the corresponding one in the event name:
    • eChangeColorBLACK
    • eChangeColorRED
    • eChangeColorBLUE
    • eChangeColorGreen
  • 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
  • MoveDown: Move down a fixed number of pixels
  • MoveLeft: Move left a fixed number of pixels
  • MoveRight: Move right a fixed number of pixels

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

The following 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

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

Incremental Development Notes


With only basic movements and no color change b-threads:

Black - thin.jpg


Basic movements with color changes:

Color-thin.jpg

Adding horizontal brush movements:

Color-thick.jpg

Random movements due to wind, and return by horizontal movement and then vertical to last known location:

FixWind.jpg

LSC Integration

The BPJ-based system was then integrated with the LSC language via PlayGo. For details how to integrate a BPJ application with LSC see a separate section in this documentation.

The following LSC (scenario) was added

  • PaintCanEmpty: Waits for a certain number of movements with a given color and block subsequent changes to that color, simulating and empty can, until an event of PaintFilled arrives. This event is generated by the user clicking on a corresponding GUI Button.

Design Notes

The following design patterns and choices can be seen throughout the example.

  • Events can be distinguishes from each other by
    • Class - different classes of events
    • Name - multiple instances of an events of the same class distinguished by their name (e.g. the color change events).
    • Data field - Two instances of events of the same class, with arbitrary names can be distinguished by a value in one of the event data fields (e.g. the maintenance vs. mission indicator in the move events).
  • One activity can interfere with another by using
    • priority - (relative priority among b-thread)
    • blocking the events of the other activity (which can be distinguished as described above)
  • Distinguishing internal and external events - those generated by the system/application and those generated by the environment (and which may be reported by sensors).
    • External events should not be blocked (enforced by convention only).
    • When external events are produced by simulator, the concepts of Logical Execution Time should be enforced by convention, where all internal events reacting to the last external event should be processed before generating the next external event.

Download

Download the wall painting example

  1. Click here to download the wall painting example.
  2. Installation Instructions:
    1. Import the downloaded project to your workspace:
      1. From the 'File' menu choose 'Import'-->'General'-->'Existing Projects into Workspace'.
      2. Click the 'Next' button.
      3. Click the 'Select archive file' option and then click the 'Browse...' button to select the downloaded zip file.
      4. Click 'Finish'.
    2. The helicopter example projects are now part of your workspace.
      1. The example includes three projects:
        1. BDrone - The main project that includes the b-threads that implement the drawing/scanning tasks.
        2. HeliSim - A simple java-based simulator.
        3. il.ac.wis.cs.rovtool.blender - A blender-based simulator.
    3. Refer to the BDrone/HowToRun.txt file for execution instructions.