embodiedcity.client

Module Contents

Classes

Data

API

embodiedcity.client.__all__

[‘ImageType’, ‘CameraID’, ‘POI’, ‘DroneClient’]

class embodiedcity.client.ImageType
Scene

0

Scene (RGB)

DepthPlanar

1

DepthPlanar (Depth)

Segmentation

2

class embodiedcity.client.CameraID
FrontCenter

0

front_center

FrontRight

1

front_right

FrontLeft

2

front_left

BottomCenter

3

bottom_center

BackCenter

4

back_center

class embodiedcity.client.POI

Bases: typing.NamedTuple

id: int

None

x: float

None

y: float

None

name: str

None

category: str

None

class embodiedcity.client.AffineTransformer

Initialization

compute_affine_transform(src_points, dst_points)

Computes the affine transformation matrix that maps src_points to dst_points.

apply_affine_transform(points, transform)

Applies the affine transformation to a set of points.

local_to_latlon(x, y)

Converts local coordinates to latitude and longitude.

latlon_to_local(lat, lon)

Converts latitude and longitude to local coordinates.

class embodiedcity.client.DroneClient(base_url: str, drone_id: str, token: str)

Initialization

Args:

  • base_url: The base URL of the server

  • drone_id: The ID of the drone

  • token: The token to authenticate requests with the server

_make_request(action: str, *args)
async _amake_request(action: str, *args)
_prepare_pois()
move_back_forth(distance: float)

Move the drone back and forth by a certain distance

Args:

  • distance: The distance to move the drone by (unit: meters). distance > 0 means moving forward, distance < 0 means moving backward.

Returns:

  • None

async amove_back_forth(distance: float)

Move the drone back and forth by a certain distance

Args:

  • distance: The distance to move the drone by (unit: meters). distance > 0 means moving forward, distance < 0 means moving backward.

Returns:

  • None

move_horizontal(distance: float)

Move the drone left and right by a certain distance

Args:

  • distance: The distance to move the drone by (unit: meters). distance > 0 means moving left, distance < 0 means moving right.

Returns:

  • None

async amove_horizontal(distance: float)

Move the drone left and right by a certain distance

Args:

  • distance: The distance to move the drone by (unit: meters). distance > 0 means moving left, distance < 0 means moving right.

Returns:

  • None

move_vertical(distance: float)

Move the drone up and down by a certain distance

Args:

  • distance: The distance to move the drone by (unit: meters). distance > 0 means moving up, distance < 0 means moving down.

Returns:

  • None

async amove_vertical(distance: float)

Move the drone up and down by a certain distance

Args:

  • distance: The distance to move the drone by (unit: meters). distance > 0 means moving up, distance < 0 means moving down.

Returns:

  • None

move_by_yaw(yaw: float)

Rotate the drone by a certain angle

Args:

  • yaw: The angle to rotate the drone by (unit: radians). Positive values mean rotating counterclockwise, negative values mean rotating clockwise.

Returns:

  • None

async amove_by_yaw(yaw: float)

Rotate the drone by a certain angle

Args:

  • yaw: The angle to rotate the drone by (unit: radians). Positive values mean rotating counterclockwise, negative values mean rotating clockwise.

Returns:

  • None

get_image(image_type: int, camera_id: int)

Get an image from the drone

Args:

  • image_type: The type of image to get

  • camera_id: The ID of the camera to get the image from

Returns:

  • numpy.array: The image

async aget_image(image_type: int, camera_id: int)

Get an image from the drone

Args:

  • image_type: The type of image to get

  • camera_id: The ID of the camera to get the image from

Returns:

  • numpy.array: The image

get_current_state()

Get the current state of the drone

Returns:

  • [x, y, z]: The position of the drone

  • [pitch, roll, yaw]: The orientation of the drone

async aget_current_state()

Get the current state of the drone

Returns:

  • [x, y, z]: The position of the drone

  • [pitch, roll, yaw]: The orientation of the drone

move_to_position(x: float, y: float, z: float)

Move the drone to a certain position

Args:

  • x: The x-coordinate of the target position

  • y: The y-coordinate of the target position

  • z: The z-coordinate of the target position

Returns:

  • None

async amove_to_position(x: float, y: float, z: float)

Move the drone to a certain position

Args:

  • x: The x-coordinate of the target position

  • y: The y-coordinate of the target position

  • z: The z-coordinate of the target position

Returns:

  • None

set_vehicle_pose(x: float, y: float, z: float, pitch: float, roll: float, yaw: float)

Set the pose of the drone. Attention: This function will teleport the drone to the target position.

Args:

  • x: The x-coordinate of the target position

  • y: The y-coordinate of the target position

  • z: The z-coordinate of the target position

  • pitch: The pitch of the drone

  • roll: The roll of the drone

  • yaw: The yaw of the drone

Returns:

  • None

async aset_vehicle_pose(x: float, y: float, z: float, pitch: float, roll: float, yaw: float)

Set the pose of the drone. Attention: This function will teleport the drone to the target position.

Args:

  • x: The x-coordinate of the target position

  • y: The y-coordinate of the target position

  • z: The z-coordinate of the target position

  • pitch: The pitch of the drone

  • roll: The roll of the drone

  • yaw: The yaw of the drone

Returns:

  • None

query_pois(x: float, y: float, radius: float, category_prefix: str = '', limit: Optional[int] = None) List[Tuple[embodiedcity.client.POI, float]]

Query the POIs whose categories satisfy the prefix within the specified radius of the center point (sorted by distance).

Args:

  • x: The x-coordinate of the center of the area

  • y: The y-coordinate of the center of the area

  • radius: The radius of the area (unit: meters)

  • category_prefix: The prefix of the category of the POIs to query

  • limit: The maximum number of POIs to return, sorted by distance, closest ones first (default to None)

Returns:

  • List[Tuple[POI, float]]: The (poi, distance) pairs in the area sorted by distance