Controllers for controlling MAVs using the mavros package in OFFBOARD mode.
The repository contains controllers for controlling MAVs using the mavros package. The following packages are included in the repo
- geometric_controller: Trajectory tracking controller based on geometric control
- controller_msgs: custom message definitions
- trajectory_publisher: Node publishing setpoints as states from motion primitives / trajectories for the controller to follow.
Follow the instructions as shown in the PX4 Documentation To check if the necessary environment is setup correctly, you can run the gazebo SITL using the following command
cd <Firmware_directory>
make posix_sitl_default gazebo
To source the PX4 environment, run the following commands
source ~/catkin_ws/devel/setup.bash // (optional)
source Tools/setup_gazebo.bash $(pwd) $(pwd)/build/posix_sitl_default
export ROS_PACKAGE_PATH=$ROS_PACKAGE_PATH:$(pwd)
export ROS_PACKAGE_PATH=$ROS_PACKAGE_PATH:$(pwd)/Tools/sitl_gazebo
You can run the rest of the roslaunch files in the same terminal
mavros_controllers can be built using catkin build
cd <path_to_catkin_ws>
catkin build mavros_controllers
The following launch file enables the geometric controller to follow a circular trajectory
roslaunch geometric_controller trajectory_track_circle.launch
mavros_controllers
include the following packages.
The geometric controller publishes and subscribes the following topics.
-
Parameters
- /geometric_controller/mavname (default: "iris")
- /geometric_controller/ctrl_mode (default: MODE_BODYRATE)
- /geometric_controller/enable_sim (default: true)
- /geometric_controller/enable_gazebo_state (default: false)
- /geometric_controller/max_acc (default: 7.0)
- /geometric_controller/yaw_heading (default: 0.0)
- /geometric_controller/drag_dx (default: 0.0)
- /geometric_controller/drag_dy (default: 0.0)
- /geometric_controller/drag_dz (default: 0.0)
- /geometric_controller/attctrl_constant (default: 0.2)
- /geometric_controller/normalizedthrust_constant (default: 0.1)
-
Published Topics
- command/bodyrate_command ( mavros_msgs/AttitudeTarget )
- reference/pose ( geometry_msgs/PoseStamped )
-
Subscribed Topics
- reference/setpoint ( geometry_msgs/TwistStamped )
- /mavros/state ( mavr0s_msgs/State )
- /mavros/local_position/pose ( geometry_msgs/PoseStamped )
- /gazebo/model_states( gazebo_msgs/ModelStates )
- /mavros/local_position/velocity( geometry_msgs/TwistStamped )
Trajectory publisher publishes continous trajectories to the trajectory_controller.
-
Parameters
- /trajectory_publisher/initpos_x (default: 0.0)
- /trajectory_publisher/initpos_y (default: 0.0)
- /trajectory_publisher/initpos_z (default: 1.0)
- /trajectory_publisher/updaterate (default: 0.01)
- /trajectory_publisher/horizon (default: 1.0)
- /trajectory_publisher/maxjerk (default: 10.0)
- /trajectory_publisher/trajectory_type (default: 0)
- /trajectory_publisher/number_of_primitives (default: 7)
- /trajectory_publisher/shape_radius (default: 1.0)
-
Published Topics
- reference/trajectory ( nav_msgs/Path )
- reference/setpoint ( geometry_msgs/TwistStamped )
-
Subscribed Topics
- /trajectory_publisher/motionselector (std_msgs/int32);
- /mavros/local_position/pose ( geometry_msgs/PoseStamped )
- /mavros/local_position/velocity( geometry_msgs/TwistStamped )
[1] Lee, Taeyoung, Melvin Leoky, and N. Harris McClamroch. "Geometric tracking control of a quadrotor UAV on SE (3)." Decision and Control (CDC), 2010 49th IEEE Conference on. IEEE, 2010.
[2] Faessler, Matthias, Antonio Franchi, and Davide Scaramuzza. "Differential flatness of quadrotor dynamics subject to rotor drag for accurate tracking of high-speed trajectories." IEEE Robot. Autom. Lett 3.2 (2018): 620-626.
Jaeyoung Lim jalim@student.ethz.ch