VSM C++ SDK
Vehicle Specific Modules SDK
panorama_action.h
Go to the documentation of this file.
1 // Copyright (c) 2014, Smart Projects Holdings Ltd
2 // All rights reserved.
3 // See LICENSE file for license details.
4 
8 #ifndef _PANORAMA_ACTION_H_
9 #define _PANORAMA_ACTION_H_
10 
11 #include <ugcs/vsm/action.h>
12 #include <ugcs/vsm/mavlink.h>
13 #include <chrono>
14 
15 namespace ugcs {
16 namespace vsm {
17 
24 class Panorama_action: public Action {
26 
27 public:
28 
32  ON,
35  };
36 
39  std::chrono::milliseconds delay, double speed):
40  Action(Type::PANORAMA), trigger_state(trigger_state),
41  angle(angle), step(step), delay(delay), speed(speed)
42  {}
43 
49  Panorama_action(const mavlink::ugcs::Pld_mission_item_ex& item) :
50  Action(Type::PANORAMA),
51  trigger_state(Mavlink_to_trigger_state(item->param1)),
52  angle(item->param2 * M_PI / 180.0),
53  step(item->param3 * M_PI / 180.0),
54  delay(std::chrono::milliseconds(item->param4)),
55  speed(item->x * M_PI / 180.0)
56 
57  {
58  ASSERT(item->command == mavlink::ugcs::MAV_CMD::MAV_CMD_DO_PANORAMA);
59  }
60 
65  Action(Type::PANORAMA)
66  {
67  int tmp;
68  float time;
69  p.at("mode")->Get_value(tmp);
70  trigger_state = Mavlink_to_trigger_state(tmp);
71  p.at("angle")->Get_value(angle);
72  p.at("step")->Get_value(step);
73  p.at("delay")->Get_value(time);
74  tmp = time * 1000;
75  delay = std::chrono::milliseconds(tmp);
76  p.at("speed")->Get_value(speed);
77  }
78 
81 
86  double angle;
87 
91  double step;
92 
94  std::chrono::milliseconds delay;
95 
97  double speed;
98 
99 private:
100 
105  static Trigger_state
106  Mavlink_to_trigger_state(double mav_param);
107 
108 
109 };
110 
112 template<>
116 };
117 
118 } /* namespace vsm */
119 } /* namespace ugcs */
120 
121 #endif /* _PANORAMA_ACTION_H_ */
UGCS root namespace.
Definition: android-linux/ugcs/vsm/platform_sockets.h:27
Panorama_action(Trigger_state trigger_state, double angle, double step, std::chrono::milliseconds delay, double speed)
Construct panorama action explicitly.
Definition: panorama_action.h:38
Definition: property.h:191
std::chrono::milliseconds delay
Delay interval between two steps.
Definition: panorama_action.h:94
double step
Absolute value of a step angle in case of a discrete shooting.
Definition: panorama_action.h:91
Continuous exposure.
Definition: panorama_action.h:32
double speed
Rotation speed in radians per second.
Definition: panorama_action.h:97
Type
Types of vehicle actions as part of task (mission).
Definition: action.h:30
STL namespace.
Generic action.
Definition: action.h:22
#define ASSERT(x)
No action in release.
Definition: debug.h:68
Discrete, once per step, shooting.
Definition: panorama_action.h:34
Panorama_action(const mavlink::ugcs::Pld_mission_item_ex &item)
Construct panorama action action from Mavlink mission item.
Definition: panorama_action.h:49
Panorama action ugcs::vsm::Panorama_action.
Generic action.
Map Action type enum value to specific Action type class.
Definition: action.h:117
Trigger_state trigger_state
Trigger state.
Definition: panorama_action.h:80
double angle
Target panorama angle in a range [-2Pi, 2Pi].
Definition: panorama_action.h:86
#define M_PI
PI constant.
Definition: coordinates.h:21
#define DEFINE_COMMON_CLASS(__class_name,...)
Use this macro to define some common attributes for a class.
Definition: utils.h:25
Panorama_action type
Real type.
Definition: panorama_action.h:115
Trigger_state
Camera trigger state.
Definition: panorama_action.h:30
Panorama action.
Definition: panorama_action.h:24
Panorama_action(const Property_list &p)
Construct action from protobuf command.
Definition: panorama_action.h:64