VSM C++ SDK
Vehicle Specific Modules SDK
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Macros Pages
set_home_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_SET_HOME_ACTION_H_
9 #define _UGCS_VSM_SET_HOME_ACTION_H_
10 
11 #include <ugcs/vsm/action.h>
12 #include <ugcs/vsm/coordinates.h>
13 #include <ugcs/vsm/mavlink.h>
14 
15 namespace ugcs {
16 namespace vsm {
17 
19 class Set_home_action: public Action {
21 
22 public:
25  double elevation) :
26  Action(Type::SET_HOME),
27  use_current_position(use_current_position),
28  home_position(home_position),
30 
35  Action(Type::SET_HOME),
36  use_current_position(false),
38  {
39  double lat = 0, lon = 0, alt = 0;
40  auto pi = p.find("latitude");
41  if (pi != p.end()) {
42  pi->second->Get_value(lat);
43  }
44  pi = p.find("longitude");
45  if (pi != p.end()) {
46  pi->second->Get_value(lon);
47  }
48  pi = p.find("altitude_amsl");
49  if (pi != p.end()) {
50  pi->second->Get_value(alt);
51  }
52  home_position = Geodetic_tuple(lat, lon, alt);
53  p.at("ground_elevation")->Get_value(elevation);
54  }
55 
62 
67 
71  double elevation;
72 };
73 
75 template<>
76 struct Action::Mapper<Action::Type::SET_HOME> {
79 };
80 
81 } /* namespace vsm */
82 } /* namespace ugcs */
83 
84 #endif /* _UGCS_VSM_SET_HOME_ACTION_H_ */
Definition: property.h:249
Coordinates tuple for geodetic CS.
Definition: coordinates.h:36
Type
Types of vehicle actions as part of task (mission).
Definition: action.h:30
Set home position action.
Definition: set_home_action.h:19
Set_home_action(const Property_list &p)
Construct action from protobuf command.
Definition: set_home_action.h:34
Generic action.
Definition: action.h:22
bool use_current_position
If set, current vehicle position should be set as the home/base position on the action occurrence...
Definition: set_home_action.h:61
Wgs84_position home_position
Global position, that should be used as the home/base position.
Definition: set_home_action.h:66
double elevation
Elevation in meters (i.e.
Definition: set_home_action.h:71
Generic action.
Map Action type enum value to specific Action type class.
Definition: action.h:120
#define DEFINE_COMMON_CLASS(__class_name,...)
Use this macro to define some common attributes for a class.
Definition: utils.h:25
Coordinates manipulation.
Set_home_action type
Real type.
Definition: set_home_action.h:78