VisualServoing

class grid.model.navigation.visualservoing.VisualServoing(*args, **kwargs)

Visual Servoing Model, control the motion of robot based on vision feedback.

__init__()

initialize parameters for the visual servoing model

Return type:

None

moveDrone2Target(target_image_coord, camera_param)

move the drone towards the target in the image captured by the camera

Parameters:
  • target_image_coord (Tuple[float, float]) -- pixel coordinate (in xy format) of the target in the image plane

  • camera_param (Dict[str, Any]) -- parameters of the camera that captures the target: * width (int): image width * height (int): image height * fov (float): camera field of view in degrees * camera_orientation_euler_pry (Tuple[float, float, float]): camera orientation (pitch, roll, yaw) in degrees

Returns:

float: delta_yaw(degrees) np.ndarray: velocity vector for the drone to move towards the target

Return type:

Tuple[float, np.ndarray]

Example

>>> vs = VisualServoing()
>>> delta_yaw, velocity = vs.moveDrone2Target((100, 100), {"width": 256, "height": 256, "fov": 90, "camera_orientation_euler_pry": (0, 0, 0)})
>>> drone.setYaw(drone.simGetYaw() + delta_yaw)
>>> # move the drone towards target with velocity v for 30 seconds
>>> drone.moveByVelocity(v, 30)