Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix missing vehicle name in ros camera msg #4509

Open
wants to merge 5 commits into
base: main
Choose a base branch
from

Conversation

alonfaraj
Copy link
Contributor

@alonfaraj alonfaraj commented May 3, 2022

Fixes: #

About

This PR fix missing vehicle name in published Image camera header.
Applied for ros1 and ros2.

How Has This Been Tested?

Without this fix, it's not possible to show the image in rviz2 on the map/world frame.
Run ros wrapper and show the image in rviz2 under the world_enu frame.

Screenshots (if appropriate):

@alonfaraj alonfaraj changed the title Fix missing vehicle name in ros2 camera mgs Fix missing vehicle name in ros2 camera msg May 3, 2022
@alonfaraj alonfaraj changed the title Fix missing vehicle name in ros2 camera msg Fix missing vehicle name in ros camera msg May 3, 2022
@zimmy87
Copy link
Contributor

zimmy87 commented May 23, 2022

Hi @alonfaraj, thank you for submitting this fix. I tested this locally and it looks like it correctly renamed the camera frame and I can now see the camera image in rviz. However, I'm getting a warning message in rviz now when I add the camera topic: Expecting Camera Info on topic [/airsim_node/Drone1/Test0/camera_info]. No CameraInfo received. Topic may not exist.

Here are my repro steps:

  1. setup environment for running ROS2 wrapper from WSL2 using steps provided here
  2. apply fix
  3. run colcon build in AirSim\ros2
  4. start AirSim in Windows host machine with settings:
{
 "SimMode" : "Multirotor", 
 "SettingsVersion" : 1.2, 
 "SeeDocsAt" : "https://github.com/Microsoft/AirSim/blob/master/docs/settings.md",
 "Vehicles": {
    "Drone1": {
        "VehicleType": "SimpleFlight",
        "AutoCreate": true,
        "Sensors": {
            "Barometer":{
                "SensorType": 1,
                "Enabled": true,
                "PressureFactorSigma": 0.0001825
            },
            "MyLidar1": {
                "SensorType": 6,
                "Enabled" : true,
                "NumberOfChannels": 16,
                "PointsPerSecond": 10000,
                "X": 0, "Y": 0, "Z": -1,
                "DrawDebugPoints": true
            },
            "MyLidar2": {
                "SensorType": 6,
                "Enabled" : true,
                "NumberOfChannels": 4,
                "PointsPerSecond": 10000,
                "X": 0, "Y": 0, "Z": -1,
                "DrawDebugPoints": true
            }
        },
        "Cameras": {
            "Test0": {
                "CaptureSettings": [
                  {
                    "ImageType": 0,
                    "Width": 256,
                    "Height": 144,
                    "FOV_Degrees": 90,
                    "AutoExposureSpeed": 100,
                    "AutoExposureBias": 0,
                    "AutoExposureMaxBrightness": 0.64,
                    "AutoExposureMinBrightness": 0.03,
                    "MotionBlurAmount": 0,
                    "TargetGamma": 1.0,
                    "ProjectionMode": "",
                    "OrthoWidth": 5.12
                  }
                ],
                "NoiseSettings": [
                  {
                    "Enabled": false,
                    "ImageType": 0,

                    "RandContrib": 0.2,
                    "RandSpeed": 100000.0,
                    "RandSize": 500.0,
                    "RandDensity": 2,

                    "HorzWaveContrib":0.03,
                    "HorzWaveStrength": 0.08,
                    "HorzWaveVertSize": 1.0,
                    "HorzWaveScreenSize": 1.0,

                    "HorzNoiseLinesContrib": 1.0,
                    "HorzNoiseLinesDensityY": 0.01,
                    "HorzNoiseLinesDensityXY": 0.5,

                    "HorzDistortionContrib": 1.0,
                    "HorzDistortionStrength": 0.002
                  }
                ],
                "Gimbal": {
                  "Stabilization": 0,
                  "Pitch": 0, "Roll": 0, "Yaw": 0
                },
                "X": 0, "Y": 0, "Z": 0,
                "Pitch": 0, "Roll": 0, "Yaw": 0
            }
        }
    }
}
}
  1. in WSL2, source ROS2 setup: source install/setup.bash
  2. start ROS2 wrapper: ros2 launch airsim_ros_pkgs airsim_node.launch.py output:=screen host:=$WSL_HOST_IP
  3. in separate WSL2 command prompt, run: ros2 launch airsim_ros_pkgs rviz.launch.py
  4. click Add
  5. under By topic, add /airsim_node/Drone1/Test0/Scene

expected: camera topic added with Status: Ok
master_rviz_camera_prefix
actual: camera topic added with Status: Warn and warning message: Expecting Camera Info on topic [/airsim_node/Drone1/Test0/camera_info]. No CameraInfo received. Topic may not exist.
fix-ros-camera-tf-name_rviz_camera_postfix

Do you know why this warning is occurring after applying your fix? Additionally, I'm noticing with your fix there's still a frame named Test0_optical/static: does this frame need to be updated to include the vehicle name as well?
remaining_unnamed_frame

@alonfaraj
Copy link
Contributor Author

alonfaraj commented May 24, 2022

Hi @zimmy87, thanks for the review, I missed the camera info somehow.
I'm not entirely sure why we get this warning after applying the fix, but according to ros guidelines camera_info should be publish under the camera name namespace, in our case /airsim_node/Drone1/Test0/camera_info.

I made a fix so camera info is under the camera name namespace.
Also, you right about the frame Test0_optical/static, it's should contain the vehicle name and I fixed it as well. It's actually look like a typo bug, you can see here https://github.com/microsoft/AirSim/blob/master/ros2/src/airsim_ros_pkgs/src/airsim_ros_wrapper.cpp#L1213-L1214

1

The only problem I encounter now regarding the camera info is in case we have 2 different CaptureSettings for different image types.
Ideally, we should have only one camera info under the camera name, but in case we have Scene and Segmentation with different resolutions, we end up with 2 publishers /airsim_node/Drone1/Test0/camera_info which publish inconsistent data.

So we do need to change the frame id of the image msg, then we have to change the camera info topic to under the camera name namespace, but it will cause a problem when we have different CaptureSettings.
What do you think?

@jonyMarino
Copy link
Collaborator

Hi @alonfaraj!. Thanks for yet another contribution. If I understand what you are saying correctly, we should have a topic for each CaptureSettings of each camera. If so, why don't we add the ImageType of each CaptureSettings to the camera name? In this case, it would be /airsim_node/Drone1/Test0_0, where the last 0 would be the ImageType

@alonfaraj
Copy link
Contributor Author

alonfaraj commented May 29, 2022

Hi @jonyMarino, that's correct.
I have implemented the change you suggested which is probably the most reasonable.

1

2 things up to your decision:

  1. To follow ros convection, I changed the raw image to be published under /image, in our case /airsim_node/Drone1/Test0_0/image
  2. Should we go with image type as number or explicit name? I think explicit name would be easier. Let me know wdyt

@jonyMarino
Copy link
Collaborator

Excellent work @alonfaraj!

  1. OK
  2. Leave it as an explicit name. It would be good to keep correspondence with settings.json; maybe we can give the option to use explicit names also in the configuration.

@jonyMarino jonyMarino changed the base branch from master to main July 4, 2022 17:39
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants