Nao Object Tracking
There is a list of targets that Nao can track using the Naoqi Tracker API, which works well under good lighting conditions. Here is a walkthrough on how to track a face with its head and a red ball with its arms.
Track a face with Nao’s head
First, import the necessary functions from the SIC framework:
from sic_framework.devices import Nao
from sic_framework.devices.common_naoqi.naoqi_stiffness import Stiffness
from sic_framework.devices.common_naoqi.naoqi_tracker import (
RemoveTargetRequest,
StartTrackRequest,
StopAllTrackRequest,
)
Connect to the Nao (computer must be connected to the same network)
nao = Nao(ip="NAO_IP_HERE")
Set a tracking target, a list of available targets can be found here: ALTracker — Aldebaran 2.5.11.14a documentation
target_name = "Face"
Since we want to use the head to track a face, we need to set the stiffness to 1 to enable the motors to control the head joint
Start tracking, the size is the diameter of the target and a list of available modes can be found here: ALTracker — Aldebaran 2.5.11.14a documentation
Unregister a target
Track a red ball with Nao’s arms
Set a new target
Set a robot position relative to target. This is only needed in Move mode. The parameters represent [coordX, coordY, coordWz, thresholdX, thresholdY, thresholdWz]. In this case, the robot stays 30 cm away (along the x-axis) with a 10 cm threshold from the red ball. The XYZ frame reference for the robot can be found here position-identification
Track a red ball
4. Stop all tracking. This will put the robot into rest mode, unlocking all joints and setting stiffness to 0
A complete script for this tutorial can be found here: demo_nao_tracker.py