carla学习笔记2 传感器和数据
第四。傳感器和數據
傳感器是從周圍環境中檢索數據的參與者。它們對于為駕駛人創造學習環境至關重要。
本頁總結了開始處理傳感器所需的一切。它介紹了可用的類型及其生命周期的逐步指南。有關每個傳感器的詳細信息,請參閱傳感器參考?.
- 傳感器逐步
- 設置
- 產卵
- 聽
- 數據
- 傳感器類型
- 攝像機
- 探測器
- 其他
傳感器逐步
類?carla.Sensor定義一種能夠測量和流式傳輸數據的特殊類型的參與者。
- 這是什么數據?根據傳感器的類型,其變化很大。所有類型的數據都繼承自carla.SensorData?.
- 他們什么時候檢索數據?在每個模擬步驟上,或者在注冊某個事件時。取決于傳感器的類型。
- 他們如何檢索數據?每個傳感器都有聽()方法來接收和管理數據。
盡管存在差異,但所有傳感器的使用方式都是相似的。
設置
與其他參與者一樣,找到藍圖并設置特定屬性。這在處理傳感器時至關重要。它們的屬性將決定所獲得的結果。這些在傳感器參考?.
以下示例設置儀表板高清攝像頭。
# Find the blueprint of the sensor. blueprint = world.get_blueprint_library().find('sensor.camera.rgb') # Modify the attributes of the blueprint to set image resolution and field of view. blueprint.set_attribute('image_size_x', '1920') blueprint.set_attribute('image_size_y', '1080') blueprint.set_attribute('fov', '110') # Set the time in seconds between sensor captures blueprint.set_attribute('sensor_tick', '1.0')產卵
附件和附件類型,是至關重要的。傳感器應該連接到一個父參與者,通常是一個交通工具,跟蹤它周圍并收集信息。附件類型將決定其位置如何與所述車輛相關。
- 剛性連接移動對于其父位置是嚴格的。這是從模擬中檢索數據的正確附件。
- 彈簧臂附件只需很少的加速和減速,運動就變得輕松了。此附件僅推薦用于錄制模擬視頻。移動是平滑的,并且在更新相機位置時避免了“跳躍”。
重要的
使用附件生成時,位置必須相對于父參與者。
聽
每個傳感器都有listen()方法。每次傳感器檢索數據時都會調用此函數。
參數callback是一個lambda函數. 它描述了在檢索數據時傳感器應該做什么。這必須將數據作為參數檢索。
# do_something() will be called each time a new image is generated by the camera. sensor.listen(lambda data: do_something(data))...# This collision sensor would print everytime a collision is detected. def callback(event):for actor_id in event:vehicle = world_ref().get_actor(actor_id)print('Vehicle too close: %s' % vehicle.type_id)sensor02.listen(callback)數據
大多數傳感器數據對象都具有將信息保存到磁盤的功能。這將允許它在其他環境中使用。
傳感器數據在傳感器類型之間有很大的不同。看看傳感器參考得到詳細的解釋。但是,所有這些都帶有一些基本信息。
| frame | int | Frame number when the measurement took place. |
| timestamp | double | Timestamp of the measurement in simulation seconds since the beginning of the episode. |
| transform | carla.Transform | World reference of the sensor at the time of the measurement. |
注意:
is_listening?is a?sensor attribute?that enables/disables data listening at will.
sensor_tick?is a?blueprint attribute?that sets the simulation time between data received.
傳感器類型
攝像機
從他們的角度看世界。helper類卡拉彩色轉換器將修改所述圖像以表示不同的信息。
- 檢索數據每個模擬步驟
| Depth | carla.Image | Renders the depth of the elements in the field of view in a gray-scale map. |
| RGB | carla.Image | Provides clear vision of the surroundings. Looks like a normal photo of the scene. |
| Semantic segmentation | carla.Image | Renders elements in the field of view with a specific color according to their tags. |
探測器
當數據附加到的對象注冊特定事件時檢索數據。
- 檢索數據觸發時
| Collision | carla.CollisionEvent | Retrieves collisions between its parent and other actors. |
| Lane invasion | carla.LaneInvasionEvent | Registers when its parent crosses a lane marking. |
| Obstacle | carla.ObstacleDetectionEvent | Detects possible obstacles ahead of its parent. |
其他
不同的功能,如導航、物理特性測量和場景的二維/三維點地圖。
- 檢索數據每個模擬步驟
| GNSS | carla.GNSSMeasurement | Retrieves the geolocation of the sensor. |
| IMU | carla.IMUMeasurement | Comprises an accelerometer, a gyroscope, and a compass. |
| LIDAR | carla.LidarMeasurement | A rotating LIDAR. Generates a 4D point cloud with coordinates and intensity per point to model the surroundings. |
| Radar | carla.RadarMeasurement | 2D point map modelling elements in sight and their movement regarding the sensor. |
| RSS | carla.RssResponse | Modifies the controller applied to a vehicle according to safety checks. This sensor works in a different manner than the rest, and there is specific?RSS documentation?for it. |
| Semantic LIDAR | carla.SemanticLidarMeasurement | A rotating LIDAR. Generates a 3D point cloud with extra information regarding instance and semantic segmentation. |
這是一個傳感器和如何檢索模擬數據。
對卡拉的介紹到此結束。然而,還有很多東西要學。
?
?
總結
以上是生活随笔為你收集整理的carla学习笔记2 传感器和数据的全部內容,希望文章能夠幫你解決所遇到的問題。
- 上一篇: 快手Java后台三面,意向已拿,面试官都
- 下一篇: 自家特产支持一下呗