hairo
Dependencies: mbed BufferedSerial
gazebo_msgs/GetJointProperties.h@4:bcdd99711326, 2018-12-04 (annotated)
- Committer:
- tknara
- Date:
- Tue Dec 04 00:14:32 2018 +0000
- Revision:
- 4:bcdd99711326
- Parent:
- 0:9e9b7db60fd5
test
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
garyservin | 0:9e9b7db60fd5 | 1 | #ifndef _ROS_SERVICE_GetJointProperties_h |
garyservin | 0:9e9b7db60fd5 | 2 | #define _ROS_SERVICE_GetJointProperties_h |
garyservin | 0:9e9b7db60fd5 | 3 | #include <stdint.h> |
garyservin | 0:9e9b7db60fd5 | 4 | #include <string.h> |
garyservin | 0:9e9b7db60fd5 | 5 | #include <stdlib.h> |
garyservin | 0:9e9b7db60fd5 | 6 | #include "ros/msg.h" |
garyservin | 0:9e9b7db60fd5 | 7 | |
garyservin | 0:9e9b7db60fd5 | 8 | namespace gazebo_msgs |
garyservin | 0:9e9b7db60fd5 | 9 | { |
garyservin | 0:9e9b7db60fd5 | 10 | |
garyservin | 0:9e9b7db60fd5 | 11 | static const char GETJOINTPROPERTIES[] = "gazebo_msgs/GetJointProperties"; |
garyservin | 0:9e9b7db60fd5 | 12 | |
garyservin | 0:9e9b7db60fd5 | 13 | class GetJointPropertiesRequest : public ros::Msg |
garyservin | 0:9e9b7db60fd5 | 14 | { |
garyservin | 0:9e9b7db60fd5 | 15 | public: |
garyservin | 0:9e9b7db60fd5 | 16 | typedef const char* _joint_name_type; |
garyservin | 0:9e9b7db60fd5 | 17 | _joint_name_type joint_name; |
garyservin | 0:9e9b7db60fd5 | 18 | |
garyservin | 0:9e9b7db60fd5 | 19 | GetJointPropertiesRequest(): |
garyservin | 0:9e9b7db60fd5 | 20 | joint_name("") |
garyservin | 0:9e9b7db60fd5 | 21 | { |
garyservin | 0:9e9b7db60fd5 | 22 | } |
garyservin | 0:9e9b7db60fd5 | 23 | |
garyservin | 0:9e9b7db60fd5 | 24 | virtual int serialize(unsigned char *outbuffer) const |
garyservin | 0:9e9b7db60fd5 | 25 | { |
garyservin | 0:9e9b7db60fd5 | 26 | int offset = 0; |
garyservin | 0:9e9b7db60fd5 | 27 | uint32_t length_joint_name = strlen(this->joint_name); |
garyservin | 0:9e9b7db60fd5 | 28 | varToArr(outbuffer + offset, length_joint_name); |
garyservin | 0:9e9b7db60fd5 | 29 | offset += 4; |
garyservin | 0:9e9b7db60fd5 | 30 | memcpy(outbuffer + offset, this->joint_name, length_joint_name); |
garyservin | 0:9e9b7db60fd5 | 31 | offset += length_joint_name; |
garyservin | 0:9e9b7db60fd5 | 32 | return offset; |
garyservin | 0:9e9b7db60fd5 | 33 | } |
garyservin | 0:9e9b7db60fd5 | 34 | |
garyservin | 0:9e9b7db60fd5 | 35 | virtual int deserialize(unsigned char *inbuffer) |
garyservin | 0:9e9b7db60fd5 | 36 | { |
garyservin | 0:9e9b7db60fd5 | 37 | int offset = 0; |
garyservin | 0:9e9b7db60fd5 | 38 | uint32_t length_joint_name; |
garyservin | 0:9e9b7db60fd5 | 39 | arrToVar(length_joint_name, (inbuffer + offset)); |
garyservin | 0:9e9b7db60fd5 | 40 | offset += 4; |
garyservin | 0:9e9b7db60fd5 | 41 | for(unsigned int k= offset; k< offset+length_joint_name; ++k){ |
garyservin | 0:9e9b7db60fd5 | 42 | inbuffer[k-1]=inbuffer[k]; |
garyservin | 0:9e9b7db60fd5 | 43 | } |
garyservin | 0:9e9b7db60fd5 | 44 | inbuffer[offset+length_joint_name-1]=0; |
garyservin | 0:9e9b7db60fd5 | 45 | this->joint_name = (char *)(inbuffer + offset-1); |
garyservin | 0:9e9b7db60fd5 | 46 | offset += length_joint_name; |
garyservin | 0:9e9b7db60fd5 | 47 | return offset; |
garyservin | 0:9e9b7db60fd5 | 48 | } |
garyservin | 0:9e9b7db60fd5 | 49 | |
garyservin | 0:9e9b7db60fd5 | 50 | const char * getType(){ return GETJOINTPROPERTIES; }; |
garyservin | 0:9e9b7db60fd5 | 51 | const char * getMD5(){ return "0be1351618e1dc030eb7959d9a4902de"; }; |
garyservin | 0:9e9b7db60fd5 | 52 | |
garyservin | 0:9e9b7db60fd5 | 53 | }; |
garyservin | 0:9e9b7db60fd5 | 54 | |
garyservin | 0:9e9b7db60fd5 | 55 | class GetJointPropertiesResponse : public ros::Msg |
garyservin | 0:9e9b7db60fd5 | 56 | { |
garyservin | 0:9e9b7db60fd5 | 57 | public: |
garyservin | 0:9e9b7db60fd5 | 58 | typedef uint8_t _type_type; |
garyservin | 0:9e9b7db60fd5 | 59 | _type_type type; |
garyservin | 0:9e9b7db60fd5 | 60 | uint32_t damping_length; |
garyservin | 0:9e9b7db60fd5 | 61 | typedef double _damping_type; |
garyservin | 0:9e9b7db60fd5 | 62 | _damping_type st_damping; |
garyservin | 0:9e9b7db60fd5 | 63 | _damping_type * damping; |
garyservin | 0:9e9b7db60fd5 | 64 | uint32_t position_length; |
garyservin | 0:9e9b7db60fd5 | 65 | typedef double _position_type; |
garyservin | 0:9e9b7db60fd5 | 66 | _position_type st_position; |
garyservin | 0:9e9b7db60fd5 | 67 | _position_type * position; |
garyservin | 0:9e9b7db60fd5 | 68 | uint32_t rate_length; |
garyservin | 0:9e9b7db60fd5 | 69 | typedef double _rate_type; |
garyservin | 0:9e9b7db60fd5 | 70 | _rate_type st_rate; |
garyservin | 0:9e9b7db60fd5 | 71 | _rate_type * rate; |
garyservin | 0:9e9b7db60fd5 | 72 | typedef bool _success_type; |
garyservin | 0:9e9b7db60fd5 | 73 | _success_type success; |
garyservin | 0:9e9b7db60fd5 | 74 | typedef const char* _status_message_type; |
garyservin | 0:9e9b7db60fd5 | 75 | _status_message_type status_message; |
garyservin | 0:9e9b7db60fd5 | 76 | enum { REVOLUTE = 0 }; |
garyservin | 0:9e9b7db60fd5 | 77 | enum { CONTINUOUS = 1 }; |
garyservin | 0:9e9b7db60fd5 | 78 | enum { PRISMATIC = 2 }; |
garyservin | 0:9e9b7db60fd5 | 79 | enum { FIXED = 3 }; |
garyservin | 0:9e9b7db60fd5 | 80 | enum { BALL = 4 }; |
garyservin | 0:9e9b7db60fd5 | 81 | enum { UNIVERSAL = 5 }; |
garyservin | 0:9e9b7db60fd5 | 82 | |
garyservin | 0:9e9b7db60fd5 | 83 | GetJointPropertiesResponse(): |
garyservin | 0:9e9b7db60fd5 | 84 | type(0), |
garyservin | 0:9e9b7db60fd5 | 85 | damping_length(0), damping(NULL), |
garyservin | 0:9e9b7db60fd5 | 86 | position_length(0), position(NULL), |
garyservin | 0:9e9b7db60fd5 | 87 | rate_length(0), rate(NULL), |
garyservin | 0:9e9b7db60fd5 | 88 | success(0), |
garyservin | 0:9e9b7db60fd5 | 89 | status_message("") |
garyservin | 0:9e9b7db60fd5 | 90 | { |
garyservin | 0:9e9b7db60fd5 | 91 | } |
garyservin | 0:9e9b7db60fd5 | 92 | |
garyservin | 0:9e9b7db60fd5 | 93 | virtual int serialize(unsigned char *outbuffer) const |
garyservin | 0:9e9b7db60fd5 | 94 | { |
garyservin | 0:9e9b7db60fd5 | 95 | int offset = 0; |
garyservin | 0:9e9b7db60fd5 | 96 | *(outbuffer + offset + 0) = (this->type >> (8 * 0)) & 0xFF; |
garyservin | 0:9e9b7db60fd5 | 97 | offset += sizeof(this->type); |
garyservin | 0:9e9b7db60fd5 | 98 | *(outbuffer + offset + 0) = (this->damping_length >> (8 * 0)) & 0xFF; |
garyservin | 0:9e9b7db60fd5 | 99 | *(outbuffer + offset + 1) = (this->damping_length >> (8 * 1)) & 0xFF; |
garyservin | 0:9e9b7db60fd5 | 100 | *(outbuffer + offset + 2) = (this->damping_length >> (8 * 2)) & 0xFF; |
garyservin | 0:9e9b7db60fd5 | 101 | *(outbuffer + offset + 3) = (this->damping_length >> (8 * 3)) & 0xFF; |
garyservin | 0:9e9b7db60fd5 | 102 | offset += sizeof(this->damping_length); |
garyservin | 0:9e9b7db60fd5 | 103 | for( uint32_t i = 0; i < damping_length; i++){ |
garyservin | 0:9e9b7db60fd5 | 104 | union { |
garyservin | 0:9e9b7db60fd5 | 105 | double real; |
garyservin | 0:9e9b7db60fd5 | 106 | uint64_t base; |
garyservin | 0:9e9b7db60fd5 | 107 | } u_dampingi; |
garyservin | 0:9e9b7db60fd5 | 108 | u_dampingi.real = this->damping[i]; |
garyservin | 0:9e9b7db60fd5 | 109 | *(outbuffer + offset + 0) = (u_dampingi.base >> (8 * 0)) & 0xFF; |
garyservin | 0:9e9b7db60fd5 | 110 | *(outbuffer + offset + 1) = (u_dampingi.base >> (8 * 1)) & 0xFF; |
garyservin | 0:9e9b7db60fd5 | 111 | *(outbuffer + offset + 2) = (u_dampingi.base >> (8 * 2)) & 0xFF; |
garyservin | 0:9e9b7db60fd5 | 112 | *(outbuffer + offset + 3) = (u_dampingi.base >> (8 * 3)) & 0xFF; |
garyservin | 0:9e9b7db60fd5 | 113 | *(outbuffer + offset + 4) = (u_dampingi.base >> (8 * 4)) & 0xFF; |
garyservin | 0:9e9b7db60fd5 | 114 | *(outbuffer + offset + 5) = (u_dampingi.base >> (8 * 5)) & 0xFF; |
garyservin | 0:9e9b7db60fd5 | 115 | *(outbuffer + offset + 6) = (u_dampingi.base >> (8 * 6)) & 0xFF; |
garyservin | 0:9e9b7db60fd5 | 116 | *(outbuffer + offset + 7) = (u_dampingi.base >> (8 * 7)) & 0xFF; |
garyservin | 0:9e9b7db60fd5 | 117 | offset += sizeof(this->damping[i]); |
garyservin | 0:9e9b7db60fd5 | 118 | } |
garyservin | 0:9e9b7db60fd5 | 119 | *(outbuffer + offset + 0) = (this->position_length >> (8 * 0)) & 0xFF; |
garyservin | 0:9e9b7db60fd5 | 120 | *(outbuffer + offset + 1) = (this->position_length >> (8 * 1)) & 0xFF; |
garyservin | 0:9e9b7db60fd5 | 121 | *(outbuffer + offset + 2) = (this->position_length >> (8 * 2)) & 0xFF; |
garyservin | 0:9e9b7db60fd5 | 122 | *(outbuffer + offset + 3) = (this->position_length >> (8 * 3)) & 0xFF; |
garyservin | 0:9e9b7db60fd5 | 123 | offset += sizeof(this->position_length); |
garyservin | 0:9e9b7db60fd5 | 124 | for( uint32_t i = 0; i < position_length; i++){ |
garyservin | 0:9e9b7db60fd5 | 125 | union { |
garyservin | 0:9e9b7db60fd5 | 126 | double real; |
garyservin | 0:9e9b7db60fd5 | 127 | uint64_t base; |
garyservin | 0:9e9b7db60fd5 | 128 | } u_positioni; |
garyservin | 0:9e9b7db60fd5 | 129 | u_positioni.real = this->position[i]; |
garyservin | 0:9e9b7db60fd5 | 130 | *(outbuffer + offset + 0) = (u_positioni.base >> (8 * 0)) & 0xFF; |
garyservin | 0:9e9b7db60fd5 | 131 | *(outbuffer + offset + 1) = (u_positioni.base >> (8 * 1)) & 0xFF; |
garyservin | 0:9e9b7db60fd5 | 132 | *(outbuffer + offset + 2) = (u_positioni.base >> (8 * 2)) & 0xFF; |
garyservin | 0:9e9b7db60fd5 | 133 | *(outbuffer + offset + 3) = (u_positioni.base >> (8 * 3)) & 0xFF; |
garyservin | 0:9e9b7db60fd5 | 134 | *(outbuffer + offset + 4) = (u_positioni.base >> (8 * 4)) & 0xFF; |
garyservin | 0:9e9b7db60fd5 | 135 | *(outbuffer + offset + 5) = (u_positioni.base >> (8 * 5)) & 0xFF; |
garyservin | 0:9e9b7db60fd5 | 136 | *(outbuffer + offset + 6) = (u_positioni.base >> (8 * 6)) & 0xFF; |
garyservin | 0:9e9b7db60fd5 | 137 | *(outbuffer + offset + 7) = (u_positioni.base >> (8 * 7)) & 0xFF; |
garyservin | 0:9e9b7db60fd5 | 138 | offset += sizeof(this->position[i]); |
garyservin | 0:9e9b7db60fd5 | 139 | } |
garyservin | 0:9e9b7db60fd5 | 140 | *(outbuffer + offset + 0) = (this->rate_length >> (8 * 0)) & 0xFF; |
garyservin | 0:9e9b7db60fd5 | 141 | *(outbuffer + offset + 1) = (this->rate_length >> (8 * 1)) & 0xFF; |
garyservin | 0:9e9b7db60fd5 | 142 | *(outbuffer + offset + 2) = (this->rate_length >> (8 * 2)) & 0xFF; |
garyservin | 0:9e9b7db60fd5 | 143 | *(outbuffer + offset + 3) = (this->rate_length >> (8 * 3)) & 0xFF; |
garyservin | 0:9e9b7db60fd5 | 144 | offset += sizeof(this->rate_length); |
garyservin | 0:9e9b7db60fd5 | 145 | for( uint32_t i = 0; i < rate_length; i++){ |
garyservin | 0:9e9b7db60fd5 | 146 | union { |
garyservin | 0:9e9b7db60fd5 | 147 | double real; |
garyservin | 0:9e9b7db60fd5 | 148 | uint64_t base; |
garyservin | 0:9e9b7db60fd5 | 149 | } u_ratei; |
garyservin | 0:9e9b7db60fd5 | 150 | u_ratei.real = this->rate[i]; |
garyservin | 0:9e9b7db60fd5 | 151 | *(outbuffer + offset + 0) = (u_ratei.base >> (8 * 0)) & 0xFF; |
garyservin | 0:9e9b7db60fd5 | 152 | *(outbuffer + offset + 1) = (u_ratei.base >> (8 * 1)) & 0xFF; |
garyservin | 0:9e9b7db60fd5 | 153 | *(outbuffer + offset + 2) = (u_ratei.base >> (8 * 2)) & 0xFF; |
garyservin | 0:9e9b7db60fd5 | 154 | *(outbuffer + offset + 3) = (u_ratei.base >> (8 * 3)) & 0xFF; |
garyservin | 0:9e9b7db60fd5 | 155 | *(outbuffer + offset + 4) = (u_ratei.base >> (8 * 4)) & 0xFF; |
garyservin | 0:9e9b7db60fd5 | 156 | *(outbuffer + offset + 5) = (u_ratei.base >> (8 * 5)) & 0xFF; |
garyservin | 0:9e9b7db60fd5 | 157 | *(outbuffer + offset + 6) = (u_ratei.base >> (8 * 6)) & 0xFF; |
garyservin | 0:9e9b7db60fd5 | 158 | *(outbuffer + offset + 7) = (u_ratei.base >> (8 * 7)) & 0xFF; |
garyservin | 0:9e9b7db60fd5 | 159 | offset += sizeof(this->rate[i]); |
garyservin | 0:9e9b7db60fd5 | 160 | } |
garyservin | 0:9e9b7db60fd5 | 161 | union { |
garyservin | 0:9e9b7db60fd5 | 162 | bool real; |
garyservin | 0:9e9b7db60fd5 | 163 | uint8_t base; |
garyservin | 0:9e9b7db60fd5 | 164 | } u_success; |
garyservin | 0:9e9b7db60fd5 | 165 | u_success.real = this->success; |
garyservin | 0:9e9b7db60fd5 | 166 | *(outbuffer + offset + 0) = (u_success.base >> (8 * 0)) & 0xFF; |
garyservin | 0:9e9b7db60fd5 | 167 | offset += sizeof(this->success); |
garyservin | 0:9e9b7db60fd5 | 168 | uint32_t length_status_message = strlen(this->status_message); |
garyservin | 0:9e9b7db60fd5 | 169 | varToArr(outbuffer + offset, length_status_message); |
garyservin | 0:9e9b7db60fd5 | 170 | offset += 4; |
garyservin | 0:9e9b7db60fd5 | 171 | memcpy(outbuffer + offset, this->status_message, length_status_message); |
garyservin | 0:9e9b7db60fd5 | 172 | offset += length_status_message; |
garyservin | 0:9e9b7db60fd5 | 173 | return offset; |
garyservin | 0:9e9b7db60fd5 | 174 | } |
garyservin | 0:9e9b7db60fd5 | 175 | |
garyservin | 0:9e9b7db60fd5 | 176 | virtual int deserialize(unsigned char *inbuffer) |
garyservin | 0:9e9b7db60fd5 | 177 | { |
garyservin | 0:9e9b7db60fd5 | 178 | int offset = 0; |
garyservin | 0:9e9b7db60fd5 | 179 | this->type = ((uint8_t) (*(inbuffer + offset))); |
garyservin | 0:9e9b7db60fd5 | 180 | offset += sizeof(this->type); |
garyservin | 0:9e9b7db60fd5 | 181 | uint32_t damping_lengthT = ((uint32_t) (*(inbuffer + offset))); |
garyservin | 0:9e9b7db60fd5 | 182 | damping_lengthT |= ((uint32_t) (*(inbuffer + offset + 1))) << (8 * 1); |
garyservin | 0:9e9b7db60fd5 | 183 | damping_lengthT |= ((uint32_t) (*(inbuffer + offset + 2))) << (8 * 2); |
garyservin | 0:9e9b7db60fd5 | 184 | damping_lengthT |= ((uint32_t) (*(inbuffer + offset + 3))) << (8 * 3); |
garyservin | 0:9e9b7db60fd5 | 185 | offset += sizeof(this->damping_length); |
garyservin | 0:9e9b7db60fd5 | 186 | if(damping_lengthT > damping_length) |
garyservin | 0:9e9b7db60fd5 | 187 | this->damping = (double*)realloc(this->damping, damping_lengthT * sizeof(double)); |
garyservin | 0:9e9b7db60fd5 | 188 | damping_length = damping_lengthT; |
garyservin | 0:9e9b7db60fd5 | 189 | for( uint32_t i = 0; i < damping_length; i++){ |
garyservin | 0:9e9b7db60fd5 | 190 | union { |
garyservin | 0:9e9b7db60fd5 | 191 | double real; |
garyservin | 0:9e9b7db60fd5 | 192 | uint64_t base; |
garyservin | 0:9e9b7db60fd5 | 193 | } u_st_damping; |
garyservin | 0:9e9b7db60fd5 | 194 | u_st_damping.base = 0; |
garyservin | 0:9e9b7db60fd5 | 195 | u_st_damping.base |= ((uint64_t) (*(inbuffer + offset + 0))) << (8 * 0); |
garyservin | 0:9e9b7db60fd5 | 196 | u_st_damping.base |= ((uint64_t) (*(inbuffer + offset + 1))) << (8 * 1); |
garyservin | 0:9e9b7db60fd5 | 197 | u_st_damping.base |= ((uint64_t) (*(inbuffer + offset + 2))) << (8 * 2); |
garyservin | 0:9e9b7db60fd5 | 198 | u_st_damping.base |= ((uint64_t) (*(inbuffer + offset + 3))) << (8 * 3); |
garyservin | 0:9e9b7db60fd5 | 199 | u_st_damping.base |= ((uint64_t) (*(inbuffer + offset + 4))) << (8 * 4); |
garyservin | 0:9e9b7db60fd5 | 200 | u_st_damping.base |= ((uint64_t) (*(inbuffer + offset + 5))) << (8 * 5); |
garyservin | 0:9e9b7db60fd5 | 201 | u_st_damping.base |= ((uint64_t) (*(inbuffer + offset + 6))) << (8 * 6); |
garyservin | 0:9e9b7db60fd5 | 202 | u_st_damping.base |= ((uint64_t) (*(inbuffer + offset + 7))) << (8 * 7); |
garyservin | 0:9e9b7db60fd5 | 203 | this->st_damping = u_st_damping.real; |
garyservin | 0:9e9b7db60fd5 | 204 | offset += sizeof(this->st_damping); |
garyservin | 0:9e9b7db60fd5 | 205 | memcpy( &(this->damping[i]), &(this->st_damping), sizeof(double)); |
garyservin | 0:9e9b7db60fd5 | 206 | } |
garyservin | 0:9e9b7db60fd5 | 207 | uint32_t position_lengthT = ((uint32_t) (*(inbuffer + offset))); |
garyservin | 0:9e9b7db60fd5 | 208 | position_lengthT |= ((uint32_t) (*(inbuffer + offset + 1))) << (8 * 1); |
garyservin | 0:9e9b7db60fd5 | 209 | position_lengthT |= ((uint32_t) (*(inbuffer + offset + 2))) << (8 * 2); |
garyservin | 0:9e9b7db60fd5 | 210 | position_lengthT |= ((uint32_t) (*(inbuffer + offset + 3))) << (8 * 3); |
garyservin | 0:9e9b7db60fd5 | 211 | offset += sizeof(this->position_length); |
garyservin | 0:9e9b7db60fd5 | 212 | if(position_lengthT > position_length) |
garyservin | 0:9e9b7db60fd5 | 213 | this->position = (double*)realloc(this->position, position_lengthT * sizeof(double)); |
garyservin | 0:9e9b7db60fd5 | 214 | position_length = position_lengthT; |
garyservin | 0:9e9b7db60fd5 | 215 | for( uint32_t i = 0; i < position_length; i++){ |
garyservin | 0:9e9b7db60fd5 | 216 | union { |
garyservin | 0:9e9b7db60fd5 | 217 | double real; |
garyservin | 0:9e9b7db60fd5 | 218 | uint64_t base; |
garyservin | 0:9e9b7db60fd5 | 219 | } u_st_position; |
garyservin | 0:9e9b7db60fd5 | 220 | u_st_position.base = 0; |
garyservin | 0:9e9b7db60fd5 | 221 | u_st_position.base |= ((uint64_t) (*(inbuffer + offset + 0))) << (8 * 0); |
garyservin | 0:9e9b7db60fd5 | 222 | u_st_position.base |= ((uint64_t) (*(inbuffer + offset + 1))) << (8 * 1); |
garyservin | 0:9e9b7db60fd5 | 223 | u_st_position.base |= ((uint64_t) (*(inbuffer + offset + 2))) << (8 * 2); |
garyservin | 0:9e9b7db60fd5 | 224 | u_st_position.base |= ((uint64_t) (*(inbuffer + offset + 3))) << (8 * 3); |
garyservin | 0:9e9b7db60fd5 | 225 | u_st_position.base |= ((uint64_t) (*(inbuffer + offset + 4))) << (8 * 4); |
garyservin | 0:9e9b7db60fd5 | 226 | u_st_position.base |= ((uint64_t) (*(inbuffer + offset + 5))) << (8 * 5); |
garyservin | 0:9e9b7db60fd5 | 227 | u_st_position.base |= ((uint64_t) (*(inbuffer + offset + 6))) << (8 * 6); |
garyservin | 0:9e9b7db60fd5 | 228 | u_st_position.base |= ((uint64_t) (*(inbuffer + offset + 7))) << (8 * 7); |
garyservin | 0:9e9b7db60fd5 | 229 | this->st_position = u_st_position.real; |
garyservin | 0:9e9b7db60fd5 | 230 | offset += sizeof(this->st_position); |
garyservin | 0:9e9b7db60fd5 | 231 | memcpy( &(this->position[i]), &(this->st_position), sizeof(double)); |
garyservin | 0:9e9b7db60fd5 | 232 | } |
garyservin | 0:9e9b7db60fd5 | 233 | uint32_t rate_lengthT = ((uint32_t) (*(inbuffer + offset))); |
garyservin | 0:9e9b7db60fd5 | 234 | rate_lengthT |= ((uint32_t) (*(inbuffer + offset + 1))) << (8 * 1); |
garyservin | 0:9e9b7db60fd5 | 235 | rate_lengthT |= ((uint32_t) (*(inbuffer + offset + 2))) << (8 * 2); |
garyservin | 0:9e9b7db60fd5 | 236 | rate_lengthT |= ((uint32_t) (*(inbuffer + offset + 3))) << (8 * 3); |
garyservin | 0:9e9b7db60fd5 | 237 | offset += sizeof(this->rate_length); |
garyservin | 0:9e9b7db60fd5 | 238 | if(rate_lengthT > rate_length) |
garyservin | 0:9e9b7db60fd5 | 239 | this->rate = (double*)realloc(this->rate, rate_lengthT * sizeof(double)); |
garyservin | 0:9e9b7db60fd5 | 240 | rate_length = rate_lengthT; |
garyservin | 0:9e9b7db60fd5 | 241 | for( uint32_t i = 0; i < rate_length; i++){ |
garyservin | 0:9e9b7db60fd5 | 242 | union { |
garyservin | 0:9e9b7db60fd5 | 243 | double real; |
garyservin | 0:9e9b7db60fd5 | 244 | uint64_t base; |
garyservin | 0:9e9b7db60fd5 | 245 | } u_st_rate; |
garyservin | 0:9e9b7db60fd5 | 246 | u_st_rate.base = 0; |
garyservin | 0:9e9b7db60fd5 | 247 | u_st_rate.base |= ((uint64_t) (*(inbuffer + offset + 0))) << (8 * 0); |
garyservin | 0:9e9b7db60fd5 | 248 | u_st_rate.base |= ((uint64_t) (*(inbuffer + offset + 1))) << (8 * 1); |
garyservin | 0:9e9b7db60fd5 | 249 | u_st_rate.base |= ((uint64_t) (*(inbuffer + offset + 2))) << (8 * 2); |
garyservin | 0:9e9b7db60fd5 | 250 | u_st_rate.base |= ((uint64_t) (*(inbuffer + offset + 3))) << (8 * 3); |
garyservin | 0:9e9b7db60fd5 | 251 | u_st_rate.base |= ((uint64_t) (*(inbuffer + offset + 4))) << (8 * 4); |
garyservin | 0:9e9b7db60fd5 | 252 | u_st_rate.base |= ((uint64_t) (*(inbuffer + offset + 5))) << (8 * 5); |
garyservin | 0:9e9b7db60fd5 | 253 | u_st_rate.base |= ((uint64_t) (*(inbuffer + offset + 6))) << (8 * 6); |
garyservin | 0:9e9b7db60fd5 | 254 | u_st_rate.base |= ((uint64_t) (*(inbuffer + offset + 7))) << (8 * 7); |
garyservin | 0:9e9b7db60fd5 | 255 | this->st_rate = u_st_rate.real; |
garyservin | 0:9e9b7db60fd5 | 256 | offset += sizeof(this->st_rate); |
garyservin | 0:9e9b7db60fd5 | 257 | memcpy( &(this->rate[i]), &(this->st_rate), sizeof(double)); |
garyservin | 0:9e9b7db60fd5 | 258 | } |
garyservin | 0:9e9b7db60fd5 | 259 | union { |
garyservin | 0:9e9b7db60fd5 | 260 | bool real; |
garyservin | 0:9e9b7db60fd5 | 261 | uint8_t base; |
garyservin | 0:9e9b7db60fd5 | 262 | } u_success; |
garyservin | 0:9e9b7db60fd5 | 263 | u_success.base = 0; |
garyservin | 0:9e9b7db60fd5 | 264 | u_success.base |= ((uint8_t) (*(inbuffer + offset + 0))) << (8 * 0); |
garyservin | 0:9e9b7db60fd5 | 265 | this->success = u_success.real; |
garyservin | 0:9e9b7db60fd5 | 266 | offset += sizeof(this->success); |
garyservin | 0:9e9b7db60fd5 | 267 | uint32_t length_status_message; |
garyservin | 0:9e9b7db60fd5 | 268 | arrToVar(length_status_message, (inbuffer + offset)); |
garyservin | 0:9e9b7db60fd5 | 269 | offset += 4; |
garyservin | 0:9e9b7db60fd5 | 270 | for(unsigned int k= offset; k< offset+length_status_message; ++k){ |
garyservin | 0:9e9b7db60fd5 | 271 | inbuffer[k-1]=inbuffer[k]; |
garyservin | 0:9e9b7db60fd5 | 272 | } |
garyservin | 0:9e9b7db60fd5 | 273 | inbuffer[offset+length_status_message-1]=0; |
garyservin | 0:9e9b7db60fd5 | 274 | this->status_message = (char *)(inbuffer + offset-1); |
garyservin | 0:9e9b7db60fd5 | 275 | offset += length_status_message; |
garyservin | 0:9e9b7db60fd5 | 276 | return offset; |
garyservin | 0:9e9b7db60fd5 | 277 | } |
garyservin | 0:9e9b7db60fd5 | 278 | |
garyservin | 0:9e9b7db60fd5 | 279 | const char * getType(){ return GETJOINTPROPERTIES; }; |
garyservin | 0:9e9b7db60fd5 | 280 | const char * getMD5(){ return "cd7b30a39faa372283dc94c5f6457f82"; }; |
garyservin | 0:9e9b7db60fd5 | 281 | |
garyservin | 0:9e9b7db60fd5 | 282 | }; |
garyservin | 0:9e9b7db60fd5 | 283 | |
garyservin | 0:9e9b7db60fd5 | 284 | class GetJointProperties { |
garyservin | 0:9e9b7db60fd5 | 285 | public: |
garyservin | 0:9e9b7db60fd5 | 286 | typedef GetJointPropertiesRequest Request; |
garyservin | 0:9e9b7db60fd5 | 287 | typedef GetJointPropertiesResponse Response; |
garyservin | 0:9e9b7db60fd5 | 288 | }; |
garyservin | 0:9e9b7db60fd5 | 289 | |
garyservin | 0:9e9b7db60fd5 | 290 | } |
garyservin | 0:9e9b7db60fd5 | 291 | #endif |