Skip to content

Locations

lcgao edited this page Nov 17, 2020 · 51 revisions

Navigation

There are two main use cases with regards to locations. The first is location management, and the second is location navigation. The SDK provides methods that allows developers to handle both. Location management allows you to control temi's locations by saving, deleting, fetching and monitoring their changes, while location navigation allows you to send temi to one of those locations and monitor its navigation status while it's in motion.

API Overview

Return Method Description
boolean saveLocation(String location) Save location
boolean deleteLocation(String location) Delete location
List<String> getLocations() Fetch all saved locations
void goTo(String location) Send temi to a specific location
void goToPosition(Position position) Send temi to a specific position(coordinate)
MapDataModel getMapData() Get the map data
void repose() Repositioning temi
Interface Description
OnLocationsUpdatedListener Locations updated listener
OnGoToLocationStatusChangedListener Go to location(position) status changed listener
OnDistanceToLocationChangedListener Distance to locations changed listener
OnCurrentPositionChangedListener Current position changed listener
OnReposeStatusChangedListener Listener for the status changed of repositioning
Model Description
Position Position(coordinate) in the map
MapDataModel The map data
MapImage The map image data

Methods

saveLocation()

Use this method to save a new location for temi. Locate temi at the location you wish to save and give it a name, the location coordinates are extracted and passed automatically in the request.

  • Parameters

    Parameter Type Description
    location String Location name you wish to save
  • Return

    Type Description
    boolean true if save successfully, false otherwise
  • Prototype

    boolean saveLocation(String location);
  • Required permissions

    None.

  • Support from

    0.10.36


deleteLocation()

Use this method to delete a saved location.

  • Parameters

    Parameter Type Description
    location String Location name you wish to delete
  • Return

    Type Description
    boolean true if delete successfully, false otherwise
  • Prototype

    boolean deleteLocation(String location);
  • Required permissions

    None.

  • Support from

    0.10.44


getLocations()

Use this method to fetch a list of saved locations.

  • Return

    Type Description
    List<String> Locations list
  • Prototype

    List<String> getLocations();
  • Required permissions

    None.

  • Support from

    0.10.36


goTo()

Use this method to send temi to one of your saved locations.

  • Parameters

    Parameter Type Description
    location String Location name you wish the robot to navigate to
  • Prototype

    void goTo(String location);
  • Required permissions

    None.

  • Support from

    0.10.36


getMapData()

Use this method to get the map data.

This method currently(0.10.70) only supports relatively small map, we will support large map in the next version.
(Fixed in version 0.10.71)

  • Return

    Type Description
    MapDataModel The map data
  • Prototype

    MapDataModel getMapData();
  • Required permissions

    Map

  • Support from

    0.10.70

  • Note

    This method is a time-consuming operation and is recommended to be used in a non-main thread. For more details please refer to the Sampe code.


goToPosition()

Use this method to send temi to a specific position(coordinate).

  • Parameters

    Parameter Type Description
    position Position Destination coordinate. Ignore its' attribute tiltAngle in this method.
  • Prototype

    void goToPosition(Position position);
  • Required permissions

    None.

  • Support from

    0.10.70

repose()

Use this method to start repositioning if temi has lost his position(Caused by being lifted, dragged, etc.).

  • Prototype

    void repose();
  • Required permissions

    None.

  • Support from

    0.10.72


Interfaces

OnLocationsUpdatedListener

Set your context to implement this listener and add the override method to get the list of saved locations every time it changes.

Prototype

package com.robotemi.sdk.listeners;

interface OnLocationsUpdatedListener {}

Abstract methods

  • Parameters

    Parameter Type Description
    locations List<String> All saved locations list
  • Prototype

    abstract void onLocationsUpdated(List<String> locations)

Method for adding listener

  • Parameters

    Parameter Type Description
    listener OnLocationsUpdatedListener An instance of a class that implements this interface
  • Prototype

    void addOnLocationsUpdatedListener(OnLocationsUpdatedListener listener);

Method for removing listener

  • Parameters

    Parameter Type Description
    listener OnLocationsUpdatedListener An instance of a class that implements this interface
  • Prototype

    void removeOnLocationsUpdatedListener(OnLocationsUpdatedListener listener);
  • Support from

    0.10.36


OnGoToLocationStatusChangedListener

Set your context to implement this listener and add the override method to get navigation information regarding temi's go to location action.

Prototype

package com.robotemi.sdk.listeners;

interface OnGoToLocationStatusChangedListener {}

Static constants

Constant Type Value Description
START String "start" Navigation to the location has started
CALCULATING String "calculating" Calculating the route to the location
GOING String "going" Calculated the route and is on its' way
COMPLETE String "complete" Arrived at the desired location
ABORT String "abort" Navigation aborted

