anki_vector.proximity

Support for Vector’s distance sensor.

Vector’s time-of-flight distance sensor has a usable range of about 30 mm to 1200 mm (max useful range closer to 300mm for Vector) with a field of view of 25 degrees.

The distance sensor can be used to detect objects in front of the robot.

Classes

ProximityComponent(robot)

Maintains the most recent proximity sensor data

ProximitySensorData(proto_data)

A distance sample from the time-of-flight sensor with metadata describing reliability of the measurement

class anki_vector.proximity.ProximityComponent(robot)

Maintains the most recent proximity sensor data

This will be updated with every broadcast RobotState, and can be queried at any time. Two sensor readings are made available:
  • the most recent data from the robot

  • the most recent data which was considered valid by the engine for usage

An example of how to extract sensor data:

import anki_vector

with anki_vector.Robot() as robot:
    proximity_data = robot.proximity.last_sensor_reading
    if proximity_data is not None:
        print('Proximity distance: {0}'.format(proximity_data.distance))
close()

Closing the touch component will unsubscribe from robot state updates.

property last_sensor_reading

The last reported sensor data.

import anki_vector

with anki_vector.Robot() as robot:
    last_sensor_reading = robot.proximity.last_sensor_reading
Return type

ProximitySensorData

Type

anki_vector.proximity.ProximitySensorData

class anki_vector.proximity.ProximitySensorData(proto_data)

A distance sample from the time-of-flight sensor with metadata describing reliability of the measurement

The proximity sensor is located near the bottom of Vector between the two front wheels, facing forward. The reported distance describes how far in front of this sensor the robot feels an obstacle is. The sensor estimates based on time-of-flight information within a field of view which the engine resolves to a certain quality value.

Four additional flags are supplied by the engine to indicate whether this proximity data is considered valid for the robot’s internal pathfinding. Respecting these is optional, but will help python code respect the behavior of the robot’s innate object avoidance.

property distance

The distance between the sensor and a detected object

import anki_vector

with anki_vector.Robot() as robot:
    distance = robot.proximity.last_sensor_reading.distance
Return type

Distance

property found_object

The sensor detected an object in the valid operating range.

import anki_vector

with anki_vector.Robot() as robot:
    found_object = robot.proximity.last_sensor_reading.found_object
Return type

bool

property is_lift_in_fov

Whether Vector’s lift is blocking the time-of-flight sensor. While the lift will send clear proximity signals, it’s not useful for object detection.

import anki_vector

with anki_vector.Robot() as robot:
    is_lift_in_fov = robot.proximity.last_sensor_reading.is_lift_in_fov
Return type

bool

property signal_quality

The quality of the detected object.

The proximity sensor detects obstacles within a given field of view, this value represents the likelihood of the reported distance being a solid surface.

import anki_vector

with anki_vector.Robot() as robot:
    signal_quality = robot.proximity.last_sensor_reading.signal_quality
Return type

float

property unobstructed

The sensor has confirmed it has not detected anything up to its max range.

import anki_vector

with anki_vector.Robot() as robot:
    unobstructed = robot.proximity.last_sensor_reading.unobstructed
Return type

bool