Quick Start
This guide will help you get started with Cubs2 simulation and visualization.
Basic Simulation
Launch a complete simulation with visualization in a single command:
source install/setup.bash
ros2 launch cubs2_bringup sim.xml
This will start:
Physics simulation node (
cubs2_simulation)Aircraft dynamics model (Sport Cub)
RViz visualization with custom panels
Planning and control nodes
The aircraft will spawn at the origin and you can control it using the joystick panel in RViz.
Launch Options
The sim.xml launch file supports several options:
ros2 launch cubs2_bringup sim.xml replay:=false viz:=false gamepad:=true
Available arguments:
replay(default:true) - Enable replay of recorded flight dataviz(default:true) - Launch RViz visualizationgamepad(default:false) - Enable gamepad controlbag_path- Path to rosbag file for replay mode
Examples:
# Simulation only (no visualization)
ros2 launch cubs2_bringup sim.xml viz:=false
# With gamepad control
ros2 launch cubs2_bringup sim.xml gamepad:=true
# Disable replay
ros2 launch cubs2_bringup sim.xml replay:=false
Visualization Only
To launch just the visualization (e.g., for connecting to a real aircraft):
ros2 launch cubs2_bringup viz.xml
Note
With the new defaults, you typically don’t need separate launch calls.
Use ros2 launch cubs2_bringup sim.xml to start everything together.
Replay Mode
Cubs2 supports replaying recorded flight data and comparing it with simulation. Replay mode is enabled by default:
ros2 launch cubs2_bringup sim.xml
To disable replay:
ros2 launch cubs2_bringup sim.xml replay:=false
The replay shows a “ghost” plane following the recorded trajectory, allowing you to:
Debug flight test data
Validate simulation accuracy
Compare controller performance
Analyze flight patterns
Available Topics
Key ROS 2 topics published by Cubs2:
Topic |
Type |
Description |
|---|---|---|
|
|
Complete aircraft state |
|
|
Position and velocity |
|
|
Joystick input |
|
|
Velocity commands |
|
|
Planned trajectory |
|
|
Control surface positions |
Using the Joystick Panel
The RViz joystick panel provides virtual stick control:
Left Stick: Throttle (vertical), Yaw (horizontal)
Right Stick: Pitch (vertical), Roll (horizontal)
Trim Buttons: Fine-tune neutral positions
Enable Switch: Activate/deactivate control
Note
You can also use a physical joystick by mapping it to /joy topic.
Adjusting Simulation Parameters
Edit configuration files in cubs2_data/config/:
sportcub.yaml: Aircraft parameters (mass, inertia, aerodynamics)sim.yaml: Simulation settings (timestep, initial conditions)control.yaml: Controller gains and limits
After editing, rebuild and relaunch:
colcon build --symlink-install --packages-select cubs2_data
source install/setup.bash
ros2 launch cubs2_bringup sim.xml
Next Steps
Simulation - Learn about the physics simulation
Control - Understand the control architecture
Planning - Generate paths and trajectories
Visualization - Customize RViz panels