Skip to content

ROS2 Node for PX4-SITL to activate "Offboard" mode on a single or multiple agents and ascend them at their spawn location.

Notifications You must be signed in to change notification settings

AWickersGit/px4_multi_offboard_node

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

4 Commits
 
 
 
 

Repository files navigation

px4_multi_offboard_node

ROS2 Node for PX4-SITL to activate "Offboard" mode on a single or multiple agents and ascend them at their spawn location.

Setup

  • Ubuntu 24.04.3
  • ROS2 Jazzy
  • Gazebo Harmonic (v8.9)
  • PX4-Autopilot v1.16.0
  • MicroXRCEAgent + px4_msgs

Install

Copy into workspace and "colcon build --symlink-install".

Usage without Autostart

To run the node without the sh-script, just edit the starting positions and the namespaces of the px4-agents in "/config/multi_config.yalm". Open a new terminal and use

ros2 run offboard_control_node offboard_multi

or via launch script

ros2 launch offboard_control_node offboard_multi.launch.py

In both cases the node will read the mentioned config.yaml.

Usage with Autostart

The /config/multi_config.yaml file holds spawn locations of the px4-agents (POSES) and their associated namespaces (NAMESPACES). The "start_multi_px4.sh" creates a config.conf file, opens terminals for the MicroXRCEAgent, a gazebo world, px4-agents in standalone mode (depending on the config data) and the offboard_node.

Note

Autostart via sh script requires correctly set variables for the gz environment along with a desired world-file. Use PX4-Environment-Skript or add following lines to bashrc:

export PX4_GZ_MODELS=$HOME/PX4-Autopilot/Tools/simulation/gz/models
export PX4_GZ_WORLDS=$HOME/PX4-Autopilot/Tools/simulation/gz/worlds
export PX4_GZ_PLUGINS=$HOME/PX4-Autopilot/src/modules/simulation/gz_plugins:$HOME/PX4-Autopilot/build/px4_sitl_default/src/modules/simulation/gz_plugins
export PX4_GZ_SERVER_CONFIG=$HOME/PX4-Autopilot/src/modules/simulation/gz_bridge/server.config

export GZ_SIM_RESOURCE_PATH=$GZ_SIM_RESOURCE_PATH:$PX4_GZ_MODELS:$PX4_GZ_WORLDS
export GZ_SIM_SYSTEM_PLUGIN_PATH=$GZ_SIM_SYSTEM_PLUGIN_PATH:$PX4_GZ_PLUGINS
export GZ_SIM_SERVER_CONFIG_PATH=$PX4_GZ_SERVER_CONFIG

To avoid Groundcontrol Station (QGroundcontrol start) Preflight Check, edit in "~/PX4-Autopilot/ROMFS/px4fmu_common/init.d-posix/airframes" the used model-file (in this case "4001_gz_x500") and set parameters:

param set-default NAV_DLL_ACT 0
param set-default NAV_RCL_ACT 0
param set-default COM_RCL_EXCEPT 4

To turn off battery simulation (limitless flight time) also set:

param set-default SIM_BAT_ENABLE 0

Also note, that PX4-Instance "-i 0" leads to topics of "/fmu/...", while instances of "-i 1" and any other number above lead to topics "/px4_1/fmu/.." and so on. However, the target_system required in the VehicleCommand msg needs to point at the UXRCE_DDS_KEY param from the px4-model, which defaults to 1 for instance 0 - leading to "px4_instance + 1 = UXRCE_DDS_KEY". The usage of "-i 0" is not supported with this node, since it adds another exception for the subscriber creation.

About

ROS2 Node for PX4-SITL to activate "Offboard" mode on a single or multiple agents and ascend them at their spawn location.

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published