trait PatternFormationLib extends AnyRef
a library for creating spatial patterns in the swarm. The behaviour is based on the gradient of a potential field.
Therefore, for creating a shape, it should exist a leader responsible for that shape.
Team formation and pattern formation can be used together to create a shape with a team of nodes.
Currently, the shapes supported are: line, circle, and v-shape.
- Self Type
- MacroSwarmSupport.PatternFormationLib with E.AggregateProgram with E.StandardSensors with E.FieldUtils with E.TimeUtils with MacroSwarmSupport.BaseMovementLib with E.CustomSpawn with E.BlocksWithGC with MacroSwarmSupport.BlocksWithShare
- Alphabetic
- By Inheritance
- PatternFormationLib
- AnyRef
- Any
- Hide All
- Show All
- Public
- Protected
Type Members
- type AllocationStrategy = (List[(E.ID, Point3D)], List[Point3D], Boolean) => Map[E.ID, Point3D]
Abstract Value Members
- abstract def allPosition(center: E.ID): List[(E.ID, Point3D)]
Concrete Value Members
- final def !=(arg0: Any): Boolean
- Definition Classes
- AnyRef → Any
- final def ##: Int
- Definition Classes
- AnyRef → Any
- final def ==(arg0: Any): Boolean
- Definition Classes
- AnyRef → Any
- final def asInstanceOf[T0]: T0
- Definition Classes
- Any
- def centeredCircle(leader: Boolean, radius: Double, confidence: Double, leaderVelocity: => Point3D = Point3D.Zero): Point3D
Creates a circle shape.
Creates a circle shape. The leader is responsible for the shape. The nodes are placed in a circle with a distance.
Example:
ooo o o o x o o o ooo
Example of usage (leader id = 1):
scala centeredCircle(leader = mid() == 1, radius = 100, confidence = 0.1)
- leader
whether the node is the leader or not
- radius
the radius of the circle
- confidence
the confidence of the shape, i.e., how much error is allowed for the given distance
- leaderVelocity
the velocity of the leader
- returns
the velocity of the node in order to form the shape
- def clone(): AnyRef
- Attributes
- protected[lang]
- Definition Classes
- AnyRef
- Annotations
- @throws(classOf[java.lang.CloneNotSupportedException]) @IntrinsicCandidate() @native()
- final def eq(arg0: AnyRef): Boolean
- Definition Classes
- AnyRef
- def equals(arg0: AnyRef): Boolean
- Definition Classes
- AnyRef → Any
- final def getClass(): Class[_ <: AnyRef]
- Definition Classes
- AnyRef → Any
- Annotations
- @IntrinsicCandidate() @native()
- def hashCode(): Int
- Definition Classes
- AnyRef → Any
- Annotations
- @IntrinsicCandidate() @native()
- def isCircleFormed(source: Boolean, targetDistance: Double, confidence: Double): Boolean
A utility function for verifying whether a circle is formed or not.
A utility function for verifying whether a circle is formed or not.
- source
whether the node is the leader or not
- targetDistance
the target distance between the nodes in the circle
- confidence
the confidence of the shape, i.e., how much error is allowed for the given distance
- returns
whether the circle is formed or not
- final def isInstanceOf[T0]: Boolean
- Definition Classes
- Any
- def line(leader: Boolean, distance: Double, confidence: Double, leaderVelocity: => Point3D = Point3D.Zero): Point3D
Creates a line shape.
Creates a line shape. The leader is responsible for the shape. The nodes are placed in a line with a distance Example: o -- o -- x -- o -- o
- leader
the leader of the shape
- distance
between the node of the shape
- confidence
the confidence of the shape, i.e., how much error is allowed for the given distance
- leaderVelocity
the velocity of the leader
- returns
the velocity of the node in order to form the shape
- def log(key: String, data: Any): Unit
- final def ne(arg0: AnyRef): Boolean
- Definition Classes
- AnyRef
- final def notify(): Unit
- Definition Classes
- AnyRef
- Annotations
- @IntrinsicCandidate() @native()
- final def notifyAll(): Unit
- Definition Classes
- AnyRef
- Annotations
- @IntrinsicCandidate() @native()
- final def synchronized[T0](arg0: => T0): T0
- Definition Classes
- AnyRef
- def toString(): String
- Definition Classes
- AnyRef → Any
- def vShape(leader: Boolean, oldVelocity: Point3D, distance: Double, radius: Double, confidence: Double, leaderVelocity: Point3D = Point3D.Zero): Point3D
Creates a v-shape.
Creates a v-shape. The leader is responsible for the shape. The nodes are placed in a v-shape with a distance example:
x o o o o
example of usage (leader id = 1):
scala rep(Point3D.Zero) { oldVelocity => vShape(leader = mid() == 1, oldVelocity = velocity, distance = 100, radius = Math.PI / 2, confidence = 0.1) }
- leader
the leader of the shape
- oldVelocity
the old velocity of the node (that means it should be used inside a rep)
- distance
the target distance between the node of the shape
- radius
the angle of the v-shape
- confidence
the confidence of the shape, i.e., how much error is allowed for the given distance
- leaderVelocity
the velocity of the leader
- returns
the velocity of the node in order to form the shape
- def vShapeSuggestions(nodes: List[(E.ID, Point3D)], distance: Double, radius: Double, oldVelocity: Point3D, allocationStrategy: (PatternFormationLib.this)#AllocationStrategy = distanceBasedAllocation, shouldLog: Boolean = false): Map[E.ID, Point3D]
- final def wait(arg0: Long, arg1: Int): Unit
- Definition Classes
- AnyRef
- Annotations
- @throws(classOf[java.lang.InterruptedException])
- final def wait(arg0: Long): Unit
- Definition Classes
- AnyRef
- Annotations
- @throws(classOf[java.lang.InterruptedException]) @native()
- final def wait(): Unit
- Definition Classes
- AnyRef
- Annotations
- @throws(classOf[java.lang.InterruptedException])
Deprecated Value Members
- def finalize(): Unit
- Attributes
- protected[lang]
- Definition Classes
- AnyRef
- Annotations
- @throws(classOf[java.lang.Throwable]) @Deprecated
- Deprecated
(Since version 9)