command.hpp
Go to the documentation of this file.
1 
9 /*****************************************************************************
10 ** Preprocessor
11 *****************************************************************************/
12 
13 #ifndef XBOT_COMMAND_DATA_HPP__
14 #define XBOT_COMMAND_DATA_HPP__
15 
16 /*****************************************************************************
17 ** Includes
18 *****************************************************************************/
19 
20 #include <ecl/containers.hpp>
22 #include "modules.hpp"
23 #include "macros.hpp"
24 
25 /*****************************************************************************
26 ** Namespace
27 *****************************************************************************/
28 
29 
30 namespace xbot
31 {
32 
34 {
35 public:
38 
42  enum Name
43  {
44  Power = 1,
45  BaseControl = 2,
46  YawPlatform=3,
47  PitchPlatform = 4,
48  Sound = 5,
49  StateLed = 6,
50  Lift = 7
51  };
52 
53 
66  struct Data
67  {
68  Data()
69  : command(BaseControl),
70  speed(0.0),
71  radius(0.0),
72  lift_height(0),
73  yaw_platform_degree(0),
74  pitch_platform_degree(0),
75  power_state(0),
76  sound_state(0),sound_volume(100),
77  led(0)
78  {
79  }
80 
82 
83  // BaseControl
84  float speed;
85  float radius;
86  unsigned char lift_height;
87  unsigned char yaw_platform_degree;
88  unsigned char pitch_platform_degree;
89  unsigned char led;
90  unsigned char sound_volume;
93 
94 
95 
96  };
97 
98  virtual ~Command() {}
99 
100  static Command SetVelocityControl(DiffDrive& diff_drive);
101  static Command SetVelocityControl(const float &speed, const float &radius);
102 
103  static Command SetLiftControl(const unsigned char &lift_height);
104 
105  static Command SetYawPlatformControl(const int &yaw_platform_degree);
106 
107  static Command SetPitchPlatformControl(const int &pitch_platform_degree);
108 
109  static Command SetSoundControl(const bool &sound_state);
110 
111  static Command SetLedControl(const unsigned char &led);
112 
113  static Command SetPowerControl(const bool &power_state);
115 
116  void resetBuffer(Buffer &buffer);
117  bool serialise(ecl::PushAndPop<unsigned char> & byteStream);
118  bool deserialise(ecl::PushAndPop<unsigned char> & byteStream) { return true; }
120 private:
121  static const unsigned char header0;
122  static const unsigned char header1;
123 
124 };
125 
126 } // namespace xbot
127 
128 #endif /* XBOT_COMMAND_DATA_HPP__ */
129 
static const unsigned char header1
Definition: command.hpp:122
unsigned char pitch_platform_degree
Definition: command.hpp:88
double radius
bool deserialise(ecl::PushAndPop< unsigned char > &byteStream)
Definition: command.hpp:118
unsigned char yaw_platform_degree
Definition: command.hpp:87
static const unsigned char header0
Definition: command.hpp:121
Macros for xbot_driver.
#define xbot_PUBLIC
Provides base class for payloads.
unsigned char lift_height
Definition: command.hpp:86
Base class for payloads.
double speed
unsigned char sound_volume
Definition: command.hpp:90
virtual ~Command()
Definition: command.hpp:98
Convenience header for modules.
ecl::PushAndPop< unsigned char > Buffer
Definition: command.hpp:36
A safe windowing class that opens onto array-like containers.
unsigned char led
Definition: command.hpp:89
Data structure containing data for commands.
Definition: command.hpp:66
Definition: command.hpp:30
ecl::Stencil< Buffer > BufferStencil
Definition: command.hpp:37


xbot_driver
Author(s): Roc, wangpeng@droid.ac.cn
autogenerated on Sat Oct 10 2020 03:27:37