Abstract methods

  • Parameters

    Parameter Type Description
    location String The name of the location temi is navigating to
    status String Navigation status
    descriptionId int Numerical code that reflects the description of the status
    description String Verbose more informative description of the navigation status (Such as obstacle info)
  • Prototype

    void onGoToLocationStatusChanged(String location, String status, int descriptionId, String description);

Method for adding listener

  • Parameters

    Parameter Type Description
    listener OnGoToLocationStatusChangedListener An instance of a class that implements this interface
  • Prototype

    void addOnGoToLocationStatusChangedListener(OnGoToLocationStatusChangedListener listener);

Method for removing listener

  • Parameters

    Parameter Type Description
    listener OnGoToLocationStatusChangedListener An instance of a class that implements this interface
  • Prototype

    void removeOnGoToLocationStatusChangedListener(OnGoToLocationStatusChangedListener listener);
  • Support from

    0.10.36


OnDistanceToLocationChangedListener

Set your context to implement this listener and add the override method to get the distances to saved locations.

Prototype

package com.robotemi.sdk.navigation.listener;

interface OnDistanceToLocationChangedListener {}

Abstract methods

  • Parameters

    Parameter Type Description
    distances Map<String, Float> A key-value pair collection with String type key(location name) and Float type value(distance)
  • Prototype

    void onDistanceToLocationChanged(Map<String, Float> distances);

Method for adding listener

  • Parameters

    Parameter Type Description
    listener OnDistanceToLocationChangedListener An instance of a class that implements this interface
  • Prototype

    void addOnDistanceToLocationChangedListener(OnDistanceToLocationChangedListener listener);

Method for removing listener

  • Parameters

    Parameter Type Description
    listener OnDistanceToLocationChangedListener An instance of a class that implements this interface
  • Prototype

    void removeOnDistanceToLocationChangedListener(OnDistanceToLocationChangedListener listener);
  • Support from

    0.10.70


OnCurrentPositionChangedListener

Set your context to implement this listener and add the override method to get current position information.

Prototype

package com.robotemi.sdk.navigation.listener;

interface OnCurrentPositionChangedListener {}

Abstract methods

  • Parameters

    Parameter Type Description
    position Position Current position
  • Prototype

    void onCurrentPositionChanged(Position position);

Method for adding listener

  • Parameters

    Parameter Type Description
    listener OnCurrentPositionChangedListener An instance of a class that implements this interface
  • Prototype

    void addOnCurrentPositionChangedListener(OnCurrentPositionChangedListener listener);

Method for removing listener

  • Parameters

    Parameter Type Description
    listener OnCurrentPositionChangedListener An instance of a class that implements this interface
  • Prototype

    void removeOnCurrentPositionChangedListener(OnCurrentPositionChangedListener listener);
  • Support from

    0.10.70


OnReposeStatusChangedListener

Set your context to implement this listener and add the override method to listen to the status changes of repositioning.

Prototype

interface OnReposeStatusChangedListener {}

Static constant

All constants here are only for the status of repositioning.

Constant Type Value Description
IDLE int 0 Idle
REPOSE_REQUIRED int 1 Ready to reposition
REPOSING_START int 2 Reposition started
REPOSING_GOING int 3 Repositioning
REPOSING_COMPLETE int 4 Reposition completed
REPOSING_OBSTACLE_DETECTED int 5 Obstacle detected during repositioning
REPOSING_ABORT int 6 Reposition abort

Abstract methods

  • Parameters

    Parameter Type Description
    status int Status of reposition
    description int Description of status
  • Prototype

    void onReposeStatusChanged(int status, String description);

Method for adding listener

  • Parameters

    Parameter Type Description
    listener OnReposeStatusChangedListener An instance of a class that implements this interface
  • Prototype

    void addOnReposeStatusChangedListener(OnReposeStatusChangedListener listener);

Method for removing listener

  • Parameters

    Parameter Type Description
    listener OnReposeStatusChangedListener An instance of a class that implements this interface
  • Prototype

    void removeOnReposeStatusChangedListener(OnReposeStatusChangedListener listener);
  • Support from

    0.10.72


Models

Position

Used for holding the position information.

Prototype

package com.robotemi.sdk.navigation.model;

class Position {}

Attributes

Attribute Type Description
x float Position coordinate x
y float Position coordinate y
yaw float -
tiltAngle Int Head tilt angle

MapDataModel

Used for holding the map data.

Prototype

package com.robotemi.sdk.map;

class MapDataModel {}

Attributes

Attribute Type Description
mapImage MapImage The map image data

MapImage

Used for holding the map image data.

Prototype

package com.robotemi.sdk.map;

class MapImage {}

Attributes

Attribute Type Description
typeId String -
rows int The size of the rows of the map data matrix
cols int The size of the columns of the map data matrix
dt String -
data List<Integer> The one-dimensional array converted from map data matrix
Clone this wiki locally