2.2 Actions
Cozmo is primarily designed to work as a virtual
companion. Therefore, its behavior creates the
impression of a personality. For this purpose, it is for
instance able to recognize different human faces and
to differentiate between cats and dogs.
However, the most important actions for the
approach of following a line are movement, taking
pictures and setting the lift as well as the head height.
While positioning the robot's lift and head is only
needed at the start to get an optimal view of the scene
in front of the robot, the real challenge is the
permanent control of the movement.
In order to keep things simple, the movement was
limited to a finite set of actions. Consequently, the
robot was forced to use one of the predefined actions
move forward, turn left, turn right or stop. Each of
these options can only be carried out in a certain speed
that is given by the physics of the engine and the
geometry of the robot itself. Turn left and turn right
lead to a short speed difference of the left and the right
caterpillar resulting in a slight change of the robot's
heading of only a few degrees.
2.3 Observations
One of the robot's sensors is a camera, which can be
found in the bottom half of its head and whose
pictures are accessible via SDK after subscribing to
the proper event.
The robot needs its camera to identify the line
drawn on the ground in front of it. Accordingly, the
head height must be set to the minimum to let the
camera focus on the ground. Additionally, the lift is
not allowed to cover the line and must be set to the
maximum height.
As a result, the camera shows a 640x480 pixel
image of the line on the ground, which can be used as
state information for reinforcement learning.
3 DIGITAL TWIN
3.1 Unity
A 3D-model of the robot was used to visualize the
digital twin in Unity. This scaled CAD-model was
originally created in Tinkercad, an online CAD-
program (Gearcortex, 2018).
After reducing the number of the model's
polygons, it was imported into Unity. Based on this
3D-data, the virtual camera was placed. The position
corresponds to the spot within the real robot. In
addition, the Cozmo SDK was used to get the head
angle from the physical robot in order to replicate it
on the virtual camera.
A comparison between the image of the virtual
and the real camera was made. For this purpose, an
object was positioned right on the edge of the
particular camera's field of view. Afterwards, the
distance between the object and the specific camera
was measured. As a result, the virtual camera was
adjusted to match the real-world camera.
Finally, the Unity components Boxcollider and
Rigidbody were added to the digital twin. These
scripts ensure that the virtual Cozmo can be moved.
Moreover, it can collide with other objects in the
Unity scene (Fig. 1).
Figure 1: Model of the Digital Twin.
3.2 Actions
The virtual Cozmo uses the same discrete action
space as the physical robot. The actions correspond
with the movement states of the real robot, namely
move forward, turn left, turn right and stop.
In order to reproduce the different possibilities in
the virtual environment, the exact movement
characteristics of the real robot must be known. The
API can indeed be used to set the speed of the
physical robot. However, to achieve proper results the
actual behavior has been measured. This applies to
both, the forward motion and the rotary motion.
In order to simulate this speed in virtual mode, a
distance was defined. The times which the real as well
as the virtual Cozmo needed to complete the distance
were measured. By comparing the required times of
the robots, the speed of the virtual robot was adjusted
until the times coincided.
The same procedure was performed for the
rotation speed. It is for this reason that a fixed rotation
has been set for the real robot to complete. In addition,
ICPRAM 2020 - 9th International Conference on Pattern Recognition Applications and Methods
382