XPlaneROS is a ROS wrapper for the XPlane-11 flight simulator.

Overview

XPlaneROS

First View

XPlaneROS is a ROS wrapper for the XPlane-11 flight simulator. The wrapper provides functionality for extracting aircraft data from the simulator and feeding control commands to control the aircraft in the simulator.
The main advantage is due to the fact that XPlane is a realistic simulator and thereby provides more realistic dynamics, responses and images.

XPlaneROS interfaces with XPlane simulator using the XPlaneConnect plugin.

Compatibility

XPlaneROS has been tested with the following systems/versions :

Ubuntu 18.04 
ROS-Melodic
XPlane-11.50
Python 3

The specs of the system are given as follows:

Processor : Intel® Core™ i7-10750H CPU @ 2.60GHz × 12 
Graphics  : GeForce GTX 1660 Ti/PCIe/SSE2
OS Type   : 64-bit
RAM       : 15.4 GiB

There's a possibility that if the system does not have enough computational power, then it can decrease the frame rate in XPlane and can lead to the system getting stuck. We noticed that the XPC interface crashes in that case.

Setup

There are three main components needed to run XPlaneRos: Xplane-11, XPlaneConnect, and ROSplane.

XPlane-11 Setup

Install the XPlane-11 simulator.

XPlaneConnect Setup

First we need to install the XPlaneConnect (XPC) plugin. Follow the steps give in the XPlaneConnect repository or in their Getting Started page.

Try to use the pre-compiled binary they provide. After following the steps mentioned in the repo, open XPlane and start a flight. If you see the plugin under the Plugin Admin, try running some of the example codes given in XPlane Connect (basicExample.py or monitorExample.py in the Python3/src folder).

If these are running you are good to go. If not, try the fixes mentioned below.

XPlaneConnect Fixes

There is a chance the plugin might not have loaded correctly. If you don't see the plugin under the Plugin Admin while running XPlane, check the Log.txt file in the XPlane-11 directory.

If you received the error dlerror:/home/ /X-Plane 11/Resources/plugins/XPlaneConnect/lin.xpl: wrong ELF class: ELFCLASS32 , this is probably an OS compatibility issue with the pre-built binaries. #151

You will need to clone the XPC repo and build yourself. Go to XPlaneConnect/xpcPlugin within the cloned repo and run the commands

mkdir build 
cd build
cmake .. 
cmake --build .

When building, if the compiler could not find bits/c++config.h file, then run the following command.
sudo apt-get install gcc-multilib g++-multilib

Building will create new .xpl files under a folder named XPlaneConnect in the build directory. Replace the old .xpl in the XPlaneConnect folder in the plugins of XPlane.

After building and replacing the .xpl, if you get the error dlerror:/home/ /X-Plane 11/Resources/plugins/XPlaneConnect/64/lin.xpl: undefined symbol: _ZN3XPC15MessageHandlers21CamCallback_RunwayCamEP20XPLMCameraPosition_tiPv , the try resolving this by adding CameraCallbacks.cpp in the CMakeLists.txt in both the add_library commands.

ROSplane Setup

Prerequisites

  1. If not already done so, install ROS (Desktop-Full is recommended).

  2. If not already done so, create a catkin workspace with catkin tools:

sudo apt-get install python-catkin-tools
mkdir -p ~/xplane_ros_ws/src
cd ~/xplane_ros_ws
catkin init

After that we will install our fork of ROSplane:

cd ~/xplane_ros_ws/src
git clone -b xplane/main [email protected]:castacks/rosplane.git 
git clone https://github.com/byu-magicc/rosflight_plugins.git
git clone https://github.com/rosflight/rosflight.git
cd rosflight/
git submodule update --init --recursive

As a sanity check, try building running the ROSplane code once along with gazebo (you may also need to install eigen_stl_containers with sudo apt-get install ros-melodic-eigen-stl-containers).

catkin build
source ~/xplane_ros_ws/devel/setup.bash
roslaunch rosplane_sim fixedwing.launch

