コード例 #1
0
ファイル: camera.py プロジェクト: undefinedcodezhong/qibullet
    def __init__(self,
                 robot_model,
                 link,
                 hfov,
                 vfov,
                 physicsClientId=0,
                 near_plane=0.01,
                 far_plane=100):
        """
        Constructor

        Parameters:
            robot_model - The pybullet model of the robot
            link - The link (Link type) onto which the camera's attached
            hfov - The value of the horizontal field of view angle (in degrees)
            vfov - The value of the vertical field of view angle (in degrees)
            physicsClientId - The id of the simulated instance in which the
            camera is to be spawned
            near_plane - The near plane distance
            far_plane - The far plane distance
        """
        Sensor.__init__(self, robot_model, physicsClientId)
        self.link = link
        self.near_plane = near_plane
        self.far_plane = far_plane
        self.frame = None
        self.projection_matrix = None
        self.resolution = None
        self.hfov = None
        self.vfov = None
        self.resolution_lock = threading.Lock()
        self._setFov(hfov, vfov)

        if self.physics_client not in Camera.ACTIVE_CAMERA_ID.keys():
            Camera.ACTIVE_CAMERA_ID[self.physics_client] = -1
コード例 #2
0
    def __init__(self,
                 robot_model,
                 laser_id,
                 frequency=DEFAULT_FREQUENCY,
                 display=False,
                 physicsClientId=0):
        """
        Constructor

        Parameters:
            robot_model - The pybullet model of the robot.
            laser_id - The id of the link (Link type)
            onto which the Lasers' are attached.
            frequency - The update frequency of the laser in Hz (default
            frequency set to 6.25 Hz)
            display - boolean that allow the display of the laser
            physicsClientId - The id of the simulated instance in which the
            lasers are to be spawned
        """
        Sensor.__init__(self, robot_model, physicsClientId)
        self.ray_from = []
        self.ray_to = []
        self.ray_ids = []
        self.laser_value = [0] * NUM_RAY * NUM_LASER
        self.laser_id = laser_id
        self.display = display
        self.values_lock = threading.Lock()

        self.setFrequency(frequency)
コード例 #3
0
    def __init__(self, robot_model, fsr_link, physicsClientId=0):
        """
        Constructor

        Parameters:
            robot_model - The pybullet model of the robot
            fsr_link - The Link object corresponding to the link the FSR is
            attached to
            physicsClientId - The id of the simulated instance in the
            corresponding robot exists
        """
        Sensor.__init__(
            self,
            robot_model,
            physicsClientId)

        self.fsr_link = fsr_link
コード例 #4
0
    def __init__(self, robot_model, imu_link, frequency, physicsClientId=0):
        """
        Constructor. If the specified frequency is not a strictly positive int
        or float, the constructor will raise a pybullet error

        Parameters:
            robot_model - The pybullet model of the robot
            imu_link - The Link object corresponding to the link the IMU is
            attached to
            frequency - The frequency of the IMU, in Hz
            physicsClientId - The id of the simulated instance in which the
            IMU should be spawned
        """
        Sensor.__init__(self, robot_model, physicsClientId)

        self.setFrequency(frequency)

        self.imu_link = imu_link
        self.angular_velocity = [0.0, 0.0, 0.0]
        self._linear_velocity = [0.0, 0.0, 0.0]
        self.linear_acceleration = [0.0, 0.0, 0.0]
        self.values_lock = threading.Lock()
コード例 #5
0
    def __init__(self,
                 robot_model,
                 laser_id,
                 physicsClientId=0,
                 display=False):
        """
        Constructor

        Parameters:
            robot_model - The pybullet model of the robot.
            laser_id - The id of the link (Link type)
            onto which the Lasers' are attached.
            physicsClientId - The id of the simulated instance in which the
            lasers are to be spawned
            display - boolean that allow the display of the laser
        """
        Sensor.__init__(self, robot_model, physicsClientId)
        self.ray_from = []
        self.ray_to = []
        self.ray_ids = []
        self.laser_value = [0] * NUM_RAY * NUM_LASER
        self.laser_id = laser_id
        self.display = display
コード例 #6
0
    def __init__(
            self,
            robot_model,
            camera_id,
            camera_link,
            hfov,
            vfov,
            physicsClientId=0,
            near_plane=0.01,
            far_plane=100):
        """
        Constructor

        Parameters:
            robot_model - The pybullet model of the robot
            camera_id - an int describing the id of the camera
            camera_link - The link (Link type) onto which the camera's attached
            hfov - The value of the horizontal field of view angle (in degrees)
            vfov - The value of the vertical field of view angle (in degrees)
            physicsClientId - The id of the simulated instance in which the
            camera is to be spawned
            near_plane - The near plane distance
            far_plane - The far plane distance
        """
        Sensor.__init__(self, robot_model, physicsClientId)
        self.camera_id = camera_id
        self.camera_link = camera_link
        self.near_plane = near_plane
        self.far_plane = far_plane
        self.frame = None
        self.projection_matrix = None
        self.resolution = None
        self.hfov = None
        self.vfov = None
        self.intrinsic_matrix = None
        self.resolution_lock = threading.Lock()
        self._setFov(hfov, vfov)
コード例 #7
0
 def __init__(self, physics_client):
     """
     Constructor
     """
     Sensor.__init__(self, -1, physics_client)