VSM C++ SDK
Vehicle Specific Modules SDK
camera_series_by_distance_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_DISTANCE_ACTION_H_
9 #define _CAMERA_SERIES_BY_DISTANCE_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 
24  Optional<int> count,
25  std::chrono::milliseconds initial_delay):
26  Action(Type::CAMERA_SERIES_BY_DISTANCE),
27  interval(interval),
28  count(count),
30  {}
31 
37  Camera_series_by_distance_action(const mavlink::ugcs::Pld_mission_item_ex& item):
38  Action(Type::CAMERA_SERIES_BY_DISTANCE),
39  interval(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_DISTANCE);
44  }
45 
50  Action(Type::CAMERA_SERIES_BY_DISTANCE)
51  {
52  int tmp;
53  float time;
54  if (p.at("count")->Get_value(tmp)) {
55  count = tmp;
56  }
57  p.at("distance")->Get_value(interval);
58  p.at("delay")->Get_value(time);
59  tmp = time * 1000;
60  initial_delay = std::chrono::milliseconds(tmp);
61  }
62 
64  double interval;
66  Optional<int> count;
70  std::chrono::milliseconds initial_delay;
71 };
72 
74 template<>
78 };
79 
80 } /* namespace vsm */
81 } /* namespace ugcs */
82 
83 #endif /* _CAMERA_SERIES_BY_DISTANCE_ACTION_H_ */
UGCS root namespace.
Definition: android-linux/ugcs/vsm/platform_sockets.h:27
double interval
Distance interval between two consequent shots in meters.
Definition: camera_series_by_distance_action.h:64
Definition: property.h:191
Performs a series of consequent camera shots in a fixed time intervals.
Definition: camera_series_by_distance_action.h:18
Continuously shot camera in regular distance intervals.
std::chrono::milliseconds initial_delay
Initial delay.
Definition: camera_series_by_distance_action.h:70
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
Camera_series_by_distance_action(const Property_list &p)
Construct action from protobuf command.
Definition: camera_series_by_distance_action.h:49
Optional< int > count
Total number of shots to perform.
Definition: camera_series_by_distance_action.h:66
Generic action.
Map Action type enum value to specific Action type class.
Definition: action.h:117
Camera_series_by_distance_action(const mavlink::ugcs::Pld_mission_item_ex &item)
Construct camera control action from Mavlink mission item.
Definition: camera_series_by_distance_action.h:37
#define DEFINE_COMMON_CLASS(__class_name,...)
Use this macro to define some common attributes for a class.
Definition: utils.h:25
Camera_series_by_distance_action type
Real type.
Definition: camera_series_by_distance_action.h:77