5 #include <parsernode/parser.h>
6 #include <pluginlib/class_loader.h>
8 #include <arm_parsers/arm_simulator.h>
9 #include <arm_parsers/generic_arm.h>
10 #include <arm_parsers/simple_arm.h>
18 #include "uav_system_handler_config.pb.h"
28 template <
class LogicStateMachineT,
class EventManagerT>
37 : nh_uav_(
"~uav"), nh_arm_(
"~arm"), nh_tracker_(
"~tracker"),
38 parser_loader_(
"parsernode",
"parsernode::Parser"),
40 parser_loader_.createUnmanagedInstance(config.uav_parser_type())),
43 config.uav_arm_system_handler_config().arm_parser_type() ==
45 ? dynamic_cast<ArmParser *>(new GenericArm(nh_arm_))
46 : (config.uav_arm_system_handler_config().arm_parser_type() ==
48 ? dynamic_cast<ArmParser *>(new SimpleArm(nh_arm_))
49 : dynamic_cast<ArmParser *>(new ArmSimulator()))),
51 config.uav_system_config()
52 .uav_vision_system_config()
53 .tracker_type() ==
"ROI"
57 uav_system_(*tracker_, *uav_hardware_, *arm_hardware_,
58 config.uav_system_config()),
59 common_handler_(config.base_config(), uav_system_),
60 uav_controller_timer_(
61 std::bind(&
UAVArmSystem::runActiveController, std::ref(uav_system_),
63 std::chrono::milliseconds(config.uav_controller_timer_duration())),
64 arm_controller_timer_(
65 std::bind(&
UAVArmSystem::runActiveController, std::ref(uav_system_),
67 std::chrono::milliseconds(config.uav_arm_system_handler_config()
68 .arm_controller_timer_duration())) {
70 uav_hardware_->initialize(nh_uav_);
74 uav_controller_timer_.
start();
75 arm_controller_timer_.
start();
88 parsernode::common::quaddata quad_data;
89 uav_hardware_->getquaddata(quad_data);
102 ros::NodeHandle nh_uav_;
103 ros::NodeHandle nh_arm_;
104 ros::NodeHandle nh_tracker_;
105 pluginlib::ClassLoader<parsernode::Parser>
107 std::unique_ptr<parsernode::Parser> uav_hardware_;
108 std::unique_ptr<ArmParser> arm_hardware_;
109 std::unique_ptr<BaseTracker> tracker_;
bool isConnected()
Forward common handler connected function for testing is GUI is connected to this node or not...
Definition: uav_arm_system_handler.h:99
UAV vision system with an arm.
Definition: uav_arm_system.h:12
UAVArmSystemHandler(UAVSystemHandlerConfig &config)
Constructor.
Definition: uav_arm_system_handler.h:36
Converts a ROI in image to vector in camera frame.
Definition: roi_to_position_converter.h:25
Interface for classes that provide a vector to a tracked target.
Definition: base_tracker.h:13
Owns all of the autonomous system components and is responsible for thread management. Also owns a common system handler object to handle creation of state machine and connecting it to GUI.
Definition: uav_arm_system_handler.h:29
void start()
Starts running the timer thread.
Definition: async_timer.cpp:16
void startTimers()
Start state machine internal event processing and status timer.
Definition: common_system_handler.h:70
Calls given function on a timer in its own thread.
Definition: async_timer.h:11
bool isConnected()
Checks if internal ROS topics are connected.
Definition: common_system_handler.h:62
parsernode::common::quaddata getUAVData()
Get UAV state.
Definition: uav_arm_system_handler.h:87
Provides vector to a tracked object based on output from alvar.
Definition: alvar_tracker.h:13
HardwareType
Type of hardware used by ControllerHardwareConnector. Enum ID must be contiguous. ...
Definition: base_controller_hardware_connector.h:11