def _getUnstructuedSettings(self): unstructuredSettings = rss.UnstructuredSettings() unstructuredSettings.pedestrianTurningRadius = physics.Distance(2.0) unstructuredSettings.driveAwayMaxAngle = physics.Angle(2.4) unstructuredSettings.vehicleYawRateChange = physics.AngularAcceleration( 0.3) unstructuredSettings.vehicleMinRadius = physics.Distance(3.5) unstructuredSettings.vehicleTrajectoryCalculationStep = physics.Duration( 0.2) return unstructuredSettings
def _get_ego_vehicle_dynamics(self): egoRssDynamics = rss.RssDynamics() egoRssDynamics.responseTime = physics.Duration(0.2) egoRssDynamics.alphaLat.accelMax = physics.Acceleration(0.1) egoRssDynamics.alphaLat.brakeMin = physics.Acceleration(-0.1) egoRssDynamics.alphaLon.accelMax = physics.Acceleration(0.1) egoRssDynamics.alphaLon.brakeMax = physics.Acceleration(-8.) egoRssDynamics.alphaLon.brakeMinCorrect = physics.Acceleration(-4.) egoRssDynamics.alphaLon.brakeMin = physics.Acceleration(-4.) egoRssDynamics.lateralFluctuationMargin = physics.Distance(0.) return egoRssDynamics
def _get_object_vehicle_dynamics(self): objectRssDynamics = rss.RssDynamics() objectRssDynamics.responseTime = physics.Duration(0.5) objectRssDynamics.alphaLat.accelMax = physics.Acceleration(1.) objectRssDynamics.alphaLat.brakeMin = physics.Acceleration(-1.) objectRssDynamics.alphaLon.accelMax = physics.Acceleration(4.) objectRssDynamics.alphaLon.brakeMax = physics.Acceleration(-8.) objectRssDynamics.alphaLon.brakeMinCorrect = physics.Acceleration(-4.) objectRssDynamics.alphaLon.brakeMin = physics.Acceleration(-4.) objectRssDynamics.lateralFluctuationMargin = physics.Distance(0.) return objectRssDynamics
def _get_ego_vehicle_dynamics(self): egoRssDynamics = rss.RssDynamics() egoRssDynamics.responseTime = physics.Duration(0.2) egoRssDynamics.maxSpeedOnAcceleration = physics.Speed(0.) egoRssDynamics.alphaLat.accelMax = physics.Acceleration(0.1) egoRssDynamics.alphaLat.brakeMin = physics.Acceleration(-0.1) egoRssDynamics.alphaLon.accelMax = physics.Acceleration(0.1) egoRssDynamics.alphaLon.brakeMax = physics.Acceleration(-8.) egoRssDynamics.alphaLon.brakeMinCorrect = physics.Acceleration(-4.) egoRssDynamics.alphaLon.brakeMin = physics.Acceleration(-4.) egoRssDynamics.lateralFluctuationMargin = physics.Distance(0.) egoRssDynamics.unstructuredSettings = self._getUnstructuedSettings() return egoRssDynamics
def test_interface(self): """ Main test part """ speed_a = physics.Speed(10.) speed_b = physics.Speed(20.) speed_c = speed_a + speed_b self.assertEqual(speed_c, 30.) t = physics.Duration(2.) a = physics.Acceleration(10.) speed_c = t * a self.assertEqual(speed_c, 20.) t = speed_c / a self.assertEqual(t, 2.)
def _prepare_world_model(self): """ Setup RSS world model """ occupied_region = rss.OccupiedRegion() occupied_region.segmentId = 0 occupied_region.latRange.minimum = physics.ParametricValue(0) occupied_region.latRange.maximum = physics.ParametricValue(2.0 / self.road_width) occupied_region.lonRange.minimum = physics.ParametricValue(0.) occupied_region.lonRange.maximum = physics.ParametricValue(5.0 / self.road_length) rss_vehicle_a = self._createObject(0, rss.ObjectType.EgoVehicle, 20., 0., occupied_region) occupied_region.lonRange.minimum = physics.ParametricValue(100.0 / self.road_length) occupied_region.lonRange.maximum = physics.ParametricValue((5.0 + 100) / self.road_length) rss_vehicle_b = self._createObject(1, rss.ObjectType.OtherVehicle, 10., 0., occupied_region) rss_scene = rss.Scene() rss_scene.egoVehicle = rss_vehicle_a rss_scene.object = rss_vehicle_b rss_scene.situationType = rss.SituationType.SameDirection road_segment = rss.RoadSegment() lane_segment = rss.LaneSegment() lane_segment.id = 0 lane_segment.length.minimum = physics.Distance(self.road_length) lane_segment.length.maximum = physics.Distance(self.road_length) lane_segment.width.minimum = physics.Distance(self.road_width) lane_segment.width.maximum = physics.Distance(self.road_width) lane_segment.type = rss.LaneSegmentType.Normal lane_segment.drivingDirection = rss.LaneDrivingDirection.Positive road_segment.append(lane_segment) rss_scene.egoVehicleRoad.append(road_segment) rss_scene.objectRssDynamics.responseTime = physics.Duration(0.5) rss_scene.objectRssDynamics.maxSpeedOnAcceleration = physics.Speed(0.) rss_scene.objectRssDynamics.alphaLat.accelMax = physics.Acceleration(1.) rss_scene.objectRssDynamics.alphaLat.brakeMin = physics.Acceleration(-1.) rss_scene.objectRssDynamics.alphaLon.accelMax = physics.Acceleration(4.) rss_scene.objectRssDynamics.alphaLon.brakeMax = physics.Acceleration(-8.) rss_scene.objectRssDynamics.alphaLon.brakeMinCorrect = physics.Acceleration(-4.) rss_scene.objectRssDynamics.alphaLon.brakeMin = physics.Acceleration(-4.) rss_scene.objectRssDynamics.lateralFluctuationMargin = physics.Distance(0.) rss_scene.objectRssDynamics.unstructuredSettings = self._getUnstructuedSettings() rss_scene.egoVehicleRssDynamics.responseTime = physics.Duration(0.2) rss_scene.egoVehicleRssDynamics.maxSpeedOnAcceleration = physics.Speed(0.) rss_scene.egoVehicleRssDynamics.alphaLat.accelMax = physics.Acceleration(0.1) rss_scene.egoVehicleRssDynamics.alphaLat.brakeMin = physics.Acceleration(-0.1) rss_scene.egoVehicleRssDynamics.alphaLon.accelMax = physics.Acceleration(0.1) rss_scene.egoVehicleRssDynamics.alphaLon.brakeMax = physics.Acceleration(-8.) rss_scene.egoVehicleRssDynamics.alphaLon.brakeMin = physics.Acceleration(-4.) rss_scene.egoVehicleRssDynamics.alphaLon.brakeMinCorrect = physics.Acceleration(-4.) rss_scene.egoVehicleRssDynamics.lateralFluctuationMargin = physics.Distance(0.) rss_scene.egoVehicleRssDynamics.unstructuredSettings = self._getUnstructuedSettings() self.world_model = rss.WorldModel() self.world_model.timeIndex = 1 self.world_model.scenes.append(rss_scene) self.world_model.defaultEgoVehicleRssDynamics.responseTime = physics.Duration(0.2) self.world_model.defaultEgoVehicleRssDynamics.maxSpeedOnAcceleration = physics.Speed(0.) self.world_model.defaultEgoVehicleRssDynamics.alphaLat.accelMax = physics.Acceleration(0.1) self.world_model.defaultEgoVehicleRssDynamics.alphaLat.brakeMin = physics.Acceleration(-0.1) self.world_model.defaultEgoVehicleRssDynamics.alphaLon.accelMax = physics.Acceleration(0.1) self.world_model.defaultEgoVehicleRssDynamics.alphaLon.brakeMax = physics.Acceleration(-8.) self.world_model.defaultEgoVehicleRssDynamics.alphaLon.brakeMin = physics.Acceleration(-4.) self.world_model.defaultEgoVehicleRssDynamics.alphaLon.brakeMinCorrect = physics.Acceleration(-4.) self.world_model.defaultEgoVehicleRssDynamics.lateralFluctuationMargin = physics.Distance(0.) self.world_model.defaultEgoVehicleRssDynamics.unstructuredSettings = self._getUnstructuedSettings()