It has only one change from original one. I added robotfeedback message on it.
Dependents: RobotFeedback mobileRobotITU
Fork of ros_lib_indigo by
control_msgs/QueryTrajectoryState.h@4:80d9bee5079a, 2017-03-04 (annotated)
- Committer:
- randalthor
- Date:
- Sat Mar 04 14:07:56 2017 +0000
- Revision:
- 4:80d9bee5079a
- Parent:
- 0:fd24f7ca9688
fatih
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
garyservin | 0:fd24f7ca9688 | 1 | #ifndef _ROS_SERVICE_QueryTrajectoryState_h |
garyservin | 0:fd24f7ca9688 | 2 | #define _ROS_SERVICE_QueryTrajectoryState_h |
garyservin | 0:fd24f7ca9688 | 3 | #include <stdint.h> |
garyservin | 0:fd24f7ca9688 | 4 | #include <string.h> |
garyservin | 0:fd24f7ca9688 | 5 | #include <stdlib.h> |
garyservin | 0:fd24f7ca9688 | 6 | #include "ros/msg.h" |
garyservin | 0:fd24f7ca9688 | 7 | #include "ros/time.h" |
garyservin | 0:fd24f7ca9688 | 8 | |
garyservin | 0:fd24f7ca9688 | 9 | namespace control_msgs |
garyservin | 0:fd24f7ca9688 | 10 | { |
garyservin | 0:fd24f7ca9688 | 11 | |
garyservin | 0:fd24f7ca9688 | 12 | static const char QUERYTRAJECTORYSTATE[] = "control_msgs/QueryTrajectoryState"; |
garyservin | 0:fd24f7ca9688 | 13 | |
garyservin | 0:fd24f7ca9688 | 14 | class QueryTrajectoryStateRequest : public ros::Msg |
garyservin | 0:fd24f7ca9688 | 15 | { |
garyservin | 0:fd24f7ca9688 | 16 | public: |
garyservin | 0:fd24f7ca9688 | 17 | ros::Time time; |
garyservin | 0:fd24f7ca9688 | 18 | |
garyservin | 0:fd24f7ca9688 | 19 | QueryTrajectoryStateRequest(): |
garyservin | 0:fd24f7ca9688 | 20 | time() |
garyservin | 0:fd24f7ca9688 | 21 | { |
garyservin | 0:fd24f7ca9688 | 22 | } |
garyservin | 0:fd24f7ca9688 | 23 | |
garyservin | 0:fd24f7ca9688 | 24 | virtual int serialize(unsigned char *outbuffer) const |
garyservin | 0:fd24f7ca9688 | 25 | { |
garyservin | 0:fd24f7ca9688 | 26 | int offset = 0; |
garyservin | 0:fd24f7ca9688 | 27 | *(outbuffer + offset + 0) = (this->time.sec >> (8 * 0)) & 0xFF; |
garyservin | 0:fd24f7ca9688 | 28 | *(outbuffer + offset + 1) = (this->time.sec >> (8 * 1)) & 0xFF; |
garyservin | 0:fd24f7ca9688 | 29 | *(outbuffer + offset + 2) = (this->time.sec >> (8 * 2)) & 0xFF; |
garyservin | 0:fd24f7ca9688 | 30 | *(outbuffer + offset + 3) = (this->time.sec >> (8 * 3)) & 0xFF; |
garyservin | 0:fd24f7ca9688 | 31 | offset += sizeof(this->time.sec); |
garyservin | 0:fd24f7ca9688 | 32 | *(outbuffer + offset + 0) = (this->time.nsec >> (8 * 0)) & 0xFF; |
garyservin | 0:fd24f7ca9688 | 33 | *(outbuffer + offset + 1) = (this->time.nsec >> (8 * 1)) & 0xFF; |
garyservin | 0:fd24f7ca9688 | 34 | *(outbuffer + offset + 2) = (this->time.nsec >> (8 * 2)) & 0xFF; |
garyservin | 0:fd24f7ca9688 | 35 | *(outbuffer + offset + 3) = (this->time.nsec >> (8 * 3)) & 0xFF; |
garyservin | 0:fd24f7ca9688 | 36 | offset += sizeof(this->time.nsec); |
garyservin | 0:fd24f7ca9688 | 37 | return offset; |
garyservin | 0:fd24f7ca9688 | 38 | } |
garyservin | 0:fd24f7ca9688 | 39 | |
garyservin | 0:fd24f7ca9688 | 40 | virtual int deserialize(unsigned char *inbuffer) |
garyservin | 0:fd24f7ca9688 | 41 | { |
garyservin | 0:fd24f7ca9688 | 42 | int offset = 0; |
garyservin | 0:fd24f7ca9688 | 43 | this->time.sec = ((uint32_t) (*(inbuffer + offset))); |
garyservin | 0:fd24f7ca9688 | 44 | this->time.sec |= ((uint32_t) (*(inbuffer + offset + 1))) << (8 * 1); |
garyservin | 0:fd24f7ca9688 | 45 | this->time.sec |= ((uint32_t) (*(inbuffer + offset + 2))) << (8 * 2); |
garyservin | 0:fd24f7ca9688 | 46 | this->time.sec |= ((uint32_t) (*(inbuffer + offset + 3))) << (8 * 3); |
garyservin | 0:fd24f7ca9688 | 47 | offset += sizeof(this->time.sec); |
garyservin | 0:fd24f7ca9688 | 48 | this->time.nsec = ((uint32_t) (*(inbuffer + offset))); |
garyservin | 0:fd24f7ca9688 | 49 | this->time.nsec |= ((uint32_t) (*(inbuffer + offset + 1))) << (8 * 1); |
garyservin | 0:fd24f7ca9688 | 50 | this->time.nsec |= ((uint32_t) (*(inbuffer + offset + 2))) << (8 * 2); |
garyservin | 0:fd24f7ca9688 | 51 | this->time.nsec |= ((uint32_t) (*(inbuffer + offset + 3))) << (8 * 3); |
garyservin | 0:fd24f7ca9688 | 52 | offset += sizeof(this->time.nsec); |
garyservin | 0:fd24f7ca9688 | 53 | return offset; |
garyservin | 0:fd24f7ca9688 | 54 | } |
garyservin | 0:fd24f7ca9688 | 55 | |
garyservin | 0:fd24f7ca9688 | 56 | const char * getType(){ return QUERYTRAJECTORYSTATE; }; |
garyservin | 0:fd24f7ca9688 | 57 | const char * getMD5(){ return "556a4fb76023a469987922359d08a844"; }; |
garyservin | 0:fd24f7ca9688 | 58 | |
garyservin | 0:fd24f7ca9688 | 59 | }; |
garyservin | 0:fd24f7ca9688 | 60 | |
garyservin | 0:fd24f7ca9688 | 61 | class QueryTrajectoryStateResponse : public ros::Msg |
garyservin | 0:fd24f7ca9688 | 62 | { |
garyservin | 0:fd24f7ca9688 | 63 | public: |
garyservin | 0:fd24f7ca9688 | 64 | uint8_t name_length; |
garyservin | 0:fd24f7ca9688 | 65 | char* st_name; |
garyservin | 0:fd24f7ca9688 | 66 | char* * name; |
garyservin | 0:fd24f7ca9688 | 67 | uint8_t position_length; |
garyservin | 0:fd24f7ca9688 | 68 | double st_position; |
garyservin | 0:fd24f7ca9688 | 69 | double * position; |
garyservin | 0:fd24f7ca9688 | 70 | uint8_t velocity_length; |
garyservin | 0:fd24f7ca9688 | 71 | double st_velocity; |
garyservin | 0:fd24f7ca9688 | 72 | double * velocity; |
garyservin | 0:fd24f7ca9688 | 73 | uint8_t acceleration_length; |
garyservin | 0:fd24f7ca9688 | 74 | double st_acceleration; |
garyservin | 0:fd24f7ca9688 | 75 | double * acceleration; |
garyservin | 0:fd24f7ca9688 | 76 | |
garyservin | 0:fd24f7ca9688 | 77 | QueryTrajectoryStateResponse(): |
garyservin | 0:fd24f7ca9688 | 78 | name_length(0), name(NULL), |
garyservin | 0:fd24f7ca9688 | 79 | position_length(0), position(NULL), |
garyservin | 0:fd24f7ca9688 | 80 | velocity_length(0), velocity(NULL), |
garyservin | 0:fd24f7ca9688 | 81 | acceleration_length(0), acceleration(NULL) |
garyservin | 0:fd24f7ca9688 | 82 | { |
garyservin | 0:fd24f7ca9688 | 83 | } |
garyservin | 0:fd24f7ca9688 | 84 | |
garyservin | 0:fd24f7ca9688 | 85 | virtual int serialize(unsigned char *outbuffer) const |
garyservin | 0:fd24f7ca9688 | 86 | { |
garyservin | 0:fd24f7ca9688 | 87 | int offset = 0; |
garyservin | 0:fd24f7ca9688 | 88 | *(outbuffer + offset++) = name_length; |
garyservin | 0:fd24f7ca9688 | 89 | *(outbuffer + offset++) = 0; |
garyservin | 0:fd24f7ca9688 | 90 | *(outbuffer + offset++) = 0; |
garyservin | 0:fd24f7ca9688 | 91 | *(outbuffer + offset++) = 0; |
garyservin | 0:fd24f7ca9688 | 92 | for( uint8_t i = 0; i < name_length; i++){ |
garyservin | 0:fd24f7ca9688 | 93 | uint32_t length_namei = strlen(this->name[i]); |
garyservin | 0:fd24f7ca9688 | 94 | memcpy(outbuffer + offset, &length_namei, sizeof(uint32_t)); |
garyservin | 0:fd24f7ca9688 | 95 | offset += 4; |
garyservin | 0:fd24f7ca9688 | 96 | memcpy(outbuffer + offset, this->name[i], length_namei); |
garyservin | 0:fd24f7ca9688 | 97 | offset += length_namei; |
garyservin | 0:fd24f7ca9688 | 98 | } |
garyservin | 0:fd24f7ca9688 | 99 | *(outbuffer + offset++) = position_length; |
garyservin | 0:fd24f7ca9688 | 100 | *(outbuffer + offset++) = 0; |
garyservin | 0:fd24f7ca9688 | 101 | *(outbuffer + offset++) = 0; |
garyservin | 0:fd24f7ca9688 | 102 | *(outbuffer + offset++) = 0; |
garyservin | 0:fd24f7ca9688 | 103 | for( uint8_t i = 0; i < position_length; i++){ |
garyservin | 0:fd24f7ca9688 | 104 | union { |
garyservin | 0:fd24f7ca9688 | 105 | double real; |
garyservin | 0:fd24f7ca9688 | 106 | uint64_t base; |
garyservin | 0:fd24f7ca9688 | 107 | } u_positioni; |
garyservin | 0:fd24f7ca9688 | 108 | u_positioni.real = this->position[i]; |
garyservin | 0:fd24f7ca9688 | 109 | *(outbuffer + offset + 0) = (u_positioni.base >> (8 * 0)) & 0xFF; |
garyservin | 0:fd24f7ca9688 | 110 | *(outbuffer + offset + 1) = (u_positioni.base >> (8 * 1)) & 0xFF; |
garyservin | 0:fd24f7ca9688 | 111 | *(outbuffer + offset + 2) = (u_positioni.base >> (8 * 2)) & 0xFF; |
garyservin | 0:fd24f7ca9688 | 112 | *(outbuffer + offset + 3) = (u_positioni.base >> (8 * 3)) & 0xFF; |
garyservin | 0:fd24f7ca9688 | 113 | *(outbuffer + offset + 4) = (u_positioni.base >> (8 * 4)) & 0xFF; |
garyservin | 0:fd24f7ca9688 | 114 | *(outbuffer + offset + 5) = (u_positioni.base >> (8 * 5)) & 0xFF; |
garyservin | 0:fd24f7ca9688 | 115 | *(outbuffer + offset + 6) = (u_positioni.base >> (8 * 6)) & 0xFF; |
garyservin | 0:fd24f7ca9688 | 116 | *(outbuffer + offset + 7) = (u_positioni.base >> (8 * 7)) & 0xFF; |
garyservin | 0:fd24f7ca9688 | 117 | offset += sizeof(this->position[i]); |
garyservin | 0:fd24f7ca9688 | 118 | } |
garyservin | 0:fd24f7ca9688 | 119 | *(outbuffer + offset++) = velocity_length; |
garyservin | 0:fd24f7ca9688 | 120 | *(outbuffer + offset++) = 0; |
garyservin | 0:fd24f7ca9688 | 121 | *(outbuffer + offset++) = 0; |
garyservin | 0:fd24f7ca9688 | 122 | *(outbuffer + offset++) = 0; |
garyservin | 0:fd24f7ca9688 | 123 | for( uint8_t i = 0; i < velocity_length; i++){ |
garyservin | 0:fd24f7ca9688 | 124 | union { |
garyservin | 0:fd24f7ca9688 | 125 | double real; |
garyservin | 0:fd24f7ca9688 | 126 | uint64_t base; |
garyservin | 0:fd24f7ca9688 | 127 | } u_velocityi; |
garyservin | 0:fd24f7ca9688 | 128 | u_velocityi.real = this->velocity[i]; |
garyservin | 0:fd24f7ca9688 | 129 | *(outbuffer + offset + 0) = (u_velocityi.base >> (8 * 0)) & 0xFF; |
garyservin | 0:fd24f7ca9688 | 130 | *(outbuffer + offset + 1) = (u_velocityi.base >> (8 * 1)) & 0xFF; |
garyservin | 0:fd24f7ca9688 | 131 | *(outbuffer + offset + 2) = (u_velocityi.base >> (8 * 2)) & 0xFF; |
garyservin | 0:fd24f7ca9688 | 132 | *(outbuffer + offset + 3) = (u_velocityi.base >> (8 * 3)) & 0xFF; |
garyservin | 0:fd24f7ca9688 | 133 | *(outbuffer + offset + 4) = (u_velocityi.base >> (8 * 4)) & 0xFF; |
garyservin | 0:fd24f7ca9688 | 134 | *(outbuffer + offset + 5) = (u_velocityi.base >> (8 * 5)) & 0xFF; |
garyservin | 0:fd24f7ca9688 | 135 | *(outbuffer + offset + 6) = (u_velocityi.base >> (8 * 6)) & 0xFF; |
garyservin | 0:fd24f7ca9688 | 136 | *(outbuffer + offset + 7) = (u_velocityi.base >> (8 * 7)) & 0xFF; |
garyservin | 0:fd24f7ca9688 | 137 | offset += sizeof(this->velocity[i]); |
garyservin | 0:fd24f7ca9688 | 138 | } |
garyservin | 0:fd24f7ca9688 | 139 | *(outbuffer + offset++) = acceleration_length; |
garyservin | 0:fd24f7ca9688 | 140 | *(outbuffer + offset++) = 0; |
garyservin | 0:fd24f7ca9688 | 141 | *(outbuffer + offset++) = 0; |
garyservin | 0:fd24f7ca9688 | 142 | *(outbuffer + offset++) = 0; |
garyservin | 0:fd24f7ca9688 | 143 | for( uint8_t i = 0; i < acceleration_length; i++){ |
garyservin | 0:fd24f7ca9688 | 144 | union { |
garyservin | 0:fd24f7ca9688 | 145 | double real; |
garyservin | 0:fd24f7ca9688 | 146 | uint64_t base; |
garyservin | 0:fd24f7ca9688 | 147 | } u_accelerationi; |
garyservin | 0:fd24f7ca9688 | 148 | u_accelerationi.real = this->acceleration[i]; |
garyservin | 0:fd24f7ca9688 | 149 | *(outbuffer + offset + 0) = (u_accelerationi.base >> (8 * 0)) & 0xFF; |
garyservin | 0:fd24f7ca9688 | 150 | *(outbuffer + offset + 1) = (u_accelerationi.base >> (8 * 1)) & 0xFF; |
garyservin | 0:fd24f7ca9688 | 151 | *(outbuffer + offset + 2) = (u_accelerationi.base >> (8 * 2)) & 0xFF; |
garyservin | 0:fd24f7ca9688 | 152 | *(outbuffer + offset + 3) = (u_accelerationi.base >> (8 * 3)) & 0xFF; |
garyservin | 0:fd24f7ca9688 | 153 | *(outbuffer + offset + 4) = (u_accelerationi.base >> (8 * 4)) & 0xFF; |
garyservin | 0:fd24f7ca9688 | 154 | *(outbuffer + offset + 5) = (u_accelerationi.base >> (8 * 5)) & 0xFF; |
garyservin | 0:fd24f7ca9688 | 155 | *(outbuffer + offset + 6) = (u_accelerationi.base >> (8 * 6)) & 0xFF; |
garyservin | 0:fd24f7ca9688 | 156 | *(outbuffer + offset + 7) = (u_accelerationi.base >> (8 * 7)) & 0xFF; |
garyservin | 0:fd24f7ca9688 | 157 | offset += sizeof(this->acceleration[i]); |
garyservin | 0:fd24f7ca9688 | 158 | } |
garyservin | 0:fd24f7ca9688 | 159 | return offset; |
garyservin | 0:fd24f7ca9688 | 160 | } |
garyservin | 0:fd24f7ca9688 | 161 | |
garyservin | 0:fd24f7ca9688 | 162 | virtual int deserialize(unsigned char *inbuffer) |
garyservin | 0:fd24f7ca9688 | 163 | { |
garyservin | 0:fd24f7ca9688 | 164 | int offset = 0; |
garyservin | 0:fd24f7ca9688 | 165 | uint8_t name_lengthT = *(inbuffer + offset++); |
garyservin | 0:fd24f7ca9688 | 166 | if(name_lengthT > name_length) |
garyservin | 0:fd24f7ca9688 | 167 | this->name = (char**)realloc(this->name, name_lengthT * sizeof(char*)); |
garyservin | 0:fd24f7ca9688 | 168 | offset += 3; |
garyservin | 0:fd24f7ca9688 | 169 | name_length = name_lengthT; |
garyservin | 0:fd24f7ca9688 | 170 | for( uint8_t i = 0; i < name_length; i++){ |
garyservin | 0:fd24f7ca9688 | 171 | uint32_t length_st_name; |
garyservin | 0:fd24f7ca9688 | 172 | memcpy(&length_st_name, (inbuffer + offset), sizeof(uint32_t)); |
garyservin | 0:fd24f7ca9688 | 173 | offset += 4; |
garyservin | 0:fd24f7ca9688 | 174 | for(unsigned int k= offset; k< offset+length_st_name; ++k){ |
garyservin | 0:fd24f7ca9688 | 175 | inbuffer[k-1]=inbuffer[k]; |
garyservin | 0:fd24f7ca9688 | 176 | } |
garyservin | 0:fd24f7ca9688 | 177 | inbuffer[offset+length_st_name-1]=0; |
garyservin | 0:fd24f7ca9688 | 178 | this->st_name = (char *)(inbuffer + offset-1); |
garyservin | 0:fd24f7ca9688 | 179 | offset += length_st_name; |
garyservin | 0:fd24f7ca9688 | 180 | memcpy( &(this->name[i]), &(this->st_name), sizeof(char*)); |
garyservin | 0:fd24f7ca9688 | 181 | } |
garyservin | 0:fd24f7ca9688 | 182 | uint8_t position_lengthT = *(inbuffer + offset++); |
garyservin | 0:fd24f7ca9688 | 183 | if(position_lengthT > position_length) |
garyservin | 0:fd24f7ca9688 | 184 | this->position = (double*)realloc(this->position, position_lengthT * sizeof(double)); |
garyservin | 0:fd24f7ca9688 | 185 | offset += 3; |
garyservin | 0:fd24f7ca9688 | 186 | position_length = position_lengthT; |
garyservin | 0:fd24f7ca9688 | 187 | for( uint8_t i = 0; i < position_length; i++){ |
garyservin | 0:fd24f7ca9688 | 188 | union { |
garyservin | 0:fd24f7ca9688 | 189 | double real; |
garyservin | 0:fd24f7ca9688 | 190 | uint64_t base; |
garyservin | 0:fd24f7ca9688 | 191 | } u_st_position; |
garyservin | 0:fd24f7ca9688 | 192 | u_st_position.base = 0; |
garyservin | 0:fd24f7ca9688 | 193 | u_st_position.base |= ((uint64_t) (*(inbuffer + offset + 0))) << (8 * 0); |
garyservin | 0:fd24f7ca9688 | 194 | u_st_position.base |= ((uint64_t) (*(inbuffer + offset + 1))) << (8 * 1); |
garyservin | 0:fd24f7ca9688 | 195 | u_st_position.base |= ((uint64_t) (*(inbuffer + offset + 2))) << (8 * 2); |
garyservin | 0:fd24f7ca9688 | 196 | u_st_position.base |= ((uint64_t) (*(inbuffer + offset + 3))) << (8 * 3); |
garyservin | 0:fd24f7ca9688 | 197 | u_st_position.base |= ((uint64_t) (*(inbuffer + offset + 4))) << (8 * 4); |
garyservin | 0:fd24f7ca9688 | 198 | u_st_position.base |= ((uint64_t) (*(inbuffer + offset + 5))) << (8 * 5); |
garyservin | 0:fd24f7ca9688 | 199 | u_st_position.base |= ((uint64_t) (*(inbuffer + offset + 6))) << (8 * 6); |
garyservin | 0:fd24f7ca9688 | 200 | u_st_position.base |= ((uint64_t) (*(inbuffer + offset + 7))) << (8 * 7); |
garyservin | 0:fd24f7ca9688 | 201 | this->st_position = u_st_position.real; |
garyservin | 0:fd24f7ca9688 | 202 | offset += sizeof(this->st_position); |
garyservin | 0:fd24f7ca9688 | 203 | memcpy( &(this->position[i]), &(this->st_position), sizeof(double)); |
garyservin | 0:fd24f7ca9688 | 204 | } |
garyservin | 0:fd24f7ca9688 | 205 | uint8_t velocity_lengthT = *(inbuffer + offset++); |
garyservin | 0:fd24f7ca9688 | 206 | if(velocity_lengthT > velocity_length) |
garyservin | 0:fd24f7ca9688 | 207 | this->velocity = (double*)realloc(this->velocity, velocity_lengthT * sizeof(double)); |
garyservin | 0:fd24f7ca9688 | 208 | offset += 3; |
garyservin | 0:fd24f7ca9688 | 209 | velocity_length = velocity_lengthT; |
garyservin | 0:fd24f7ca9688 | 210 | for( uint8_t i = 0; i < velocity_length; i++){ |
garyservin | 0:fd24f7ca9688 | 211 | union { |
garyservin | 0:fd24f7ca9688 | 212 | double real; |
garyservin | 0:fd24f7ca9688 | 213 | uint64_t base; |
garyservin | 0:fd24f7ca9688 | 214 | } u_st_velocity; |
garyservin | 0:fd24f7ca9688 | 215 | u_st_velocity.base = 0; |
garyservin | 0:fd24f7ca9688 | 216 | u_st_velocity.base |= ((uint64_t) (*(inbuffer + offset + 0))) << (8 * 0); |
garyservin | 0:fd24f7ca9688 | 217 | u_st_velocity.base |= ((uint64_t) (*(inbuffer + offset + 1))) << (8 * 1); |
garyservin | 0:fd24f7ca9688 | 218 | u_st_velocity.base |= ((uint64_t) (*(inbuffer + offset + 2))) << (8 * 2); |
garyservin | 0:fd24f7ca9688 | 219 | u_st_velocity.base |= ((uint64_t) (*(inbuffer + offset + 3))) << (8 * 3); |
garyservin | 0:fd24f7ca9688 | 220 | u_st_velocity.base |= ((uint64_t) (*(inbuffer + offset + 4))) << (8 * 4); |
garyservin | 0:fd24f7ca9688 | 221 | u_st_velocity.base |= ((uint64_t) (*(inbuffer + offset + 5))) << (8 * 5); |
garyservin | 0:fd24f7ca9688 | 222 | u_st_velocity.base |= ((uint64_t) (*(inbuffer + offset + 6))) << (8 * 6); |
garyservin | 0:fd24f7ca9688 | 223 | u_st_velocity.base |= ((uint64_t) (*(inbuffer + offset + 7))) << (8 * 7); |
garyservin | 0:fd24f7ca9688 | 224 | this->st_velocity = u_st_velocity.real; |
garyservin | 0:fd24f7ca9688 | 225 | offset += sizeof(this->st_velocity); |
garyservin | 0:fd24f7ca9688 | 226 | memcpy( &(this->velocity[i]), &(this->st_velocity), sizeof(double)); |
garyservin | 0:fd24f7ca9688 | 227 | } |
garyservin | 0:fd24f7ca9688 | 228 | uint8_t acceleration_lengthT = *(inbuffer + offset++); |
garyservin | 0:fd24f7ca9688 | 229 | if(acceleration_lengthT > acceleration_length) |
garyservin | 0:fd24f7ca9688 | 230 | this->acceleration = (double*)realloc(this->acceleration, acceleration_lengthT * sizeof(double)); |
garyservin | 0:fd24f7ca9688 | 231 | offset += 3; |
garyservin | 0:fd24f7ca9688 | 232 | acceleration_length = acceleration_lengthT; |
garyservin | 0:fd24f7ca9688 | 233 | for( uint8_t i = 0; i < acceleration_length; i++){ |
garyservin | 0:fd24f7ca9688 | 234 | union { |
garyservin | 0:fd24f7ca9688 | 235 | double real; |
garyservin | 0:fd24f7ca9688 | 236 | uint64_t base; |
garyservin | 0:fd24f7ca9688 | 237 | } u_st_acceleration; |
garyservin | 0:fd24f7ca9688 | 238 | u_st_acceleration.base = 0; |
garyservin | 0:fd24f7ca9688 | 239 | u_st_acceleration.base |= ((uint64_t) (*(inbuffer + offset + 0))) << (8 * 0); |
garyservin | 0:fd24f7ca9688 | 240 | u_st_acceleration.base |= ((uint64_t) (*(inbuffer + offset + 1))) << (8 * 1); |
garyservin | 0:fd24f7ca9688 | 241 | u_st_acceleration.base |= ((uint64_t) (*(inbuffer + offset + 2))) << (8 * 2); |
garyservin | 0:fd24f7ca9688 | 242 | u_st_acceleration.base |= ((uint64_t) (*(inbuffer + offset + 3))) << (8 * 3); |
garyservin | 0:fd24f7ca9688 | 243 | u_st_acceleration.base |= ((uint64_t) (*(inbuffer + offset + 4))) << (8 * 4); |
garyservin | 0:fd24f7ca9688 | 244 | u_st_acceleration.base |= ((uint64_t) (*(inbuffer + offset + 5))) << (8 * 5); |
garyservin | 0:fd24f7ca9688 | 245 | u_st_acceleration.base |= ((uint64_t) (*(inbuffer + offset + 6))) << (8 * 6); |
garyservin | 0:fd24f7ca9688 | 246 | u_st_acceleration.base |= ((uint64_t) (*(inbuffer + offset + 7))) << (8 * 7); |
garyservin | 0:fd24f7ca9688 | 247 | this->st_acceleration = u_st_acceleration.real; |
garyservin | 0:fd24f7ca9688 | 248 | offset += sizeof(this->st_acceleration); |
garyservin | 0:fd24f7ca9688 | 249 | memcpy( &(this->acceleration[i]), &(this->st_acceleration), sizeof(double)); |
garyservin | 0:fd24f7ca9688 | 250 | } |
garyservin | 0:fd24f7ca9688 | 251 | return offset; |
garyservin | 0:fd24f7ca9688 | 252 | } |
garyservin | 0:fd24f7ca9688 | 253 | |
garyservin | 0:fd24f7ca9688 | 254 | const char * getType(){ return QUERYTRAJECTORYSTATE; }; |
garyservin | 0:fd24f7ca9688 | 255 | const char * getMD5(){ return "1f1a6554ad060f44d013e71868403c1a"; }; |
garyservin | 0:fd24f7ca9688 | 256 | |
garyservin | 0:fd24f7ca9688 | 257 | }; |
garyservin | 0:fd24f7ca9688 | 258 | |
garyservin | 0:fd24f7ca9688 | 259 | class QueryTrajectoryState { |
garyservin | 0:fd24f7ca9688 | 260 | public: |
garyservin | 0:fd24f7ca9688 | 261 | typedef QueryTrajectoryStateRequest Request; |
garyservin | 0:fd24f7ca9688 | 262 | typedef QueryTrajectoryStateResponse Response; |
garyservin | 0:fd24f7ca9688 | 263 | }; |
garyservin | 0:fd24f7ca9688 | 264 | |
garyservin | 0:fd24f7ca9688 | 265 | } |
garyservin | 0:fd24f7ca9688 | 266 | #endif |