Skip to content

Commit 6dbd7eb

Browse files
committed
Add doc for controller plugin interface
1 parent d2d8b25 commit 6dbd7eb

File tree

3 files changed

+55
-7
lines changed

3 files changed

+55
-7
lines changed

docs/45-plugin-interface/02-controllers.md

-7
This file was deleted.
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,55 @@
1+
---
2+
title: Controller plugins
3+
pagination_label: API for the controller plugins
4+
description: API for the controller plugins
5+
---
6+
7+
# The Controller plugin interface
8+
9+
The Controller plugin takes current UAV state and command from the [Reference tracker](https://ctu-mrs.github.io/docs/features/trackers/) and provides the desired control ouptuts, which are sent to the flight controller (Embedded autopilot block in diagram below) via [Hardware API](https://ctu-mrs.github.io/docs/plugin-interface/hardware-api/).
10+
Diagram below shows the data architecture of the MRS system where the block containing the Controller plugin is marked in red.
11+
12+
![Diagram of MRS system architecture](./fig/diagram_of_system_architecture.jpg)
13+
14+
The controller plugin is compiled as *ROS plugins* ([http://wiki.ros.org/pluginlib](http://wiki.ros.org/pluginlib)) with the [interface](https://github.com/ctu-mrs/mrs_uav_managers/blob/master/include/mrs_uav_managers/controller.h) defined by the [control manager](https://github.com/ctu-mrs/mrs_uav_managers).
15+
A controller plugin from any ROS package can be loaded dynamically by the [control manager](https://github.com/ctu-mrs/mrs_uav_managers) without it being present during [control manager](https://github.com/ctu-mrs/mrs_uav_managers)'s compile time.
16+
Loaded controllers can be switched by the [control manager](https://github.com/ctu-mrs/mrs_uav_managers) in mid-flight, which allows safe testing of new controllers and adds flexibility to the [MRS UAV system](https://github.com/ctu-mrs/mrs_uav_system).
17+
18+
An example of a cutom controller plugin can be found at [this link](https://github.com/ctu-mrs/mrs_core_examples/tree/master/cpp/controller_plugin).
19+
It is highly reccomended to base your controller plugin on this example.
20+
In the example, there is also a [tmux folder](https://github.com/ctu-mrs/mrs_core_examples/tree/master/cpp/controller_plugin/tmux) containing a script that starts the simulation of a UAV in the [Gazebo simulator](https://github.com/ctu-mrs/mrs_uav_gazebo_simulation), where the UAV uses the [example controller plugin](https://github.com/ctu-mrs/mrs_core_examples/tree/master/cpp/controller_plugin).
21+
You have to install [MRS UAV system](https://github.com/ctu-mrs/mrs_uav_system) first to run the example.
22+
To load the controller plugin into the [MRS UAV system](https://github.com/ctu-mrs/mrs_uav_system), you need to provide a custom config file to the [MRS UAV Core](https://github.com/ctu-mrs/mrs_uav_core) containing the parameters for the controller plugin.
23+
The custom config file should contain the following lines (taken from [example controller plugin](https://github.com/ctu-mrs/mrs_core_examples/tree/master/cpp/controller_plugin)):
24+
```yaml
25+
mrs_uav_managers:
26+
27+
control_manager:
28+
29+
ExampleController:
30+
address: "example_controller_plugin/ExampleController"
31+
namespace: "example_controller"
32+
eland_threshold: 20.0 # [m], position error triggering eland
33+
failsafe_threshold: 30.0 # [m], position error triggering failsafe land
34+
odometry_innovation_threshold: 1.5 # [m], position odometry innovation threshold
35+
human_switchable: true
36+
37+
# which outputs the controller can provide
38+
outputs:
39+
actuators: false
40+
control_group: false
41+
attitude_rate: false
42+
attitude: true
43+
acceleration_hdg_rate: false
44+
acceleration_hdg: false
45+
velocity_hdg_rate: false
46+
velocity_hdg: false
47+
position: false
48+
49+
# list of names of dynamically loaded controllers
50+
controllers : [
51+
"ExampleController",
52+
]
53+
```
54+
55+
Loading

0 commit comments

Comments
 (0)