VSM C++ SDK
Vehicle Specific Modules SDK
camera_series_by_time_action.h
1 // Copyright (c) 2014, Smart Projects Holdings Ltd
2 // All rights reserved.
3 // See LICENSE file for license details.
4 
8 #ifndef _CAMERA_SERIES_BY_TIME_ACTION_H_
9 #define _CAMERA_SERIES_BY_TIME_ACTION_H_
10 
11 #include <ugcs/vsm/action.h>
12 #include <ugcs/vsm/mavlink.h>
13 
14 namespace ugcs {
15 namespace vsm {
16 
20 
21 public:
22 
23  Camera_series_by_time_action(std::chrono::milliseconds interval,
24  Optional<int> count,
25  std::chrono::milliseconds initial_delay):
26  Action(Type::CAMERA_SERIES_BY_TIME),
27  interval(interval),
28  count(count),
30  {}
31 
37  Camera_series_by_time_action(const mavlink::ugcs::Pld_mission_item_ex& item):
38  Action(Type::CAMERA_SERIES_BY_TIME),
39  interval(std::chrono::milliseconds(item->param1)),
40  count(item->param2 == UINT32_MAX ? Optional<int>() : Optional<int>(item->param2)),
41  initial_delay(std::chrono::milliseconds(item->param3))
42  {
43  ASSERT(item->command == mavlink::ugcs::MAV_CMD::MAV_CMD_DO_CAMERA_SERIES_BY_TIME);
44  }
45 
50  Action(Type::CAMERA_SERIES_BY_TIME)
51  {
52  int tmp;
53  float time;
54 
55  if (p.at("count")->Get_value(tmp)) {
56  count = tmp;
57  }
58  p.at("period")->Get_value(time);
59  tmp = time * 1000;
60  interval = std::chrono::milliseconds(tmp);
61 
62  p.at("delay")->Get_value(time);
63  tmp = time * 1000;
64  initial_delay = std::chrono::milliseconds(tmp);
65  }
66 
68  std::chrono::milliseconds interval;
70  Optional<int> count;
74  std::chrono::milliseconds initial_delay;
75 };
76 
78 template<>
82 };
83 
84 } /* namespace vsm */
85 } /* namespace ugcs */
86 
87 #endif /* _CAMERA_SERIES_BY_TIME_ACTION_H_ */
UGCS root namespace.
Definition: android-linux/ugcs/vsm/platform_sockets.h:27
Definition: property.h:191
std::chrono::milliseconds interval
Time interval between two consequent shots.
Definition: camera_series_by_time_action.h:68
Camera_series_by_time_action(const Property_list &p)
Construct action from protobuf command.
Definition: camera_series_by_time_action.h:49
Type
Types of vehicle actions as part of task (mission).
Definition: action.h:30
Continuously shot camera in regular time intervals.
STL namespace.
Generic action.
Definition: action.h:22
#define ASSERT(x)
No action in release.
Definition: debug.h:68
Generic action.
Map Action type enum value to specific Action type class.
Definition: action.h:117
Performs a series of consequent camera shots in a fixed time intervals.
Definition: camera_series_by_time_action.h:18
#define DEFINE_COMMON_CLASS(__class_name,...)
Use this macro to define some common attributes for a class.
Definition: utils.h:25
Optional< int > count
Total number of shots to perform.
Definition: camera_series_by_time_action.h:70
Camera_series_by_time_action(const mavlink::ugcs::Pld_mission_item_ex &item)
Construct camera control action from Mavlink mission item.
Definition: camera_series_by_time_action.h:37
Camera_series_by_time_action type
Real type.
Definition: camera_series_by_time_action.h:81
std::chrono::milliseconds initial_delay
Initial delay.
Definition: camera_series_by_time_action.h:74