Statistics
| Branch: | Tag: | Revision:

amiro-os / include / Types.h @ 58fe0e0b

History | View | Annotate | Download (3.729 KB)

1
#ifndef TYPES_H_
2
#define TYPES_H_
3

    
4
/*! \brief Types to use if you work with the AMiRo platform
5
 *
6
 *  This header contains types which has to be used
7
 *  if they suit the problem.
8
 *  All physical constants (therefore all values with a
9
 *  physical unit) are implicitly in µ iff the variable
10
 *  is of type integer, unless it is explicitly named in
11
 *  the variable.
12
 *  All physical constants (therefore all values with a
13
 *  physical unit) are implicitly without prefix (e.g. µ)
14
 *  iff the variable is of type float, unless it is
15
 *  explicitly named in the variable.
16
 *  For the types, the SI prefix is used, iff the variable
17
 *  is of type float and therefor in SI units.
18
 */
19

    
20
namespace types {
21

    
22
  /**
23
   * A structure to represent the position and orientation of the robot
24
   */
25
  struct position {
26
    /*@{*/
27
    int32_t x;   /**< the x coordinate in µm */
28
    int32_t y;   /**< the y coordinate in µm */
29
    int32_t z;   /**< the z coordinate in µm */
30
    int32_t f_x; /**< the f_x orientation in µrad */
31
    int32_t f_y; /**< the f_y orientation in µrad */
32
    int32_t f_z; /**< the f_z orientation in µrad */
33
    /*@}*/
34
  };
35

    
36
  /**
37
   * A structure to represent the position and orientation of the robot
38
   */
39
  struct positionSI {
40
    /*@{*/
41
    float x;   /**< the x coordinate in m */
42
    float y;   /**< the y coordinate in m */
43
    float z;   /**< the z coordinate in m */
44
    float f_x; /**< the f_x coordinate in rad */
45
    float f_y; /**< the f_y coordinate in rad */
46
    float f_z; /**< the f_z coordinate in rad */
47
    /*@}*/
48
  };
49

    
50
  /**
51
   * A structure to represent the kinematics of the robot
52
   */
53
  struct kinematic {
54
    /*@{*/
55
    int32_t x;   /**< the x velocity in µm/s */
56
    int32_t y;   /**< the y velocity in µm/s */
57
    int32_t z;   /**< the z velocity in µm/s */
58
    int32_t w_x; /**< the w_x angular velocity in µrad/s */
59
    int32_t w_y; /**< the w_y angular velocity in µrad/s */
60
    int32_t w_z; /**< the w_z angular velocity in µrad/s */
61
    /*@}*/
62
  };
63

    
64
  /**
65
   * A structure to represent the kinematics of the robot
66
   */
67
  struct kinematicSI {
68
    /*@{*/
69
    float x;   /**< the x velovity in m/s */
70
    float y;   /**< the y velocity in m/s */
71
    float z;   /**< the z velocity in m/s */
72
    float f_x; /**< the f_x angular velocity in rad/s */
73
    float f_y; /**< the f_y angular velocity in rad/s */
74
    float f_z; /**< the f_z angular velocity in rad/s */
75
    /*@}*/
76
  };
77

    
78
  /**
79
   * A structure to represent the power status of the robot
80
   */
81
  struct power_status {
82
    /**
83
     * @brief A union to encode the current charging status
84
     */
85
    union ChargingState {
86
      uint8_t value = 0;
87
      struct {
88
        uint8_t powermanagement_plugged_in      : 1;  /**< status flag, whether the PowerManagement board is plugged in (physical plug detected) */
89
        uint8_t powermanagement_charging        : 1;  /**< status flag, whether the batteries are currently charged via the PowerManagement board */
90
        uint8_t diwheeldrive_enable_power_path  : 1;  /**< a flag to enable/disable charging via the DiWheelDrive board */
91
        uint8_t diwheeldrive_charging           : 1;  /**< status flag, whether the batteries are currently charged via the DiWheelDrive board */
92
        uint8_t vsys_higher_than_9V             : 1;  /**< status flag, whether vsys is currently higher than 9V */
93
        uint8_t rsvd                            : 3;
94
      } content;
95
    };
96

    
97
    /*@{*/
98
    ChargingState charging_flags; /**< charging status */
99
    uint8_t state_of_charge;      /**< state of charge of the batteries in percent */
100
    uint16_t minutes_remaining;   /**< remaining time until the batteries are fully charged/discharged in minutes*/
101
    uint16_t power_consumption;   /**< current power consumption in mW */
102
    /*@}*/
103
  };
104

    
105
}
106

    
107
#endif /* TYPES_ */