ros melodic library with custom message
Dependents: Robot_team1_QEI_Douglas Robot_team1
ros_lib/control_msgs/PidState.h@3:b964e3f71102, 2019-12-03 (annotated)
- Committer:
- florine_van
- Date:
- Tue Dec 03 09:39:29 2019 +0000
- Revision:
- 3:b964e3f71102
- Parent:
- 0:020db18a476d
Clean code and remove unused lines
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
scarter1 | 0:020db18a476d | 1 | #ifndef _ROS_control_msgs_PidState_h |
scarter1 | 0:020db18a476d | 2 | #define _ROS_control_msgs_PidState_h |
scarter1 | 0:020db18a476d | 3 | |
scarter1 | 0:020db18a476d | 4 | #include <stdint.h> |
scarter1 | 0:020db18a476d | 5 | #include <string.h> |
scarter1 | 0:020db18a476d | 6 | #include <stdlib.h> |
scarter1 | 0:020db18a476d | 7 | #include "ros/msg.h" |
scarter1 | 0:020db18a476d | 8 | #include "std_msgs/Header.h" |
scarter1 | 0:020db18a476d | 9 | #include "ros/duration.h" |
scarter1 | 0:020db18a476d | 10 | |
scarter1 | 0:020db18a476d | 11 | namespace control_msgs |
scarter1 | 0:020db18a476d | 12 | { |
scarter1 | 0:020db18a476d | 13 | |
scarter1 | 0:020db18a476d | 14 | class PidState : public ros::Msg |
scarter1 | 0:020db18a476d | 15 | { |
scarter1 | 0:020db18a476d | 16 | public: |
scarter1 | 0:020db18a476d | 17 | typedef std_msgs::Header _header_type; |
scarter1 | 0:020db18a476d | 18 | _header_type header; |
scarter1 | 0:020db18a476d | 19 | typedef ros::Duration _timestep_type; |
scarter1 | 0:020db18a476d | 20 | _timestep_type timestep; |
scarter1 | 0:020db18a476d | 21 | typedef double _error_type; |
scarter1 | 0:020db18a476d | 22 | _error_type error; |
scarter1 | 0:020db18a476d | 23 | typedef double _error_dot_type; |
scarter1 | 0:020db18a476d | 24 | _error_dot_type error_dot; |
scarter1 | 0:020db18a476d | 25 | typedef double _p_error_type; |
scarter1 | 0:020db18a476d | 26 | _p_error_type p_error; |
scarter1 | 0:020db18a476d | 27 | typedef double _i_error_type; |
scarter1 | 0:020db18a476d | 28 | _i_error_type i_error; |
scarter1 | 0:020db18a476d | 29 | typedef double _d_error_type; |
scarter1 | 0:020db18a476d | 30 | _d_error_type d_error; |
scarter1 | 0:020db18a476d | 31 | typedef double _p_term_type; |
scarter1 | 0:020db18a476d | 32 | _p_term_type p_term; |
scarter1 | 0:020db18a476d | 33 | typedef double _i_term_type; |
scarter1 | 0:020db18a476d | 34 | _i_term_type i_term; |
scarter1 | 0:020db18a476d | 35 | typedef double _d_term_type; |
scarter1 | 0:020db18a476d | 36 | _d_term_type d_term; |
scarter1 | 0:020db18a476d | 37 | typedef double _i_max_type; |
scarter1 | 0:020db18a476d | 38 | _i_max_type i_max; |
scarter1 | 0:020db18a476d | 39 | typedef double _i_min_type; |
scarter1 | 0:020db18a476d | 40 | _i_min_type i_min; |
scarter1 | 0:020db18a476d | 41 | typedef double _output_type; |
scarter1 | 0:020db18a476d | 42 | _output_type output; |
scarter1 | 0:020db18a476d | 43 | |
scarter1 | 0:020db18a476d | 44 | PidState(): |
scarter1 | 0:020db18a476d | 45 | header(), |
scarter1 | 0:020db18a476d | 46 | timestep(), |
scarter1 | 0:020db18a476d | 47 | error(0), |
scarter1 | 0:020db18a476d | 48 | error_dot(0), |
scarter1 | 0:020db18a476d | 49 | p_error(0), |
scarter1 | 0:020db18a476d | 50 | i_error(0), |
scarter1 | 0:020db18a476d | 51 | d_error(0), |
scarter1 | 0:020db18a476d | 52 | p_term(0), |
scarter1 | 0:020db18a476d | 53 | i_term(0), |
scarter1 | 0:020db18a476d | 54 | d_term(0), |
scarter1 | 0:020db18a476d | 55 | i_max(0), |
scarter1 | 0:020db18a476d | 56 | i_min(0), |
scarter1 | 0:020db18a476d | 57 | output(0) |
scarter1 | 0:020db18a476d | 58 | { |
scarter1 | 0:020db18a476d | 59 | } |
scarter1 | 0:020db18a476d | 60 | |
scarter1 | 0:020db18a476d | 61 | virtual int serialize(unsigned char *outbuffer) const |
scarter1 | 0:020db18a476d | 62 | { |
scarter1 | 0:020db18a476d | 63 | int offset = 0; |
scarter1 | 0:020db18a476d | 64 | offset += this->header.serialize(outbuffer + offset); |
scarter1 | 0:020db18a476d | 65 | *(outbuffer + offset + 0) = (this->timestep.sec >> (8 * 0)) & 0xFF; |
scarter1 | 0:020db18a476d | 66 | *(outbuffer + offset + 1) = (this->timestep.sec >> (8 * 1)) & 0xFF; |
scarter1 | 0:020db18a476d | 67 | *(outbuffer + offset + 2) = (this->timestep.sec >> (8 * 2)) & 0xFF; |
scarter1 | 0:020db18a476d | 68 | *(outbuffer + offset + 3) = (this->timestep.sec >> (8 * 3)) & 0xFF; |
scarter1 | 0:020db18a476d | 69 | offset += sizeof(this->timestep.sec); |
scarter1 | 0:020db18a476d | 70 | *(outbuffer + offset + 0) = (this->timestep.nsec >> (8 * 0)) & 0xFF; |
scarter1 | 0:020db18a476d | 71 | *(outbuffer + offset + 1) = (this->timestep.nsec >> (8 * 1)) & 0xFF; |
scarter1 | 0:020db18a476d | 72 | *(outbuffer + offset + 2) = (this->timestep.nsec >> (8 * 2)) & 0xFF; |
scarter1 | 0:020db18a476d | 73 | *(outbuffer + offset + 3) = (this->timestep.nsec >> (8 * 3)) & 0xFF; |
scarter1 | 0:020db18a476d | 74 | offset += sizeof(this->timestep.nsec); |
scarter1 | 0:020db18a476d | 75 | union { |
scarter1 | 0:020db18a476d | 76 | double real; |
scarter1 | 0:020db18a476d | 77 | uint64_t base; |
scarter1 | 0:020db18a476d | 78 | } u_error; |
scarter1 | 0:020db18a476d | 79 | u_error.real = this->error; |
scarter1 | 0:020db18a476d | 80 | *(outbuffer + offset + 0) = (u_error.base >> (8 * 0)) & 0xFF; |
scarter1 | 0:020db18a476d | 81 | *(outbuffer + offset + 1) = (u_error.base >> (8 * 1)) & 0xFF; |
scarter1 | 0:020db18a476d | 82 | *(outbuffer + offset + 2) = (u_error.base >> (8 * 2)) & 0xFF; |
scarter1 | 0:020db18a476d | 83 | *(outbuffer + offset + 3) = (u_error.base >> (8 * 3)) & 0xFF; |
scarter1 | 0:020db18a476d | 84 | *(outbuffer + offset + 4) = (u_error.base >> (8 * 4)) & 0xFF; |
scarter1 | 0:020db18a476d | 85 | *(outbuffer + offset + 5) = (u_error.base >> (8 * 5)) & 0xFF; |
scarter1 | 0:020db18a476d | 86 | *(outbuffer + offset + 6) = (u_error.base >> (8 * 6)) & 0xFF; |
scarter1 | 0:020db18a476d | 87 | *(outbuffer + offset + 7) = (u_error.base >> (8 * 7)) & 0xFF; |
scarter1 | 0:020db18a476d | 88 | offset += sizeof(this->error); |
scarter1 | 0:020db18a476d | 89 | union { |
scarter1 | 0:020db18a476d | 90 | double real; |
scarter1 | 0:020db18a476d | 91 | uint64_t base; |
scarter1 | 0:020db18a476d | 92 | } u_error_dot; |
scarter1 | 0:020db18a476d | 93 | u_error_dot.real = this->error_dot; |
scarter1 | 0:020db18a476d | 94 | *(outbuffer + offset + 0) = (u_error_dot.base >> (8 * 0)) & 0xFF; |
scarter1 | 0:020db18a476d | 95 | *(outbuffer + offset + 1) = (u_error_dot.base >> (8 * 1)) & 0xFF; |
scarter1 | 0:020db18a476d | 96 | *(outbuffer + offset + 2) = (u_error_dot.base >> (8 * 2)) & 0xFF; |
scarter1 | 0:020db18a476d | 97 | *(outbuffer + offset + 3) = (u_error_dot.base >> (8 * 3)) & 0xFF; |
scarter1 | 0:020db18a476d | 98 | *(outbuffer + offset + 4) = (u_error_dot.base >> (8 * 4)) & 0xFF; |
scarter1 | 0:020db18a476d | 99 | *(outbuffer + offset + 5) = (u_error_dot.base >> (8 * 5)) & 0xFF; |
scarter1 | 0:020db18a476d | 100 | *(outbuffer + offset + 6) = (u_error_dot.base >> (8 * 6)) & 0xFF; |
scarter1 | 0:020db18a476d | 101 | *(outbuffer + offset + 7) = (u_error_dot.base >> (8 * 7)) & 0xFF; |
scarter1 | 0:020db18a476d | 102 | offset += sizeof(this->error_dot); |
scarter1 | 0:020db18a476d | 103 | union { |
scarter1 | 0:020db18a476d | 104 | double real; |
scarter1 | 0:020db18a476d | 105 | uint64_t base; |
scarter1 | 0:020db18a476d | 106 | } u_p_error; |
scarter1 | 0:020db18a476d | 107 | u_p_error.real = this->p_error; |
scarter1 | 0:020db18a476d | 108 | *(outbuffer + offset + 0) = (u_p_error.base >> (8 * 0)) & 0xFF; |
scarter1 | 0:020db18a476d | 109 | *(outbuffer + offset + 1) = (u_p_error.base >> (8 * 1)) & 0xFF; |
scarter1 | 0:020db18a476d | 110 | *(outbuffer + offset + 2) = (u_p_error.base >> (8 * 2)) & 0xFF; |
scarter1 | 0:020db18a476d | 111 | *(outbuffer + offset + 3) = (u_p_error.base >> (8 * 3)) & 0xFF; |
scarter1 | 0:020db18a476d | 112 | *(outbuffer + offset + 4) = (u_p_error.base >> (8 * 4)) & 0xFF; |
scarter1 | 0:020db18a476d | 113 | *(outbuffer + offset + 5) = (u_p_error.base >> (8 * 5)) & 0xFF; |
scarter1 | 0:020db18a476d | 114 | *(outbuffer + offset + 6) = (u_p_error.base >> (8 * 6)) & 0xFF; |
scarter1 | 0:020db18a476d | 115 | *(outbuffer + offset + 7) = (u_p_error.base >> (8 * 7)) & 0xFF; |
scarter1 | 0:020db18a476d | 116 | offset += sizeof(this->p_error); |
scarter1 | 0:020db18a476d | 117 | union { |
scarter1 | 0:020db18a476d | 118 | double real; |
scarter1 | 0:020db18a476d | 119 | uint64_t base; |
scarter1 | 0:020db18a476d | 120 | } u_i_error; |
scarter1 | 0:020db18a476d | 121 | u_i_error.real = this->i_error; |
scarter1 | 0:020db18a476d | 122 | *(outbuffer + offset + 0) = (u_i_error.base >> (8 * 0)) & 0xFF; |
scarter1 | 0:020db18a476d | 123 | *(outbuffer + offset + 1) = (u_i_error.base >> (8 * 1)) & 0xFF; |
scarter1 | 0:020db18a476d | 124 | *(outbuffer + offset + 2) = (u_i_error.base >> (8 * 2)) & 0xFF; |
scarter1 | 0:020db18a476d | 125 | *(outbuffer + offset + 3) = (u_i_error.base >> (8 * 3)) & 0xFF; |
scarter1 | 0:020db18a476d | 126 | *(outbuffer + offset + 4) = (u_i_error.base >> (8 * 4)) & 0xFF; |
scarter1 | 0:020db18a476d | 127 | *(outbuffer + offset + 5) = (u_i_error.base >> (8 * 5)) & 0xFF; |
scarter1 | 0:020db18a476d | 128 | *(outbuffer + offset + 6) = (u_i_error.base >> (8 * 6)) & 0xFF; |
scarter1 | 0:020db18a476d | 129 | *(outbuffer + offset + 7) = (u_i_error.base >> (8 * 7)) & 0xFF; |
scarter1 | 0:020db18a476d | 130 | offset += sizeof(this->i_error); |
scarter1 | 0:020db18a476d | 131 | union { |
scarter1 | 0:020db18a476d | 132 | double real; |
scarter1 | 0:020db18a476d | 133 | uint64_t base; |
scarter1 | 0:020db18a476d | 134 | } u_d_error; |
scarter1 | 0:020db18a476d | 135 | u_d_error.real = this->d_error; |
scarter1 | 0:020db18a476d | 136 | *(outbuffer + offset + 0) = (u_d_error.base >> (8 * 0)) & 0xFF; |
scarter1 | 0:020db18a476d | 137 | *(outbuffer + offset + 1) = (u_d_error.base >> (8 * 1)) & 0xFF; |
scarter1 | 0:020db18a476d | 138 | *(outbuffer + offset + 2) = (u_d_error.base >> (8 * 2)) & 0xFF; |
scarter1 | 0:020db18a476d | 139 | *(outbuffer + offset + 3) = (u_d_error.base >> (8 * 3)) & 0xFF; |
scarter1 | 0:020db18a476d | 140 | *(outbuffer + offset + 4) = (u_d_error.base >> (8 * 4)) & 0xFF; |
scarter1 | 0:020db18a476d | 141 | *(outbuffer + offset + 5) = (u_d_error.base >> (8 * 5)) & 0xFF; |
scarter1 | 0:020db18a476d | 142 | *(outbuffer + offset + 6) = (u_d_error.base >> (8 * 6)) & 0xFF; |
scarter1 | 0:020db18a476d | 143 | *(outbuffer + offset + 7) = (u_d_error.base >> (8 * 7)) & 0xFF; |
scarter1 | 0:020db18a476d | 144 | offset += sizeof(this->d_error); |
scarter1 | 0:020db18a476d | 145 | union { |
scarter1 | 0:020db18a476d | 146 | double real; |
scarter1 | 0:020db18a476d | 147 | uint64_t base; |
scarter1 | 0:020db18a476d | 148 | } u_p_term; |
scarter1 | 0:020db18a476d | 149 | u_p_term.real = this->p_term; |
scarter1 | 0:020db18a476d | 150 | *(outbuffer + offset + 0) = (u_p_term.base >> (8 * 0)) & 0xFF; |
scarter1 | 0:020db18a476d | 151 | *(outbuffer + offset + 1) = (u_p_term.base >> (8 * 1)) & 0xFF; |
scarter1 | 0:020db18a476d | 152 | *(outbuffer + offset + 2) = (u_p_term.base >> (8 * 2)) & 0xFF; |
scarter1 | 0:020db18a476d | 153 | *(outbuffer + offset + 3) = (u_p_term.base >> (8 * 3)) & 0xFF; |
scarter1 | 0:020db18a476d | 154 | *(outbuffer + offset + 4) = (u_p_term.base >> (8 * 4)) & 0xFF; |
scarter1 | 0:020db18a476d | 155 | *(outbuffer + offset + 5) = (u_p_term.base >> (8 * 5)) & 0xFF; |
scarter1 | 0:020db18a476d | 156 | *(outbuffer + offset + 6) = (u_p_term.base >> (8 * 6)) & 0xFF; |
scarter1 | 0:020db18a476d | 157 | *(outbuffer + offset + 7) = (u_p_term.base >> (8 * 7)) & 0xFF; |
scarter1 | 0:020db18a476d | 158 | offset += sizeof(this->p_term); |
scarter1 | 0:020db18a476d | 159 | union { |
scarter1 | 0:020db18a476d | 160 | double real; |
scarter1 | 0:020db18a476d | 161 | uint64_t base; |
scarter1 | 0:020db18a476d | 162 | } u_i_term; |
scarter1 | 0:020db18a476d | 163 | u_i_term.real = this->i_term; |
scarter1 | 0:020db18a476d | 164 | *(outbuffer + offset + 0) = (u_i_term.base >> (8 * 0)) & 0xFF; |
scarter1 | 0:020db18a476d | 165 | *(outbuffer + offset + 1) = (u_i_term.base >> (8 * 1)) & 0xFF; |
scarter1 | 0:020db18a476d | 166 | *(outbuffer + offset + 2) = (u_i_term.base >> (8 * 2)) & 0xFF; |
scarter1 | 0:020db18a476d | 167 | *(outbuffer + offset + 3) = (u_i_term.base >> (8 * 3)) & 0xFF; |
scarter1 | 0:020db18a476d | 168 | *(outbuffer + offset + 4) = (u_i_term.base >> (8 * 4)) & 0xFF; |
scarter1 | 0:020db18a476d | 169 | *(outbuffer + offset + 5) = (u_i_term.base >> (8 * 5)) & 0xFF; |
scarter1 | 0:020db18a476d | 170 | *(outbuffer + offset + 6) = (u_i_term.base >> (8 * 6)) & 0xFF; |
scarter1 | 0:020db18a476d | 171 | *(outbuffer + offset + 7) = (u_i_term.base >> (8 * 7)) & 0xFF; |
scarter1 | 0:020db18a476d | 172 | offset += sizeof(this->i_term); |
scarter1 | 0:020db18a476d | 173 | union { |
scarter1 | 0:020db18a476d | 174 | double real; |
scarter1 | 0:020db18a476d | 175 | uint64_t base; |
scarter1 | 0:020db18a476d | 176 | } u_d_term; |
scarter1 | 0:020db18a476d | 177 | u_d_term.real = this->d_term; |
scarter1 | 0:020db18a476d | 178 | *(outbuffer + offset + 0) = (u_d_term.base >> (8 * 0)) & 0xFF; |
scarter1 | 0:020db18a476d | 179 | *(outbuffer + offset + 1) = (u_d_term.base >> (8 * 1)) & 0xFF; |
scarter1 | 0:020db18a476d | 180 | *(outbuffer + offset + 2) = (u_d_term.base >> (8 * 2)) & 0xFF; |
scarter1 | 0:020db18a476d | 181 | *(outbuffer + offset + 3) = (u_d_term.base >> (8 * 3)) & 0xFF; |
scarter1 | 0:020db18a476d | 182 | *(outbuffer + offset + 4) = (u_d_term.base >> (8 * 4)) & 0xFF; |
scarter1 | 0:020db18a476d | 183 | *(outbuffer + offset + 5) = (u_d_term.base >> (8 * 5)) & 0xFF; |
scarter1 | 0:020db18a476d | 184 | *(outbuffer + offset + 6) = (u_d_term.base >> (8 * 6)) & 0xFF; |
scarter1 | 0:020db18a476d | 185 | *(outbuffer + offset + 7) = (u_d_term.base >> (8 * 7)) & 0xFF; |
scarter1 | 0:020db18a476d | 186 | offset += sizeof(this->d_term); |
scarter1 | 0:020db18a476d | 187 | union { |
scarter1 | 0:020db18a476d | 188 | double real; |
scarter1 | 0:020db18a476d | 189 | uint64_t base; |
scarter1 | 0:020db18a476d | 190 | } u_i_max; |
scarter1 | 0:020db18a476d | 191 | u_i_max.real = this->i_max; |
scarter1 | 0:020db18a476d | 192 | *(outbuffer + offset + 0) = (u_i_max.base >> (8 * 0)) & 0xFF; |
scarter1 | 0:020db18a476d | 193 | *(outbuffer + offset + 1) = (u_i_max.base >> (8 * 1)) & 0xFF; |
scarter1 | 0:020db18a476d | 194 | *(outbuffer + offset + 2) = (u_i_max.base >> (8 * 2)) & 0xFF; |
scarter1 | 0:020db18a476d | 195 | *(outbuffer + offset + 3) = (u_i_max.base >> (8 * 3)) & 0xFF; |
scarter1 | 0:020db18a476d | 196 | *(outbuffer + offset + 4) = (u_i_max.base >> (8 * 4)) & 0xFF; |
scarter1 | 0:020db18a476d | 197 | *(outbuffer + offset + 5) = (u_i_max.base >> (8 * 5)) & 0xFF; |
scarter1 | 0:020db18a476d | 198 | *(outbuffer + offset + 6) = (u_i_max.base >> (8 * 6)) & 0xFF; |
scarter1 | 0:020db18a476d | 199 | *(outbuffer + offset + 7) = (u_i_max.base >> (8 * 7)) & 0xFF; |
scarter1 | 0:020db18a476d | 200 | offset += sizeof(this->i_max); |
scarter1 | 0:020db18a476d | 201 | union { |
scarter1 | 0:020db18a476d | 202 | double real; |
scarter1 | 0:020db18a476d | 203 | uint64_t base; |
scarter1 | 0:020db18a476d | 204 | } u_i_min; |
scarter1 | 0:020db18a476d | 205 | u_i_min.real = this->i_min; |
scarter1 | 0:020db18a476d | 206 | *(outbuffer + offset + 0) = (u_i_min.base >> (8 * 0)) & 0xFF; |
scarter1 | 0:020db18a476d | 207 | *(outbuffer + offset + 1) = (u_i_min.base >> (8 * 1)) & 0xFF; |
scarter1 | 0:020db18a476d | 208 | *(outbuffer + offset + 2) = (u_i_min.base >> (8 * 2)) & 0xFF; |
scarter1 | 0:020db18a476d | 209 | *(outbuffer + offset + 3) = (u_i_min.base >> (8 * 3)) & 0xFF; |
scarter1 | 0:020db18a476d | 210 | *(outbuffer + offset + 4) = (u_i_min.base >> (8 * 4)) & 0xFF; |
scarter1 | 0:020db18a476d | 211 | *(outbuffer + offset + 5) = (u_i_min.base >> (8 * 5)) & 0xFF; |
scarter1 | 0:020db18a476d | 212 | *(outbuffer + offset + 6) = (u_i_min.base >> (8 * 6)) & 0xFF; |
scarter1 | 0:020db18a476d | 213 | *(outbuffer + offset + 7) = (u_i_min.base >> (8 * 7)) & 0xFF; |
scarter1 | 0:020db18a476d | 214 | offset += sizeof(this->i_min); |
scarter1 | 0:020db18a476d | 215 | union { |
scarter1 | 0:020db18a476d | 216 | double real; |
scarter1 | 0:020db18a476d | 217 | uint64_t base; |
scarter1 | 0:020db18a476d | 218 | } u_output; |
scarter1 | 0:020db18a476d | 219 | u_output.real = this->output; |
scarter1 | 0:020db18a476d | 220 | *(outbuffer + offset + 0) = (u_output.base >> (8 * 0)) & 0xFF; |
scarter1 | 0:020db18a476d | 221 | *(outbuffer + offset + 1) = (u_output.base >> (8 * 1)) & 0xFF; |
scarter1 | 0:020db18a476d | 222 | *(outbuffer + offset + 2) = (u_output.base >> (8 * 2)) & 0xFF; |
scarter1 | 0:020db18a476d | 223 | *(outbuffer + offset + 3) = (u_output.base >> (8 * 3)) & 0xFF; |
scarter1 | 0:020db18a476d | 224 | *(outbuffer + offset + 4) = (u_output.base >> (8 * 4)) & 0xFF; |
scarter1 | 0:020db18a476d | 225 | *(outbuffer + offset + 5) = (u_output.base >> (8 * 5)) & 0xFF; |
scarter1 | 0:020db18a476d | 226 | *(outbuffer + offset + 6) = (u_output.base >> (8 * 6)) & 0xFF; |
scarter1 | 0:020db18a476d | 227 | *(outbuffer + offset + 7) = (u_output.base >> (8 * 7)) & 0xFF; |
scarter1 | 0:020db18a476d | 228 | offset += sizeof(this->output); |
scarter1 | 0:020db18a476d | 229 | return offset; |
scarter1 | 0:020db18a476d | 230 | } |
scarter1 | 0:020db18a476d | 231 | |
scarter1 | 0:020db18a476d | 232 | virtual int deserialize(unsigned char *inbuffer) |
scarter1 | 0:020db18a476d | 233 | { |
scarter1 | 0:020db18a476d | 234 | int offset = 0; |
scarter1 | 0:020db18a476d | 235 | offset += this->header.deserialize(inbuffer + offset); |
scarter1 | 0:020db18a476d | 236 | this->timestep.sec = ((uint32_t) (*(inbuffer + offset))); |
scarter1 | 0:020db18a476d | 237 | this->timestep.sec |= ((uint32_t) (*(inbuffer + offset + 1))) << (8 * 1); |
scarter1 | 0:020db18a476d | 238 | this->timestep.sec |= ((uint32_t) (*(inbuffer + offset + 2))) << (8 * 2); |
scarter1 | 0:020db18a476d | 239 | this->timestep.sec |= ((uint32_t) (*(inbuffer + offset + 3))) << (8 * 3); |
scarter1 | 0:020db18a476d | 240 | offset += sizeof(this->timestep.sec); |
scarter1 | 0:020db18a476d | 241 | this->timestep.nsec = ((uint32_t) (*(inbuffer + offset))); |
scarter1 | 0:020db18a476d | 242 | this->timestep.nsec |= ((uint32_t) (*(inbuffer + offset + 1))) << (8 * 1); |
scarter1 | 0:020db18a476d | 243 | this->timestep.nsec |= ((uint32_t) (*(inbuffer + offset + 2))) << (8 * 2); |
scarter1 | 0:020db18a476d | 244 | this->timestep.nsec |= ((uint32_t) (*(inbuffer + offset + 3))) << (8 * 3); |
scarter1 | 0:020db18a476d | 245 | offset += sizeof(this->timestep.nsec); |
scarter1 | 0:020db18a476d | 246 | union { |
scarter1 | 0:020db18a476d | 247 | double real; |
scarter1 | 0:020db18a476d | 248 | uint64_t base; |
scarter1 | 0:020db18a476d | 249 | } u_error; |
scarter1 | 0:020db18a476d | 250 | u_error.base = 0; |
scarter1 | 0:020db18a476d | 251 | u_error.base |= ((uint64_t) (*(inbuffer + offset + 0))) << (8 * 0); |
scarter1 | 0:020db18a476d | 252 | u_error.base |= ((uint64_t) (*(inbuffer + offset + 1))) << (8 * 1); |
scarter1 | 0:020db18a476d | 253 | u_error.base |= ((uint64_t) (*(inbuffer + offset + 2))) << (8 * 2); |
scarter1 | 0:020db18a476d | 254 | u_error.base |= ((uint64_t) (*(inbuffer + offset + 3))) << (8 * 3); |
scarter1 | 0:020db18a476d | 255 | u_error.base |= ((uint64_t) (*(inbuffer + offset + 4))) << (8 * 4); |
scarter1 | 0:020db18a476d | 256 | u_error.base |= ((uint64_t) (*(inbuffer + offset + 5))) << (8 * 5); |
scarter1 | 0:020db18a476d | 257 | u_error.base |= ((uint64_t) (*(inbuffer + offset + 6))) << (8 * 6); |
scarter1 | 0:020db18a476d | 258 | u_error.base |= ((uint64_t) (*(inbuffer + offset + 7))) << (8 * 7); |
scarter1 | 0:020db18a476d | 259 | this->error = u_error.real; |
scarter1 | 0:020db18a476d | 260 | offset += sizeof(this->error); |
scarter1 | 0:020db18a476d | 261 | union { |
scarter1 | 0:020db18a476d | 262 | double real; |
scarter1 | 0:020db18a476d | 263 | uint64_t base; |
scarter1 | 0:020db18a476d | 264 | } u_error_dot; |
scarter1 | 0:020db18a476d | 265 | u_error_dot.base = 0; |
scarter1 | 0:020db18a476d | 266 | u_error_dot.base |= ((uint64_t) (*(inbuffer + offset + 0))) << (8 * 0); |
scarter1 | 0:020db18a476d | 267 | u_error_dot.base |= ((uint64_t) (*(inbuffer + offset + 1))) << (8 * 1); |
scarter1 | 0:020db18a476d | 268 | u_error_dot.base |= ((uint64_t) (*(inbuffer + offset + 2))) << (8 * 2); |
scarter1 | 0:020db18a476d | 269 | u_error_dot.base |= ((uint64_t) (*(inbuffer + offset + 3))) << (8 * 3); |
scarter1 | 0:020db18a476d | 270 | u_error_dot.base |= ((uint64_t) (*(inbuffer + offset + 4))) << (8 * 4); |
scarter1 | 0:020db18a476d | 271 | u_error_dot.base |= ((uint64_t) (*(inbuffer + offset + 5))) << (8 * 5); |
scarter1 | 0:020db18a476d | 272 | u_error_dot.base |= ((uint64_t) (*(inbuffer + offset + 6))) << (8 * 6); |
scarter1 | 0:020db18a476d | 273 | u_error_dot.base |= ((uint64_t) (*(inbuffer + offset + 7))) << (8 * 7); |
scarter1 | 0:020db18a476d | 274 | this->error_dot = u_error_dot.real; |
scarter1 | 0:020db18a476d | 275 | offset += sizeof(this->error_dot); |
scarter1 | 0:020db18a476d | 276 | union { |
scarter1 | 0:020db18a476d | 277 | double real; |
scarter1 | 0:020db18a476d | 278 | uint64_t base; |
scarter1 | 0:020db18a476d | 279 | } u_p_error; |
scarter1 | 0:020db18a476d | 280 | u_p_error.base = 0; |
scarter1 | 0:020db18a476d | 281 | u_p_error.base |= ((uint64_t) (*(inbuffer + offset + 0))) << (8 * 0); |
scarter1 | 0:020db18a476d | 282 | u_p_error.base |= ((uint64_t) (*(inbuffer + offset + 1))) << (8 * 1); |
scarter1 | 0:020db18a476d | 283 | u_p_error.base |= ((uint64_t) (*(inbuffer + offset + 2))) << (8 * 2); |
scarter1 | 0:020db18a476d | 284 | u_p_error.base |= ((uint64_t) (*(inbuffer + offset + 3))) << (8 * 3); |
scarter1 | 0:020db18a476d | 285 | u_p_error.base |= ((uint64_t) (*(inbuffer + offset + 4))) << (8 * 4); |
scarter1 | 0:020db18a476d | 286 | u_p_error.base |= ((uint64_t) (*(inbuffer + offset + 5))) << (8 * 5); |
scarter1 | 0:020db18a476d | 287 | u_p_error.base |= ((uint64_t) (*(inbuffer + offset + 6))) << (8 * 6); |
scarter1 | 0:020db18a476d | 288 | u_p_error.base |= ((uint64_t) (*(inbuffer + offset + 7))) << (8 * 7); |
scarter1 | 0:020db18a476d | 289 | this->p_error = u_p_error.real; |
scarter1 | 0:020db18a476d | 290 | offset += sizeof(this->p_error); |
scarter1 | 0:020db18a476d | 291 | union { |
scarter1 | 0:020db18a476d | 292 | double real; |
scarter1 | 0:020db18a476d | 293 | uint64_t base; |
scarter1 | 0:020db18a476d | 294 | } u_i_error; |
scarter1 | 0:020db18a476d | 295 | u_i_error.base = 0; |
scarter1 | 0:020db18a476d | 296 | u_i_error.base |= ((uint64_t) (*(inbuffer + offset + 0))) << (8 * 0); |
scarter1 | 0:020db18a476d | 297 | u_i_error.base |= ((uint64_t) (*(inbuffer + offset + 1))) << (8 * 1); |
scarter1 | 0:020db18a476d | 298 | u_i_error.base |= ((uint64_t) (*(inbuffer + offset + 2))) << (8 * 2); |
scarter1 | 0:020db18a476d | 299 | u_i_error.base |= ((uint64_t) (*(inbuffer + offset + 3))) << (8 * 3); |
scarter1 | 0:020db18a476d | 300 | u_i_error.base |= ((uint64_t) (*(inbuffer + offset + 4))) << (8 * 4); |
scarter1 | 0:020db18a476d | 301 | u_i_error.base |= ((uint64_t) (*(inbuffer + offset + 5))) << (8 * 5); |
scarter1 | 0:020db18a476d | 302 | u_i_error.base |= ((uint64_t) (*(inbuffer + offset + 6))) << (8 * 6); |
scarter1 | 0:020db18a476d | 303 | u_i_error.base |= ((uint64_t) (*(inbuffer + offset + 7))) << (8 * 7); |
scarter1 | 0:020db18a476d | 304 | this->i_error = u_i_error.real; |
scarter1 | 0:020db18a476d | 305 | offset += sizeof(this->i_error); |
scarter1 | 0:020db18a476d | 306 | union { |
scarter1 | 0:020db18a476d | 307 | double real; |
scarter1 | 0:020db18a476d | 308 | uint64_t base; |
scarter1 | 0:020db18a476d | 309 | } u_d_error; |
scarter1 | 0:020db18a476d | 310 | u_d_error.base = 0; |
scarter1 | 0:020db18a476d | 311 | u_d_error.base |= ((uint64_t) (*(inbuffer + offset + 0))) << (8 * 0); |
scarter1 | 0:020db18a476d | 312 | u_d_error.base |= ((uint64_t) (*(inbuffer + offset + 1))) << (8 * 1); |
scarter1 | 0:020db18a476d | 313 | u_d_error.base |= ((uint64_t) (*(inbuffer + offset + 2))) << (8 * 2); |
scarter1 | 0:020db18a476d | 314 | u_d_error.base |= ((uint64_t) (*(inbuffer + offset + 3))) << (8 * 3); |
scarter1 | 0:020db18a476d | 315 | u_d_error.base |= ((uint64_t) (*(inbuffer + offset + 4))) << (8 * 4); |
scarter1 | 0:020db18a476d | 316 | u_d_error.base |= ((uint64_t) (*(inbuffer + offset + 5))) << (8 * 5); |
scarter1 | 0:020db18a476d | 317 | u_d_error.base |= ((uint64_t) (*(inbuffer + offset + 6))) << (8 * 6); |
scarter1 | 0:020db18a476d | 318 | u_d_error.base |= ((uint64_t) (*(inbuffer + offset + 7))) << (8 * 7); |
scarter1 | 0:020db18a476d | 319 | this->d_error = u_d_error.real; |
scarter1 | 0:020db18a476d | 320 | offset += sizeof(this->d_error); |
scarter1 | 0:020db18a476d | 321 | union { |
scarter1 | 0:020db18a476d | 322 | double real; |
scarter1 | 0:020db18a476d | 323 | uint64_t base; |
scarter1 | 0:020db18a476d | 324 | } u_p_term; |
scarter1 | 0:020db18a476d | 325 | u_p_term.base = 0; |
scarter1 | 0:020db18a476d | 326 | u_p_term.base |= ((uint64_t) (*(inbuffer + offset + 0))) << (8 * 0); |
scarter1 | 0:020db18a476d | 327 | u_p_term.base |= ((uint64_t) (*(inbuffer + offset + 1))) << (8 * 1); |
scarter1 | 0:020db18a476d | 328 | u_p_term.base |= ((uint64_t) (*(inbuffer + offset + 2))) << (8 * 2); |
scarter1 | 0:020db18a476d | 329 | u_p_term.base |= ((uint64_t) (*(inbuffer + offset + 3))) << (8 * 3); |
scarter1 | 0:020db18a476d | 330 | u_p_term.base |= ((uint64_t) (*(inbuffer + offset + 4))) << (8 * 4); |
scarter1 | 0:020db18a476d | 331 | u_p_term.base |= ((uint64_t) (*(inbuffer + offset + 5))) << (8 * 5); |
scarter1 | 0:020db18a476d | 332 | u_p_term.base |= ((uint64_t) (*(inbuffer + offset + 6))) << (8 * 6); |
scarter1 | 0:020db18a476d | 333 | u_p_term.base |= ((uint64_t) (*(inbuffer + offset + 7))) << (8 * 7); |
scarter1 | 0:020db18a476d | 334 | this->p_term = u_p_term.real; |
scarter1 | 0:020db18a476d | 335 | offset += sizeof(this->p_term); |
scarter1 | 0:020db18a476d | 336 | union { |
scarter1 | 0:020db18a476d | 337 | double real; |
scarter1 | 0:020db18a476d | 338 | uint64_t base; |
scarter1 | 0:020db18a476d | 339 | } u_i_term; |
scarter1 | 0:020db18a476d | 340 | u_i_term.base = 0; |
scarter1 | 0:020db18a476d | 341 | u_i_term.base |= ((uint64_t) (*(inbuffer + offset + 0))) << (8 * 0); |
scarter1 | 0:020db18a476d | 342 | u_i_term.base |= ((uint64_t) (*(inbuffer + offset + 1))) << (8 * 1); |
scarter1 | 0:020db18a476d | 343 | u_i_term.base |= ((uint64_t) (*(inbuffer + offset + 2))) << (8 * 2); |
scarter1 | 0:020db18a476d | 344 | u_i_term.base |= ((uint64_t) (*(inbuffer + offset + 3))) << (8 * 3); |
scarter1 | 0:020db18a476d | 345 | u_i_term.base |= ((uint64_t) (*(inbuffer + offset + 4))) << (8 * 4); |
scarter1 | 0:020db18a476d | 346 | u_i_term.base |= ((uint64_t) (*(inbuffer + offset + 5))) << (8 * 5); |
scarter1 | 0:020db18a476d | 347 | u_i_term.base |= ((uint64_t) (*(inbuffer + offset + 6))) << (8 * 6); |
scarter1 | 0:020db18a476d | 348 | u_i_term.base |= ((uint64_t) (*(inbuffer + offset + 7))) << (8 * 7); |
scarter1 | 0:020db18a476d | 349 | this->i_term = u_i_term.real; |
scarter1 | 0:020db18a476d | 350 | offset += sizeof(this->i_term); |
scarter1 | 0:020db18a476d | 351 | union { |
scarter1 | 0:020db18a476d | 352 | double real; |
scarter1 | 0:020db18a476d | 353 | uint64_t base; |
scarter1 | 0:020db18a476d | 354 | } u_d_term; |
scarter1 | 0:020db18a476d | 355 | u_d_term.base = 0; |
scarter1 | 0:020db18a476d | 356 | u_d_term.base |= ((uint64_t) (*(inbuffer + offset + 0))) << (8 * 0); |
scarter1 | 0:020db18a476d | 357 | u_d_term.base |= ((uint64_t) (*(inbuffer + offset + 1))) << (8 * 1); |
scarter1 | 0:020db18a476d | 358 | u_d_term.base |= ((uint64_t) (*(inbuffer + offset + 2))) << (8 * 2); |
scarter1 | 0:020db18a476d | 359 | u_d_term.base |= ((uint64_t) (*(inbuffer + offset + 3))) << (8 * 3); |
scarter1 | 0:020db18a476d | 360 | u_d_term.base |= ((uint64_t) (*(inbuffer + offset + 4))) << (8 * 4); |
scarter1 | 0:020db18a476d | 361 | u_d_term.base |= ((uint64_t) (*(inbuffer + offset + 5))) << (8 * 5); |
scarter1 | 0:020db18a476d | 362 | u_d_term.base |= ((uint64_t) (*(inbuffer + offset + 6))) << (8 * 6); |
scarter1 | 0:020db18a476d | 363 | u_d_term.base |= ((uint64_t) (*(inbuffer + offset + 7))) << (8 * 7); |
scarter1 | 0:020db18a476d | 364 | this->d_term = u_d_term.real; |
scarter1 | 0:020db18a476d | 365 | offset += sizeof(this->d_term); |
scarter1 | 0:020db18a476d | 366 | union { |
scarter1 | 0:020db18a476d | 367 | double real; |
scarter1 | 0:020db18a476d | 368 | uint64_t base; |
scarter1 | 0:020db18a476d | 369 | } u_i_max; |
scarter1 | 0:020db18a476d | 370 | u_i_max.base = 0; |
scarter1 | 0:020db18a476d | 371 | u_i_max.base |= ((uint64_t) (*(inbuffer + offset + 0))) << (8 * 0); |
scarter1 | 0:020db18a476d | 372 | u_i_max.base |= ((uint64_t) (*(inbuffer + offset + 1))) << (8 * 1); |
scarter1 | 0:020db18a476d | 373 | u_i_max.base |= ((uint64_t) (*(inbuffer + offset + 2))) << (8 * 2); |
scarter1 | 0:020db18a476d | 374 | u_i_max.base |= ((uint64_t) (*(inbuffer + offset + 3))) << (8 * 3); |
scarter1 | 0:020db18a476d | 375 | u_i_max.base |= ((uint64_t) (*(inbuffer + offset + 4))) << (8 * 4); |
scarter1 | 0:020db18a476d | 376 | u_i_max.base |= ((uint64_t) (*(inbuffer + offset + 5))) << (8 * 5); |
scarter1 | 0:020db18a476d | 377 | u_i_max.base |= ((uint64_t) (*(inbuffer + offset + 6))) << (8 * 6); |
scarter1 | 0:020db18a476d | 378 | u_i_max.base |= ((uint64_t) (*(inbuffer + offset + 7))) << (8 * 7); |
scarter1 | 0:020db18a476d | 379 | this->i_max = u_i_max.real; |
scarter1 | 0:020db18a476d | 380 | offset += sizeof(this->i_max); |
scarter1 | 0:020db18a476d | 381 | union { |
scarter1 | 0:020db18a476d | 382 | double real; |
scarter1 | 0:020db18a476d | 383 | uint64_t base; |
scarter1 | 0:020db18a476d | 384 | } u_i_min; |
scarter1 | 0:020db18a476d | 385 | u_i_min.base = 0; |
scarter1 | 0:020db18a476d | 386 | u_i_min.base |= ((uint64_t) (*(inbuffer + offset + 0))) << (8 * 0); |
scarter1 | 0:020db18a476d | 387 | u_i_min.base |= ((uint64_t) (*(inbuffer + offset + 1))) << (8 * 1); |
scarter1 | 0:020db18a476d | 388 | u_i_min.base |= ((uint64_t) (*(inbuffer + offset + 2))) << (8 * 2); |
scarter1 | 0:020db18a476d | 389 | u_i_min.base |= ((uint64_t) (*(inbuffer + offset + 3))) << (8 * 3); |
scarter1 | 0:020db18a476d | 390 | u_i_min.base |= ((uint64_t) (*(inbuffer + offset + 4))) << (8 * 4); |
scarter1 | 0:020db18a476d | 391 | u_i_min.base |= ((uint64_t) (*(inbuffer + offset + 5))) << (8 * 5); |
scarter1 | 0:020db18a476d | 392 | u_i_min.base |= ((uint64_t) (*(inbuffer + offset + 6))) << (8 * 6); |
scarter1 | 0:020db18a476d | 393 | u_i_min.base |= ((uint64_t) (*(inbuffer + offset + 7))) << (8 * 7); |
scarter1 | 0:020db18a476d | 394 | this->i_min = u_i_min.real; |
scarter1 | 0:020db18a476d | 395 | offset += sizeof(this->i_min); |
scarter1 | 0:020db18a476d | 396 | union { |
scarter1 | 0:020db18a476d | 397 | double real; |
scarter1 | 0:020db18a476d | 398 | uint64_t base; |
scarter1 | 0:020db18a476d | 399 | } u_output; |
scarter1 | 0:020db18a476d | 400 | u_output.base = 0; |
scarter1 | 0:020db18a476d | 401 | u_output.base |= ((uint64_t) (*(inbuffer + offset + 0))) << (8 * 0); |
scarter1 | 0:020db18a476d | 402 | u_output.base |= ((uint64_t) (*(inbuffer + offset + 1))) << (8 * 1); |
scarter1 | 0:020db18a476d | 403 | u_output.base |= ((uint64_t) (*(inbuffer + offset + 2))) << (8 * 2); |
scarter1 | 0:020db18a476d | 404 | u_output.base |= ((uint64_t) (*(inbuffer + offset + 3))) << (8 * 3); |
scarter1 | 0:020db18a476d | 405 | u_output.base |= ((uint64_t) (*(inbuffer + offset + 4))) << (8 * 4); |
scarter1 | 0:020db18a476d | 406 | u_output.base |= ((uint64_t) (*(inbuffer + offset + 5))) << (8 * 5); |
scarter1 | 0:020db18a476d | 407 | u_output.base |= ((uint64_t) (*(inbuffer + offset + 6))) << (8 * 6); |
scarter1 | 0:020db18a476d | 408 | u_output.base |= ((uint64_t) (*(inbuffer + offset + 7))) << (8 * 7); |
scarter1 | 0:020db18a476d | 409 | this->output = u_output.real; |
scarter1 | 0:020db18a476d | 410 | offset += sizeof(this->output); |
scarter1 | 0:020db18a476d | 411 | return offset; |
scarter1 | 0:020db18a476d | 412 | } |
scarter1 | 0:020db18a476d | 413 | |
scarter1 | 0:020db18a476d | 414 | const char * getType(){ return "control_msgs/PidState"; }; |
scarter1 | 0:020db18a476d | 415 | const char * getMD5(){ return "b138ec00e886c10e73f27e8712252ea6"; }; |
scarter1 | 0:020db18a476d | 416 | |
scarter1 | 0:020db18a476d | 417 | }; |
scarter1 | 0:020db18a476d | 418 | |
scarter1 | 0:020db18a476d | 419 | } |
scarter1 | 0:020db18a476d | 420 | #endif |