How muhammadabdullah-2001/px4_offboard_lowlevel_fbl_controller works
Project Type and Purpose
• Its purpose (from README) is to demonstrate how to send low‐level commands to PX4 in offboard mode via ROS 2.
Key Components (Blocks
a. Simulator & Autopilot Layer
• Gazebo+PX4 SITL (launch: iris_sitl.launch.py, x500_sitl.launch.py)
• PX4 Firmware (SITL interface, uORB ↔ ROS 2 bridge provided by px4_ros_com)
b. ROS 2 Middleware
• ros2 daemon and DDS transport
c. Trajectory Generation
• Node: circle_trajectory_node.cpp under src/TrajectoryPublishers
• Publishes desired trajectory messages
d. Controller Node
• controller_node.cpp + controller.cpp / New_controller.cpp
• Subscribes to:
– Vehicle state (e.g. /fmu/out/vehicle_attitude)
– Trajectory commands
• Computes low‐level setpoints (attitude/thrust or actuator commands)
• Publishes:
– /fmu/in/vehicle_attitude_setpoint
– /fmu/in/vehicle_thrust_setpoint + torque
– or /fmu/in/actuator_motors
e. Parameter Server & Configuration
• ROS 2 parameters loaded via launch files
• YAML configs under config/ (initial gains, SITL params, UAV params, experiment params)
f. Visualization
• Node: visualizer.py / visuals.cpp
g. Utility Scripts (offline / identification)
• identification.py, loop_controller.m, px4_sitl_quadrotor_x.m
• Not part of core runtime but support tuning & validation
• TrajectoryPublisher → ControllerNode: desired trajectory
• ControllerNode ← VehicleState from PX4 SITL
• ControllerNode → PX4 SITL: low‐level commands
• PX4 SITL → Gazebo sim: actuates quadrotor
• PX4 SITL → ControllerNode: state updates
• ControllerNode & TrajectoryPublisher → Visualizer: for real‐time plotting
• Configuration (YAML) → ControllerNode & TrajectoryPublisher (at startup)
Architectural Patterns & Principles
• Publisher–Subscriber (ROS 2 DDS) decouples modules
• Parameterization via YAML promotes easy tuning & reuse
• Modular nodes: separation of trajectory generation, control logic, visualization
• Launch files orchestrate multi‐node startup and parameter loading