3 #include "uav_system_config.pb.h"
67 bool home_location_specified_;
74 :
UAVSystem(drone_hardware, UAVSystemConfig()) {}
85 UAVSystem(parsernode::Parser &drone_hardware, UAVSystemConfig config)
87 builtin_position_controller_(config.position_controller_config()),
88 builtin_velocity_controller_(config.velocity_controller_config()),
89 position_controller_drone_connector_(drone_hardware,
90 builtin_position_controller_),
91 velocity_controller_drone_connector_(drone_hardware,
92 builtin_velocity_controller_),
93 rpyt_controller_drone_connector_(drone_hardware,
94 manual_rpyt_controller_),
95 home_location_specified_(false) {
98 position_controller_drone_connector_);
100 velocity_controller_drone_connector_);
102 rpyt_controller_drone_connector_);
110 parsernode::common::quaddata data;
138 parsernode::common::quaddata data =
getUAVData();
143 std::string battery_percent_color =
146 table_writer.
addCell(data.batterypercent,
"Battery Percent",
147 battery_percent_color, 2);
149 table_writer.
addCell(data.localpos.x,
"Local x");
150 table_writer.
addCell(data.localpos.y,
"Local y");
151 table_writer.
addCell(data.localpos.z,
"Local z");
152 table_writer.
addCell(data.altitude,
"Altitude");
154 table_writer.
addCell(data.rpydata.x * (180 / M_PI),
"Roll");
155 table_writer.
addCell(data.rpydata.y * (180 / M_PI),
"Pitch");
156 table_writer.
addCell(data.rpydata.z * (180 / M_PI),
"Yaw");
158 table_writer.
addCell(data.magdata.x,
"Mag x");
159 table_writer.
addCell(data.magdata.y,
"Mag y");
160 table_writer.
addCell(data.magdata.z,
"Mag z");
162 table_writer.
addCell(data.linacc.x,
"Acc x");
163 table_writer.
addCell(data.linacc.y,
"Acc y");
164 table_writer.
addCell(data.linacc.z,
"Acc z");
166 table_writer.
addCell(data.linvel.x,
"Vel x");
167 table_writer.
addCell(data.linvel.y,
"Vel y");
168 table_writer.
addCell(data.linvel.z,
"Vel z");
170 table_writer.
addCell(data.velocity_goal.x,
"Goal vel x");
171 table_writer.
addCell(data.velocity_goal.y,
"Goal vel y");
172 table_writer.
addCell(data.velocity_goal.z,
"Goal vel z");
173 table_writer.
addCell(data.velocity_goal_yaw,
"Goal yaw");
175 table_writer.
addCell(data.position_goal.x,
"Goal pos x");
176 table_writer.
addCell(data.position_goal.y,
"Goal pos y");
177 table_writer.
addCell(data.position_goal.z,
"Goal pos z");
178 table_writer.
addCell(data.velocity_goal_yaw,
"Goal yaw");
180 table_writer.
addCell(data.mass,
"Mass");
184 table_writer.
addCell(data.quadstate,
"Quadstate", quad_state_color, 2);
198 parsernode::common::quaddata data =
getUAVData();
199 home_location_.
x = data.localpos.x;
200 home_location_.
y = data.localpos.y;
201 home_location_.
z = data.localpos.z;
202 home_location_.
yaw = data.rpydata.z;
203 home_location_specified_ =
true;
Builtin velocity controller.
Definition: builtin_controller.h:92
static constexpr const char * white
White color hex code.
Definition: html_utils.h:34
static constexpr const char * green
Green color hex code.
Definition: html_utils.h:18
double y
y component in m
Definition: position.h:23
TypeMap< AbstractControllerHardwareConnector > controller_hardware_connector_container_
Container to store and retrieve controller-hardware-connectors.
Definition: base_robot_system.h:23
void setHomeLocation()
save current location as home location
Definition: uav_system.h:197
bool isHomeLocationSpecified()
Check if home location is specified.
Definition: uav_system.h:211
std::string getTableString()
Get the html table in string format.
Definition: html_utils.h:170
A controller that passes joystick commands to a drone's RPYT controller.
Definition: manual_rpyt_controller.h:11
UAVSystem(parsernode::Parser &drone_hardware)
Constructor with default configuration.
Definition: uav_system.h:73
double x
x component in m
Definition: position.h:22
Stores Position, yaw. PositionYaw is used as the goal for UAV systems.
Definition: position_yaw.h:10
UAVSystem(parsernode::Parser &drone_hardware, UAVSystemConfig config)
Constructor.
Definition: uav_system.h:85
parsernode::Parser & drone_hardware_
Hardware.
Definition: uav_system.h:26
Owns, initializes, and facilitates communication between different hardware/software components...
Definition: uav_system.h:21
Provides functions to switch between active controllers and get goals.
Definition: base_robot_system.h:16
Manages communication between a drone plugin and a velocity controller that outputs velocity commands...
Definition: builtin_velocity_controller_drone_connector.h:13
void enableAutonomousMode()
Public API call to enable Quadcopter SDK. This call is only necessary if Quad goes into manual mode d...
Definition: uav_system.h:125
static constexpr const char * blue
Blue color hex code.
Definition: html_utils.h:22
void takeOff()
Public API call to takeoff.
Definition: uav_system.h:118
Manages communication between a drone plugin and a position controller that outputs position commands...
Definition: position_controller_drone_connector.h:14
parsernode::common::quaddata getUAVData() const
Get sensor data from UAV.
Definition: uav_system.h:109
void land()
Public API call to land.
Definition: uav_system.h:130
void addCell(const DataT &data, std::string header="", std::string bg_color=Colors::white, int colspan=1)
Add a cell to the table. Should be called after beginning a row. Otherwise will throw an exception...
Definition: html_utils.h:116
PositionYaw getHomeLocation()
Stored home location.
Definition: uav_system.h:218
Maps Joystick goals to rpythrust commands to quadrotor.
Definition: manual_rpyt_controller_drone_connector.h:12
std::string getSystemStatus() const
Provide the current state of UAV system.
Definition: uav_system.h:137
void beginRow()
Begin a new row in the table.
Definition: html_utils.h:135
double yaw
Orientation about body axis rad.
Definition: position_yaw.h:51
double z
z component in m
Definition: position.h:24
void addHeader(std::string header, std::string text_color=Colors::black, int colspan=1)
Add a table header. Should be called after beginning a row.
Definition: html_utils.h:152
UAVSystemConfig getConfiguration()
Get system configuration.
Definition: uav_system.h:192
UAVSystemConfig config_
UAV configuration parameters.
Definition: uav_system.h:30
Helper class to write html tables to text format.
Definition: html_utils.h:91
Builtin position controller.
Definition: builtin_controller.h:36
void setObject(ObjectT &object)
Store the object with base class as GenericObjectT.
Definition: type_map.h:27
static constexpr const char * red
Red color hex code.
Definition: html_utils.h:14