def __init__(self): Car.__init__(self) self.getType() self.getEngineType() self.lidar = self.getDevice("lidar") self.lidar.enable(5000) self.lidar.enablePointCloud() print(self.lidar.isPointCloudEnabled()) self.keyboard.enable(10) self.speed = 0 print("^" * 10)
def __init__(self): Car.__init__(self) self.saveStep = 0 self.steeringAngle = 0.0 self.velocity = cfg.param.velocity self.controlTime = cfg.robot.time self.basicTime = self.getBasicTimeStep() print("#" * 40) print("This is auto-Vehicle!") print("Here are my Info: ") print("My Synchronization: ", self.getSynchronization()) print("My Basic Time Step: ", self.getBasicTimeStep()) print("My Control Time Step: ", self.controlTime) print("#" * 40) print("Here are my Device Info: ") print("#" * 40) print("Lidar Enabled: ", cfg.lidar.isEnable) if cfg.lidar.isEnable: self.lidar = self.getDevice("lidar") self.lidar.enable(cfg.lidar.samplingPeriod) self.lidar.enablePointCloud() self.lidar.setFrequency(cfg.lidar.frequency) print("Sampling Period: ", self.lidar.getSamplingPeriod()) print("Rotation Frequency: ", self.lidar.getFrequency()) print("#" * 40) print("GPS Enabled: ", cfg.gps.isEnable) if cfg.gps.isEnable: self.gps = self.getDevice("gps") self.gps.enable(cfg.gps.samplingPeriod) print("Sampling Period: ", self.gps.getSamplingPeriod()) print("#" * 40) print("Camera Enabled: ", cfg.camera.isEnable) if cfg.camera.isEnable: self.firstCall = True self.filterSize = 3 self.cameraChannel = 3 self.oldCameraValue = [0, 0, 0] self.camera = self.getDevice("camera") self.camera.enable(cfg.camera.samplingPeriod) self.cameraImgWidth = self.camera.getWidth() self.cameraImgHeight = self.camera.getHeight() self.cameraImgFov = self.camera.getFov() print("Sampling Period: ", self.camera.getSamplingPeriod()) print("Image Width: ", self.cameraImgWidth) print("Image Height: ", self.cameraImgHeight) print("#" * 40) print("Sick Enabled: ", cfg.sick.isEnable) if cfg.sick.isEnable: self.HALFAREA = 20 self.sick = self.getDevice("Sick LMS 291") self.sick.enable(cfg.sick.samplingPeriod) self.sickWidth = self.sick.getHorizontalResolution() self.sickRange = self.sick.getMaxRange() self.sickFov = self.sick.getFov() print("Sampling Period: ", self.sick.getSamplingPeriod()) print("Sick Width: ", self.sickWidth) print("Sick Range: ", self.sickRange) print("Sick Fov: ", self.sickFov) print("#" * 40) print("PID Enabled: ", cfg.pid.isEnable) if cfg.pid.isEnable: self.needResetPID = False self.oldPIDValue = 0.0 self.integral = 0.0 print("KP: ", cfg.pid.KP) print("KI: ", cfg.pid.KI) print("KD: ", cfg.pid.KD) print("#" * 40) self.setHazardFlashers(True) self.setDippedBeams(True) self.setAntifogLights(True) self.setWiperMode(False) self.setCruisingSpeed(self.velocity)