Smart cameras and drones
<div style="position: relative; padding-bottom: 56.25%; height: 0; overflow: hidden;">
<iframe allow="accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture; web-share" allowfullscreen="allowfullscreen" loading="eager" referrerpolicy="strict-origin-when-cross-origin" src="https://www.youtube.com/embed/yuaY_8Vr3oc?autoplay=0&controls=1&end=0&loop=0&mute=0&start=0" style="position: absolute; top: 0; left: 0; width: 100%; height: 100%; border:0;" title="YouTube video"></iframe>
</div>
Prerequisites
This guide assumes you already know the Alchemist metamodel and that you keep the YAML reference at your fingertips.
Smartcam
A smartcam is a camera able to detect objects of interest and to communicate with other smartcameras.
In many cases it is also assumed to be mounted on a drone as to be able to freely move around in the environment.
In Alchemist, smartcams are simulated as
Node
s
equipped with specific
Reaction
s
defining their capabilities and behaviour.
Single capabilities are expressed as
Action
s.
Vision
The most basic example of a camera is a
Node
containing a
Reaction
with the
CameraSee
action.
Warning
Note: the
CameraSee
action currently
only works in 2D environments supporting euclidean geometry,
for example
Continuous2DEnvironment
.
CameraSee
requires the following parameters:
- the distance of the field of view,
- its angle in degrees, and
- the name of the
Molecule
which will contain the ouput, namely, the list of nodes contained in the field of view, which is updated every time the action is triggered, - optionally, a fourth parameter can be defined in order to filter the output,
such parameter is expected to be the name of a
Molecule
which has to be contained in aNode
for it to be visible, e.g., if it iswanted
then only nodes containing a molecule namedwanted
will be seen.
Movement
The ability to move can be defined using movement actions such as
MoveToTarget
or
FollowAtDistance
.
MoveToTarget
expects 2 parameters:
- the name of the molecule containing the target’s position, and
- the movement speed.
FollowAtDistance
requires:
- the name of the molecule containing the target’s position,
- the distance to mantain from the target, and
- the movement speed.
Rotation
HeadTowardTarget
can be used to instruct cameras to always face the specified target.
Spin
only requires the angular speed and will make the camera spin around itself like a radar.
Other behavior
Without defining an algorithm the cameras wouldn’t do anything interesting. Algorithms can be definied in a moltitude of different ways, depending on the incarnation. Usually, camera readings are used as sensors that get read by, e.g., Protelis or Scafi programs.