Target.py

Last modified: 2023-07-15

View on GitHub

This file defines the Target class used in the RoboX system.

ExplanationCode

Initialize Target class with depth, yaw, pitch, and imgPoints

class Target:
    def __init__(self, target_dict):
        self.depth = target_dict.get("depth")
        self.yaw = target_dict.get("Yaw")
        self.pitch = target_dict.get("Pitch")
        self._imgPoints = target_dict.get("imgPoints")

Getter for imgPoints

    @property
    def imgPoints(self):
        return self._imgPoints

Setter for imgPoints

    @imgPoints.setter
    def imgPoints(self, value):
        self._imgPoints = value

Property for target_coor

    @property
    def target_coor(self):
        return [[int(self.imgPoints[0][0]), int(self.imgPoints[0][1])],
                [int(self.imgPoints[1][0]), int(self.imgPoints[1][1])],
                [int(self.imgPoints[2][0]), int(self.imgPoints[2][1])],
                [int(self.imgPoints[3][0]), int(self.imgPoints[3][1])]]

Getter for bottomLeft

    @property
    def bottomLeft(self):
        return self.target_coor[0]

    @property
    def topLeft(self):
        return self.target_coor[1]

Getter for topRight

    @property
    def topRight(self):
        return self.target_coor[2]

Getter for bottomRight

    @property
    def bottomRight(self):
        return self.target_coor[3]