Skip to content

ROS2 Wrapper: PID Controller node hangs/fails to receive odometry due to frame mismatch (odom_local vs odom_local_ned) #132

@GiacomoVianello-1

Description

@GiacomoVianello-1

Description

Hi there!

I am experiencing an issue with the ROS2 wrapper for CoSysAirSim where my PID controller node is unable to proceed, likely due to a discrepancy in the odometry frame conventions.

Steps to Reproduce

  1. In the first terminal, I launch the AirSim node with API control enabled and the drone armed: ros2 launch airsim_ros_pkgs airsim_node.launch.py
  2. In a second terminal, I launch the PID controller node: ros2 launch airsim_ros_pkgs position_controller_simple.launch.py

Observed Behavior

The PID node starts but hangs at the following point:

[INFO] [pd_position_controller_simple_node-1]: process started with pid [371863]
[pd_position_controller_simple_node-1] [INFO] [1775551985.938303977] [pid_position_node]: Waiting vehicle name
[pd_position_controller_simple_node-1] [ERROR] [1775551985.952258845] [pid_position_node]: Waiting for odometry!
[pd_position_controller_simple_node-1] [ERROR] [1775551985.962259550] [pid_position_node]: Waiting for odometry!
[pd_position_controller_simple_node-1] [ERROR] [1775551985.972239567] [pid_position_node]: Waiting for odometry!
[pd_position_controller_simple_node-1] [ERROR] [1775551985.982238287] [pid_position_node]: Waiting for odometry!
[pd_position_controller_simple_node-1] [ERROR] [1775551985.992263646] [pid_position_node]: Waiting for odometry!
[pd_position_controller_simple_node-1] [ERROR] [1775551986.002257162] [pid_position_node]: Waiting for odometry!
[pd_position_controller_simple_node-1] [ERROR] [1775551986.012218244] [pid_position_node]: Waiting for odometry!
[pd_position_controller_simple_node-1] [ERROR] [1775551986.022239961] [pid_position_node]: Waiting for odometry!
[pd_position_controller_simple_node-1] [ERROR] [1775551986.032213914] [pid_position_node]: Waiting for odometry!
[pd_position_controller_simple_node-1] [ERROR] [1775551986.042217901] [pid_position_node]: Waiting for odometry!
[pd_position_controller_simple_node-1] [ERROR] [1775551986.052214212] [pid_position_node]: Waiting for odometry!
...

Analysis & Attempts to Fix

I noticed a mismatch in the published/subscribed topics:

airsim_node publishes to: /airsim_node/drone_1/odom_local

pid_controller expects: /airsim_node/drone_1/odom_local_ned

I attempted to resolve this by remapping the topics in the launch file or using ros2 run --remapping, but the issue persists. It seems that simply changing the topic name isn't enough, suggesting there might be a deeper issue with how the frames are handled or how the tf2 transform tree is being broadcasted between the NED and ENU conventions.

Environment

  • OS: Ubuntu 22.04
  • ROS2 Distro: Humble
  • UE Version: 5.5.3
  • Settings.json:
    {
      "SettingsVersion": 2.0,
      "SimMode": "Multirotor",
      "ClockType": "",
      "ClockSpeed": 1,
      "ViewMode": "NoDisplay",
      "CameraDirector": {
        "FollowDistance": -1.5,
        "Position": {
          "X": -1.5,
          "Y": 0,
          "Z": -1
        }
      },
      "Vehicles": {
        "Drone1": {
          "VehicleType": "SimpleFlight",
          "AutoCreate": true,
          "DefaultVehicleState": "Disarmed",
          "Cameras": {
            "bottom_center": {
              "X": 0.15, "Y": 0, "Z": 0.15,
              "Pitch": 0, "Roll": 0, "Yaw": 0,
              "CaptureSettings": [
                {
                  "ImageType": 0, 
                  "Width": 1280,
                  "Height": 720,
                  "FOV_Degrees": 69.0,
                  "TargetGamma": 2.2,
                  "MotionBlurAmount": 0
                },
                {
                  "ImageType": 1,
                  "Width": 1280,
                  "Height": 720,
                  "FOV_Degrees": 87.0,
                  "AutoExposureMaxBrightness": 0.64,
                  "AutoExposureMinBrightness": 0.03
                }
              ]
            }
          }
        }
      },
      "SubWindows": [
        {
          "WindowID": 0,
          "ImageType": 0,
          "CameraName": "bottom_center",
          "VehicleName": "",
          "Visible": false
        },
        {
          "WindowID": 2,
          "ImageType": 3,
          "CameraName": "bottom_center",
          "VehicleName": "",
          "Visible": false
        }
      ]
    }
    

Thank you for your help!

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions