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 data

  • viz (default: true) - Launch RViz visualization

  • gamepad (default: false) - Enable gamepad control

  • bag_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

/state/full

cubs2_msgs/FullState

Complete aircraft state

/odometry

nav_msgs/Odometry

Position and velocity

/joy

sensor_msgs/Joy

Joystick input

/cmd_vel

geometry_msgs/Twist

Velocity commands

/path

nav_msgs/Path

Planned trajectory

/control/actuators

cubs2_msgs/Actuators

Control surface positions

Using the Joystick Panel

The RViz joystick panel provides virtual stick control:

  1. Left Stick: Throttle (vertical), Yaw (horizontal)

  2. Right Stick: Pitch (vertical), Roll (horizontal)

  3. Trim Buttons: Fine-tune neutral positions

  4. 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