Firmware for Arduino | PLEN Project Company Inc.
Motion.h
Go to the documentation of this file.
1 
8 #pragma once
9 
10 #ifndef PLEN2_MOTION_H
11 #define PLEN2_MOTION_H
12 
13 
14 #include <stdint.h>
15 
16 #include "JointController.h"
17 
18 namespace PLEN2
19 {
20  namespace Motion
21  {
22  enum
23  {
24  SLOT_BEGIN = 0,
25  SLOT_END = 90
26  };
27 
28  class Header;
29  class Frame;
30  }
31 }
32 
33 
43 {
44 public:
45  enum
46  {
54 
57  };
58 
64  static void init(Header& header);
65 
74  static bool set(uint8_t slot, const Header& header);
75 
84  static bool get(uint8_t slot, Header& header);
85 
86 
87  uint8_t slot;
88  char name[NAME_LENGTH];
89  uint8_t frame_length;
90 
91  uint8_t NON_RESERVED : 5;
92  uint8_t use_extra : 1;
93  uint8_t use_jump : 1;
94  uint8_t use_loop : 1;
95 
96  uint8_t loop_begin;
97  uint8_t loop_end;
98 
99  uint8_t loop_count;
100  uint8_t jump_slot;
101 
111  uint8_t stop_flags[2];
112 };
113 
114 
124 {
125 public:
126  enum
127  {
135 
137  FRAME_END = 20
138  };
139 
145  static void init(Frame& frame);
146 
156  static bool set(uint8_t slot, uint8_t index, const Frame& frame);
157 
167  static bool get(uint8_t slot, uint8_t index, Frame& frame);
168 
169 
170  uint8_t index;
173 
174  /*
175  uint8_t device_value[8]; //!< Output values.
176  */
177 };
178 
179 #endif // PLEN2_MOTION_H
Definition: AccelerationGyroSensor.h:16
uint8_t loop_end
Frame number of loop's ending.
Definition: Motion.h:97
uint8_t loop_begin
Frame number of loop's beginning.
Definition: Motion.h:96
Minimum value of frame length.
Definition: Motion.h:55
Class of a motion header.
Definition: Motion.h:42
Ending value of frames.
Definition: Motion.h:137
static bool set(uint8_t slot, uint8_t index, const Frame &frame)
Write the frame to external EEPROM.
Ending value of slots.
Definition: Motion.h:25
Beginning value of frames.
Definition: Motion.h:136
uint8_t stop_flags[2]
Array of stop flags.
Definition: Motion.h:111
static void init(Header &header)
Initialize the header.
Maximum value of frame length.
Definition: Motion.h:56
char name[NAME_LENGTH]
Motion name.
Definition: Motion.h:88
uint8_t use_extra
Selector to enable "extra".
Definition: Motion.h:92
uint8_t jump_slot
Slot number that is used for jumping when the motion's play is finished.
Definition: Motion.h:100
Summation of the servos controllable.
Definition: JointController.h:56
Beginning value of slots.
Definition: Motion.h:24
uint8_t NON_RESERVED
Undefined area. (It is reserved for future changes.)
Definition: Motion.h:91
uint8_t use_jump
Selector to enable "jump".
Definition: Motion.h:93
uint8_t frame_length
Frame length of a motion.
Definition: Motion.h:89
uint8_t loop_count
Loop count. (Using 255 as infinity.)
Definition: Motion.h:99
Update interval between frames.
Definition: Motion.h:134
static void init(Frame &frame)
Initialize the frame.
int16_t joint_angle[JointController::JOINTS_SUM]
Angles.
Definition: Motion.h:172
Management class of joints.
uint8_t index
Index of a frame.
Definition: Motion.h:170
uint16_t transition_time_ms
Time of transit to the frame.
Definition: Motion.h:171
Class of a motion frame.
Definition: Motion.h:123
uint8_t slot
Slot number of a motion.
Definition: Motion.h:87
Length of a motion name.
Definition: Motion.h:53
uint8_t use_loop
Selector to enable "loop".
Definition: Motion.h:94
static bool set(uint8_t slot, const Header &header)
Write the header to external EEPROM.