Once Gazebo launches, you can press the "play" button in the bottom left corner, and the fixedwing should take off.

For convenience, you can add the source ~/xplane_ros_ws/devel/setup.bash statement in your ~/.bashrc file.

Now! You've checked out ROSplane and finally we're ready to move onto XPlaneROS!

XPlaneROS Setup

Installation

  1. Move to your catkin workspace:
cd ~/xplane_ros_ws/src
  1. Install system dependencies:
sudo apt-get install python-wstool python-catkin-tools
  1. Download repo using a SSH key or via HTTPS:
git clone [email protected]:castacks/xplane_ros.git # SSH
git clone https://github.com/castacks/xplane_ros.git # HTTPS
  1. Source and compile:
catkin build
source ~/xplane_ros_ws/devel/setup.bash

Running XPlaneROS

  1. Open X-Plane 11 (X-Plane 11/X-Plane_x86_64).
  2. Select New Flight.
  3. In the LOCATION panel, set the location to Butler airport (ID : KBTP) with Runway 26.
  4. Click Start Flight.

You can then start XPlaneROS with

roslaunch xplane_ros default.launch

The default.launch provides the bare-minimum structure in order to interface with XPlane. The xplane_ros_wrapper node will provide the odometry data from XPlane and it will listen to Xplane commands from the user application on the topic /xplane/my_control and then send them to XPlane.

The default.launch file also has a launch command for the rviz visualization. Uncomment that to load a .perspective file with a top down visualization of the odometry.

Troubleshooting XPlaneROS

Here we provide solutions for some issues you might encounter.

  1. eigen-stl-containers are missing :
sudo apt install ros-melodic-eigen-stl-containers
  1. Build error which says CMAKE path does not have 'rosplane'
catkin build --continue-on-failure

You might have to run this command twice

  1. module export error related to python If you're running it on Melodic using Python2.7, then try to modify the shebang in xplane_ros with this :
#! /usr/bin/env python2.7

Running XPlaneROS with ROSplane

(Assumes familiarity with ROSplane)
StateReader.py also packs data in the format needed for ROSplane and publishes that. You can run the ROSplane controller along with xplane_ros by running :

cd ~/xplane_ros_ws/src/xplane_ros
bash utils/pattern_following.sh

This will run the default.launch and xplane_fw.launch file. The plane will takeoff and start the pattern following.

In case you want to try tuning some of the control loops while following the pattern, the rqt_reconfigure will be opened by the launch file. You can tweak the parameters there.

Press the Refresh button incase you don't see anything. After that the relevant config parameters should be visible once you click on fixedwing/autopilot (for PID controls) and fixedwing/pathfollower (for vector field parameters).

Takeoff

Pattern

Tuning ROSplane Parameters

We have tuned the parameters for Cessna_172 (the default aircraft in XPlane) but feel free to try it out for other aircraft yourself.

roslaunch xplane_ros default.launch rosplane_tuner:=true

Under the rqt_reconfigure gui you should see fixedwing and xplane_ros . Click on both of them.
The fixedwing setup contains the dynamic reconfigure for rosplane parameters. The nomenclature should be obvious once you take a glance at the params and cfg files provided in rosplane. Those are the tuning parameters for the PID loops implemented in rosplane.

The xplane_ros portion of the gui provides a kind of easy-to-use interface for you to give certain commands and see the response.
For example, suppose you want to tune the roll attitude parameters. Tick the hold_roll box and untick the other boxes. This means that the autopilot_tuner node will ignore all the other commanded values and will only run the roll_hold() function to set the current phi to phi_c. You can set the value for phi_c using the roll_step in the rqt_reconfigure gui.
In the rqt_plot you will be able to visualise the commanded roll, current roll and also the aileron commands output by the roll_hold() function.

NOTE : The control surfaces correponding to the unticked boxes will be defaulted to what it was just before you unticked them.

Henceforth, you should be able to experiment with other control loops like pitch, heading, throttle, etc (each corresponding to a function in controller_base.cpp and controller_example.cpp in rosplane).

