VSM C++ SDK
Vehicle Specific Modules SDK
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Macros Pages
task_attributes_action.h
Go to the documentation of this file.
1 // Copyright (c) 2018, Smart Projects Holdings Ltd
2 // All rights reserved.
3 // See LICENSE file for license details.
4 
8 #ifndef _UGCS_VSM_TASK_ATTRIBUTES_ACTION_H_
9 #define _UGCS_VSM_TASK_ATTRIBUTES_ACTION_H_
10 
11 #include <ugcs/vsm/action.h>
12 #include <ugcs/vsm/mavlink.h>
13 #include <ugcs/vsm/property.h>
14 
15 namespace ugcs {
16 namespace vsm {
17 
22 
23 public:
36  };
37 
41  Action(Type::TASK_ATTRIBUTES),
42  safe_altitude(safe_altitude), rc_loss(rc_loss),
43  gnss_loss(gnss_loss), low_battery(low_battery) {}
44 
47  Action(Type::TASK_ATTRIBUTES)
48  {
49  if (params.at("safe_altitude")->Is_value_na()) {
50  safe_altitude = NAN;
51  } else {
52  params.at("safe_altitude")->Get_value(safe_altitude);
53  }
54  int tmp;
55  if (params.at("rc_loss_action")->Get_value(tmp)) {
56  rc_loss = static_cast<Emergency_action>(tmp);
57  } else {
59  }
60  if (params.at("gps_loss_action")->Get_value(tmp)) {
61  gnss_loss = static_cast<Emergency_action>(tmp);
62  } else {
64  }
65  if (params.at("low_battery_action")->Get_value(tmp)) {
66  low_battery = static_cast<Emergency_action>(tmp);
67  } else {
69  }
70  }
71 
73  double safe_altitude;
74 
77 
82 
85 
86 private:
90  static Emergency_action
91  Mavlink_to_emergency_action(double mav_param);
92 };
93 
94 
96 template<>
97 struct Action::Mapper<Action::Type::TASK_ATTRIBUTES> {
100 };
101 
102 } /* namespace vsm */
103 } /* namespace ugcs */
104 
105 #endif /* _UGCS_VSM_TASK_ATTRIBUTES_ACTION_H_ */
Return and land at the home position.
Definition: task_attributes_action.h:27
Definition: property.h:249
Emergency_action low_battery
Type of action to perform in case of low battery.
Definition: task_attributes_action.h:84
Type
Types of vehicle actions as part of task (mission).
Definition: action.h:30
Emergency_action rc_loss
Type of action to perform in case of remote control loss.
Definition: task_attributes_action.h:76
Generic action.
Definition: action.h:22
Emergency_action
Action to perform in case of emergency.
Definition: task_attributes_action.h:25
Task_attributes_action(double safe_altitude, Emergency_action rc_loss, Emergency_action gnss_loss, Emergency_action low_battery)
Construct task attributes action explicitly.
Definition: task_attributes_action.h:39
Generic action.
Map Action type enum value to specific Action type class.
Definition: action.h:120
Continue the task.
Definition: task_attributes_action.h:33
Task_attributes_action type
Real type.
Definition: task_attributes_action.h:99
Emergency_action gnss_loss
Type of action to perform in case of GNSS signal loss (i.e.
Definition: task_attributes_action.h:81
Hover at the current position.
Definition: task_attributes_action.h:31
double safe_altitude
Safe altitude in meters (MSL).
Definition: task_attributes_action.h:73
Task_attributes_action(const Property_list &params)
Construct action from new style params.
Definition: task_attributes_action.h:46
#define DEFINE_COMMON_CLASS(__class_name,...)
Use this macro to define some common attributes for a class.
Definition: utils.h:25
do not change
Definition: task_attributes_action.h:35
Task attributes action.
Definition: task_attributes_action.h:20
Land at the current position.
Definition: task_attributes_action.h:29