[ROS] LGSVL Simulator カスタマイズ – Color Camera編

何を学習するのか?

LGSVLの車に乗ってるセンサーなどをカスタマイズする方法を学びます。

新しいVehicleを作る

既存の車のVehicle URL を取得します。

JSONで車載情報を記述する

車リストのスパナマークをクリックすると
以下の表示がされます。

JSONのフォーマットは以下に記載されています。

Sensor parameters – LGSVL Simulator

デフォルトの車のJSONを確認

[
    {
        "type": "GPS Device",
        "name": "GPS",
        "params": {
            "Frequency": 12.5,
            "Topic": "/nmea_sentence",
            "Frame": "gps",
            "IgnoreMapOrigin": true
        },
        "transform": {
            "x": 0,
            "y": 0,
            "z": 0,
            "pitch": 0,
            "yaw": 0,
            "roll": 0
        }
    },
    {
        "type": "GPS Odometry",
        "name": "GPS Odometry",
        "params": {
            "Frequency": 12.5,
            "Topic": "/odom",
            "Frame": "gps",
            "IgnoreMapOrigin": true
        },
        "transform": {
            "x": 0,
            "y": 0,
            "z": 0,
            "pitch": 0,
            "yaw": 0,
            "roll": 0
        }
    },
    {
        "type": "IMU",
        "name": "IMU",
        "params": {
            "Topic": "/imu_raw",
            "Frame": "imu"
        },
        "transform": {
            "x": 0,
            "y": 0,
            "z": 0,
            "pitch": 0,
            "yaw": 0,
            "roll": 0
        }
    },
    {
        "type": "Lidar",
        "name": "Lidar",
        "params": {
            "LaserCount": 32,
            "MinDistance": 0.5,
            "MaxDistance": 100,
            "RotationFrequency": 10,
            "MeasurementsPerRotation": 360,
            "FieldOfView": 41.33,
            "CenterAngle": 10,
            "Compensated": true,
            "PointColor": "#ff000000",
            "Topic": "/points_raw",
            "Frame": "velodyne"
        },
        "transform": {
            "x": 0,
            "y": 2.312,
            "z": -0.3679201,
            "pitch": 0,
            "yaw": 0,
            "roll": 0
        }
    },
    {
        "type": "Color Camera",
        "name": "Main Camera",
        "params": {
            "Width": 1920,
            "Height": 1080,
            "Frequency": 15,
            "JpegQuality": 75,
            "FieldOfView": 50,
            "MinDistance": 0.1,
            "MaxDistance": 1000,
            "Topic": "/simulator/camera_node/image/compressed",
            "Frame": "camera"
        },
        "transform": {
            "x": 0,
            "y": 1.7,
            "z": -0.2,
            "pitch": 0,
            "yaw": 0,
            "roll": 0
        }
    },
    {
        "type": "Keyboard Control",
        "name": "Keyboard Car Control"
    },
    {
        "type": "Wheel Control",
        "name": "Wheel Car Control"
    },
    {
        "type": "Vehicle Control",
        "name": "Autoware Car Control",
        "params": {
            "Topic": "/vehicle_cmd"
        }
    }
]

車載センサーのJSON記述を変更してみる

[
    {
        "type": "Color Camera",
        "name": "Main Camera",
        "params": {
            "Width": 1920,
            "Height": 1080,
            "Frequency": 15,
            "JpegQuality": 75,
            "FieldOfView": 50,
            "MinDistance": 0.1,
            "MaxDistance": 1000,
            "Topic": "/simulator/camera_node/image/compressed",
            "Frame": "camera"
        },
        "transform": {
            "x": 0,
            "y": 1.7,
            "z": -0.2,
            "pitch": 0,
            "yaw": 0,
            "roll": 0
        }
    },
    {
        "type": "Color Camera",
        "name": "Back Camera",
        "params": {
            "Width": 1920,
            "Height": 1080,
            "Frequency": 15,
            "JpegQuality": 75,
            "FieldOfView": 50,
            "MinDistance": 0.1,
            "MaxDistance": 1000,
            "Topic": "/simulator/camera_node2/image/compressed",
            "Frame": "camera"
        },
        "transform": {
            "x": 0,
            "y": 1.7,
            "z": 0.2,
            "pitch": 0,
            "yaw": 180,
            "roll": 0
        }
    },
    {
        "type": "Keyboard Control",
        "name": "Keyboard Car Control"
    },
    {
        "type": "Wheel Control",
        "name": "Wheel Car Control"
    },
    {
        "type": "Vehicle Control",
        "name": "Autoware Car Control",
        "params": {
            "Topic": "/vehicle_cmd"
        }
    }
]

Color Cameraのパラメータ

Simulationsで作成して車を反映

シュミレーターを起動してBridgeを確認

追加したカメラの映像を確認する

$ roslaunch rosbridge_server rosbridge_websocket.launc
$ rostopic list
$ rqt_image_view

設定したカメラの画像がROS経由で取得出来る事が確認できます。

$ rviz

参考サイト

自動運転シミュレータ “LGSVL SIMULATOR” を使ってみる – Qiita

投稿者: yoshimax

Software Engineer #Unity #iOS