For some more idea about what each code does, head over here.

Citation

@misc{baijal_patrikar_moon_scherer_oh_2021,
  title={XPlaneROS : ROS Wrapper for Autonomous Fixed Wing Applications},
  url={https://kilthub.cmu.edu/articles/software/XPlaneROS_ROS_Wrapper_for_Autonomous_Fixed_Wing_Applications/16589924},  
  publisher={Carnegie Mellon University},
  author={Baijal, Rohan and Patrikar, Jay and Moon, Brady and Scherer, Sebastian and Oh, Jean},
  year={2021},
  month={Sep},
  DOI={10.1184/R1/16589924}
}
You might also like...
Zeus is an open source flight intellingence tool which supports more than 13,000+ airlines and 250+ countries.

Zeus Zeus is an open source flight intellingence tool which supports more than 13,000+ airlines and 250+ countries. Any flight worldwide, at your fing

Aero is an open source airplane intelligence tool. Aero supports more than 13,000 airlines and 250 countries. Any flight worldwide at your fingertips.

Aero Aero supports more than 13,000 airlines and 250 countries. Any flight worldwide at your fingertips. Features Main : Flight lookup Aircraft lookup

Django React Flight Rezervation

Django Intro & Installation python -m venv venv source ./venv/Scripts/activate pip install Django pip install djangorestframework pip install python-d

Flight Reservation App With Python
Flight Reservation App With Python

Flight Reservation App With Python

A Cheap Flight Alert program sends you a SMS to notify cheap flights in next 8 months.
A Cheap Flight Alert program sends you a SMS to notify cheap flights in next 8 months.

Flight Dealer A Cheap Flight Alert program sends you a SMS to notify cheap flights (return trips) in next 6 months. Installing Download the Python 3 i

Project for viewing the cheapest flight deals from Netherlands to other countries.

Flight_Deals_AMS Project for viewing the cheapest flight deals from Netherlands to other countries.

Creating a Python API, for the MakeMyTrip Flight Schedules.

MakeMyTripAPI Creating a Python API, for the MakeMyTrip Flight Schedules. Source: MakeMyTrip is an Indian online travel company founded in 2000. Headq

Aerospace utilities: flight conditions package, standard atmosphere model, and more.

Aerospace Utilities About Module that contains commonly-used aerospace utilities for problem solving. Flight Condition: input altitude to compute comm

Flybirds - BDD-driven natural language automated testing framework, present by Trip Flight

Flybird | English Version 行为驱动开发(Behavior-driven development,缩写BDD),是一种软件过程的思想或者

Developing and Comparing Vision-based Algorithms for Vision-based Agile Flight
Developing and Comparing Vision-based Algorithms for Vision-based Agile Flight

DodgeDrone: Vision-based Agile Drone Flight (ICRA 2022 Competition) Would you like to push the boundaries of drone navigation? Then participate in the

This repository contains all the code and files needed to simulate the notspot quadrupedal robot using Gazebo and ROS.
This repository contains all the code and files needed to simulate the notspot quadrupedal robot using Gazebo and ROS.

Notspot robot simulation - Python version This repository contains all the files and code needed to simulate the notspot quadrupedal robot using Gazeb

Tool for ROS 2 IP Discovery + System Monitoring
Tool for ROS 2 IP Discovery + System Monitoring

Monitor the status of computers on a network using the DDS function of ROS2.

YOLOX + ROS(1, 2) object detection package
YOLOX + ROS(1, 2) object detection package

YOLOX + ROS(1, 2) object detection package

2D waypoints will be predefined in ROS based robots to navigate to the destination avoiding obstacles.
2D waypoints will be predefined in ROS based robots to navigate to the destination avoiding obstacles.

A number of 2D waypoints will be predefined in ROS based robots to navigate to the destination avoiding obstacles.

Simulation artifacts, core components and configuration files to integrate AWS DeepRacer device with ROS Navigation stack.
Simulation artifacts, core components and configuration files to integrate AWS DeepRacer device with ROS Navigation stack.

AWS DeepRacer Overview The AWS DeepRacer Evo vehicle is a 1/18th scale Wi-Fi enabled 4-wheel ackermann steering platform that features two RGB cameras

navigation_commander is a ROS package to command the robot to navigate autonomously to each table for food delivery inside a hotel.
navigation_commander is a ROS package to command the robot to navigate autonomously to each table for food delivery inside a hotel.

navigation_commander navigation_commander is a ROS package to command the robot to navigate autonomously to each table for food delivery inside a hote

A tf publisher gui tool for ROS, which publish /tf_static message. The software is based on PyQt5.
A tf publisher gui tool for ROS, which publish /tf_static message. The software is based on PyQt5.

tf_publisher_gui for ROS Introduction How to use cd catkin_ws/src git clone https://github.com/yinwu33/tf_publisher_gui.git cd catkin_ws catkin_make s

A naive ROS interface for visualDet3D.
A naive ROS interface for visualDet3D.

YOLO3D ROS Node This repo contains a Monocular 3D detection Ros node. Base on https://github.com/Owen-Liuyuxuan/visualDet3D All parameters are exposed

Playing diabolo with two robot arms in ROS + Gazebo
Playing diabolo with two robot arms in ROS + Gazebo

Playing diabolo with robots This repository holds the ROS packages for playing diabolo with two UR5e robot arms on ROS Melodic (Ubuntu 18.04). Read ou

Comments
  • Issue running default.launch

    Issue running default.launch

    First of all, thanks for providing this tool and the documentation is well written. Here is my development environment:

    OS: Ubuntu 20.04
    ROS: Noetic
    XPlane: Xplane 10
    

    I have followed the steps compile the workspace and finally get to the section Running XPlaneROS.

    After setting up the

    1. Open X-Plane 11 (X-Plane 11/X-Plane_x86_64).
    2. Select New Flight.
    3. In the LOCATION panel, set the location to Butler airport (ID : KBTP) with Runway 26.
    4. Click Start Flight.
    

    and I try to start the xplane ros roslaunch xplane_ros default.launch

    I get the following error:

    auto-starting new master
    process[master]: started with pid [33264]
    ROS_MASTER_URI=http://localhost:11311
    
    setting /run_id to 5eab2ac8-3af8-11ec-852e-ffe475eea05a
    process[rosout-1]: started with pid [33274]
    started core service [/rosout]
    process[xplane_wrapper-2]: started with pid [33277]
    process[ned_to_viz-3]: started with pid [33282]
    process[xp_rosplane_viz-4]: started with pid [33283]
    process[rviz-5]: started with pid [33284]
    Traceback (most recent call last):
      File "/home/xv/xplane_ros_ws/devel/lib/xplane_ros/xplane_ros_wrapper.py", line 15, in <module>
        exec(compile(fh.read(), python_script, 'exec'), context)
      File "/home/xv/xplane_ros_ws/src/xplane_ros/scripts/xplane_ros_wrapper.py", line 5, in <module>
        from state_reader import StateReader
    ModuleNotFoundError: No module named 'state_reader'
    

    I am not sure if it's a Python problem or ROS workspace problem. The python script state_reader is located in the same folder scripts with xplane_ros_wrapper.py, but it cannot find the state_reader.py. So I edited the CMakeLists.txtfile within xplane_ros package, by adding a line

    catkin_install_python(PROGRAMS 
        scripts/xplane_ros_wrapper.py 
        scripts/state_reader.py # <- include state_reader.py 
        scripts/takeoff.py
        scripts/roll_hold.py
        scripts/ned_to_viz.py
        scripts/rosplane_tuner.py
        scripts/rosplane_path_viz.py
        DESTINATION ${CATKIN_PACKAGE_BIN_DESTINATION}
    )
    

    However, I am still not able to import the StateReader class, a new error message is shown below

    setting /run_id to a9d84630-3aed-11ec-852e-ffe475eea05a
    process[rosout-1]: started with pid [7073]
    started core service [/rosout]
    process[xplane_wrapper-2]: started with pid [7076]
    process[ned_to_viz-3]: started with pid [7077]
    process[xp_rosplane_viz-4]: started with pid [7078]
    process[rviz-5]: started with pid [7083]
    Traceback (most recent call last):
      File "/home/xv/xplane_ros_ws/devel/lib/xplane_ros/xplane_ros_wrapper.py", line 15, in <module>
        exec(compile(fh.read(), python_script, 'exec'), context)
      File "/home/xv/xplane_ros_ws/src/xplane_ros/scripts/xplane_ros_wrapper.py", line 5, in <module>
        from state_reader import StateReader
    ImportError: cannot import name 'StateReader' from 'state_reader' (/home/xv/xplane_ros_ws/devel/.private/xplane_ros/lib/xplane_ros/state_reader.py)
    [xplane_wrapper-2] process has died [pid 7076, exit code 1, cmd /home/xv/xplane_ros_ws/devel/lib/xplane_ros/xplane_ros_wrapper.py __name:=xplane_wrapper __log:=/home/xv/.ros/log/a9d84630-3aed-11ec-852e-ffe475eea05a/xplane_wrapper-2.log].
    log file: /home/xv/.ros/log/a9d84630-3aed-11ec-852e-ffe475eea05a/xplane_wrapper-2*.log
    [ WARN] [1635755298.803719113]: Invalid argument passed to canTransform argument source_frame in tf2 frame_ids cannot be empty
    
    opened by gy2256 1
Owner
AirLab Stacks
Open Source software from the AirLab (Robotics Institute, Carnegie Mellon University)
AirLab Stacks
Box - a world simulator written in python with pygame

Box is a world simulator written in python with pygame. Features A world generation system A world editor Simulates creatures called boxlanders. You c

1up Community 3 Nov 14, 2022
An asynchronous Minecraft server wrapper written in python3 with asyncio

mark3 (WIP) A modern Minecraft server wrapper written in python3 with asyncio TODO Note: The order of the following checklist doesn't necessarily mean

Colin Andress 7 Jul 29, 2022
Detic ros - A simple ROS wrapper for Detic instance segmentation using pre-trained dataset

Detic ros - A simple ROS wrapper for Detic instance segmentation using pre-trained dataset

Hirokazu Ishida 12 Nov 19, 2022
Ros command - Unifying the ROS command line tools

Unifying the ROS command line tools One impairment to ROS 2 adoption is that all

null 37 Dec 15, 2022
Yolo ros - YOLO-ROS for HUAWEI ATLAS200

YOLO-ROS YOLO-ROS for NVIDIA YOLO-ROS for HUAWEI ATLAS200, please checkout for b

ChrisLiu 5 Oct 18, 2022
Deep Reinforcement Learning for mobile robot navigation in ROS Gazebo simulator

DRL-robot-navigation Deep Reinforcement Learning for mobile robot navigation in ROS Gazebo simulator. Using Twin Delayed Deep Deterministic Policy Gra

null 87 Jan 7, 2023
This is a a CSMA/CA simulator written in Python based on simulator of the same type

This is a a CSMA/CA simulator written in Python based on simulator of the same type found the link https://github.com/StevenSLXie/CSMA-Simulator with

M. Ismail 4 Nov 22, 2022
Crypto-trading-simulator - Cryptocurrency trading simulator using Python, Streamlit

Crypto Trading Simulator Run streamlit run main.py Dependency Python 3 streamli

Brad 12 Jul 2, 2022
Short Program using Transavia's API to notify via email an user waiting for a flight at special dates and with the best price

Flight-Notifier Short Program using Transavia's API to notify via email an user waiting for a flight at special dates and with the best price Algorith

Wassim 2 Apr 10, 2022
Learning High-Speed Flight in the Wild

Learning High-Speed Flight in the Wild This repo contains the code associated to the paper Learning Agile Flight in the Wild. For more information, pl

Robotics and Perception Group 391 Dec 29, 2022