Go to the documentation of this file.00001 #ifndef _ROS_SERVICE_GetJointProperties_h
00002 #define _ROS_SERVICE_GetJointProperties_h
00003 #include <stdint.h>
00004 #include <string.h>
00005 #include <stdlib.h>
00006 #include "ros/msg.h"
00007
00008 namespace gazebo_msgs
00009 {
00010
00011 static const char GETJOINTPROPERTIES[] = "gazebo_msgs/GetJointProperties";
00012
00013 class GetJointPropertiesRequest : public ros::Msg
00014 {
00015 public:
00016 char * joint_name;
00017
00018 virtual int serialize(unsigned char *outbuffer) const
00019 {
00020 int offset = 0;
00021 uint32_t length_joint_name = strlen( (const char*) this->joint_name);
00022 memcpy(outbuffer + offset, &length_joint_name, sizeof(uint32_t));
00023 offset += 4;
00024 memcpy(outbuffer + offset, this->joint_name, length_joint_name);
00025 offset += length_joint_name;
00026 return offset;
00027 }
00028
00029 virtual int deserialize(unsigned char *inbuffer)
00030 {
00031 int offset = 0;
00032 uint32_t length_joint_name;
00033 memcpy(&length_joint_name, (inbuffer + offset), sizeof(uint32_t));
00034 offset += 4;
00035 for(unsigned int k= offset; k< offset+length_joint_name; ++k){
00036 inbuffer[k-1]=inbuffer[k];
00037 }
00038 inbuffer[offset+length_joint_name-1]=0;
00039 this->joint_name = (char *)(inbuffer + offset-1);
00040 offset += length_joint_name;
00041 return offset;
00042 }
00043
00044 const char * getType(){ return GETJOINTPROPERTIES; };
00045 const char * getMD5(){ return "0be1351618e1dc030eb7959d9a4902de"; };
00046
00047 };
00048
00049 class GetJointPropertiesResponse : public ros::Msg
00050 {
00051 public:
00052 uint8_t type;
00053 uint8_t damping_length;
00054 float st_damping;
00055 float * damping;
00056 uint8_t position_length;
00057 float st_position;
00058 float * position;
00059 uint8_t rate_length;
00060 float st_rate;
00061 float * rate;
00062 bool success;
00063 char * status_message;
00064 enum { REVOLUTE = 0 };
00065 enum { CONTINUOUS = 1 };
00066 enum { PRISMATIC = 2 };
00067 enum { FIXED = 3 };
00068 enum { BALL = 4 };
00069 enum { UNIVERSAL = 5 };
00070
00071 virtual int serialize(unsigned char *outbuffer) const
00072 {
00073 int offset = 0;
00074 *(outbuffer + offset + 0) = (this->type >> (8 * 0)) & 0xFF;
00075 offset += sizeof(this->type);
00076 *(outbuffer + offset++) = damping_length;
00077 *(outbuffer + offset++) = 0;
00078 *(outbuffer + offset++) = 0;
00079 *(outbuffer + offset++) = 0;
00080 for( uint8_t i = 0; i < damping_length; i++){
00081 int32_t * val_dampingi = (int32_t *) &(this->damping[i]);
00082 int32_t exp_dampingi = (((*val_dampingi)>>23)&255);
00083 if(exp_dampingi != 0)
00084 exp_dampingi += 1023-127;
00085 int32_t sig_dampingi = *val_dampingi;
00086 *(outbuffer + offset++) = 0;
00087 *(outbuffer + offset++) = 0;
00088 *(outbuffer + offset++) = 0;
00089 *(outbuffer + offset++) = (sig_dampingi<<5) & 0xff;
00090 *(outbuffer + offset++) = (sig_dampingi>>3) & 0xff;
00091 *(outbuffer + offset++) = (sig_dampingi>>11) & 0xff;
00092 *(outbuffer + offset++) = ((exp_dampingi<<4) & 0xF0) | ((sig_dampingi>>19)&0x0F);
00093 *(outbuffer + offset++) = (exp_dampingi>>4) & 0x7F;
00094 if(this->damping[i] < 0) *(outbuffer + offset -1) |= 0x80;
00095 }
00096 *(outbuffer + offset++) = position_length;
00097 *(outbuffer + offset++) = 0;
00098 *(outbuffer + offset++) = 0;
00099 *(outbuffer + offset++) = 0;
00100 for( uint8_t i = 0; i < position_length; i++){
00101 int32_t * val_positioni = (int32_t *) &(this->position[i]);
00102 int32_t exp_positioni = (((*val_positioni)>>23)&255);
00103 if(exp_positioni != 0)
00104 exp_positioni += 1023-127;
00105 int32_t sig_positioni = *val_positioni;
00106 *(outbuffer + offset++) = 0;
00107 *(outbuffer + offset++) = 0;
00108 *(outbuffer + offset++) = 0;
00109 *(outbuffer + offset++) = (sig_positioni<<5) & 0xff;
00110 *(outbuffer + offset++) = (sig_positioni>>3) & 0xff;
00111 *(outbuffer + offset++) = (sig_positioni>>11) & 0xff;
00112 *(outbuffer + offset++) = ((exp_positioni<<4) & 0xF0) | ((sig_positioni>>19)&0x0F);
00113 *(outbuffer + offset++) = (exp_positioni>>4) & 0x7F;
00114 if(this->position[i] < 0) *(outbuffer + offset -1) |= 0x80;
00115 }
00116 *(outbuffer + offset++) = rate_length;
00117 *(outbuffer + offset++) = 0;
00118 *(outbuffer + offset++) = 0;
00119 *(outbuffer + offset++) = 0;
00120 for( uint8_t i = 0; i < rate_length; i++){
00121 int32_t * val_ratei = (int32_t *) &(this->rate[i]);
00122 int32_t exp_ratei = (((*val_ratei)>>23)&255);
00123 if(exp_ratei != 0)
00124 exp_ratei += 1023-127;
00125 int32_t sig_ratei = *val_ratei;
00126 *(outbuffer + offset++) = 0;
00127 *(outbuffer + offset++) = 0;
00128 *(outbuffer + offset++) = 0;
00129 *(outbuffer + offset++) = (sig_ratei<<5) & 0xff;
00130 *(outbuffer + offset++) = (sig_ratei>>3) & 0xff;
00131 *(outbuffer + offset++) = (sig_ratei>>11) & 0xff;
00132 *(outbuffer + offset++) = ((exp_ratei<<4) & 0xF0) | ((sig_ratei>>19)&0x0F);
00133 *(outbuffer + offset++) = (exp_ratei>>4) & 0x7F;
00134 if(this->rate[i] < 0) *(outbuffer + offset -1) |= 0x80;
00135 }
00136 union {
00137 bool real;
00138 uint8_t base;
00139 } u_success;
00140 u_success.real = this->success;
00141 *(outbuffer + offset + 0) = (u_success.base >> (8 * 0)) & 0xFF;
00142 offset += sizeof(this->success);
00143 uint32_t length_status_message = strlen( (const char*) this->status_message);
00144 memcpy(outbuffer + offset, &length_status_message, sizeof(uint32_t));
00145 offset += 4;
00146 memcpy(outbuffer + offset, this->status_message, length_status_message);
00147 offset += length_status_message;
00148 return offset;
00149 }
00150
00151 virtual int deserialize(unsigned char *inbuffer)
00152 {
00153 int offset = 0;
00154 this->type = ((uint8_t) (*(inbuffer + offset)));
00155 offset += sizeof(this->type);
00156 uint8_t damping_lengthT = *(inbuffer + offset++);
00157 if(damping_lengthT > damping_length)
00158 this->damping = (float*)realloc(this->damping, damping_lengthT * sizeof(float));
00159 offset += 3;
00160 damping_length = damping_lengthT;
00161 for( uint8_t i = 0; i < damping_length; i++){
00162 uint32_t * val_st_damping = (uint32_t*) &(this->st_damping);
00163 offset += 3;
00164 *val_st_damping = ((uint32_t)(*(inbuffer + offset++))>>5 & 0x07);
00165 *val_st_damping |= ((uint32_t)(*(inbuffer + offset++)) & 0xff)<<3;
00166 *val_st_damping |= ((uint32_t)(*(inbuffer + offset++)) & 0xff)<<11;
00167 *val_st_damping |= ((uint32_t)(*(inbuffer + offset)) & 0x0f)<<19;
00168 uint32_t exp_st_damping = ((uint32_t)(*(inbuffer + offset++))&0xf0)>>4;
00169 exp_st_damping |= ((uint32_t)(*(inbuffer + offset)) & 0x7f)<<4;
00170 if(exp_st_damping !=0)
00171 *val_st_damping |= ((exp_st_damping)-1023+127)<<23;
00172 if( ((*(inbuffer+offset++)) & 0x80) > 0) this->st_damping = -this->st_damping;
00173 memcpy( &(this->damping[i]), &(this->st_damping), sizeof(float));
00174 }
00175 uint8_t position_lengthT = *(inbuffer + offset++);
00176 if(position_lengthT > position_length)
00177 this->position = (float*)realloc(this->position, position_lengthT * sizeof(float));
00178 offset += 3;
00179 position_length = position_lengthT;
00180 for( uint8_t i = 0; i < position_length; i++){
00181 uint32_t * val_st_position = (uint32_t*) &(this->st_position);
00182 offset += 3;
00183 *val_st_position = ((uint32_t)(*(inbuffer + offset++))>>5 & 0x07);
00184 *val_st_position |= ((uint32_t)(*(inbuffer + offset++)) & 0xff)<<3;
00185 *val_st_position |= ((uint32_t)(*(inbuffer + offset++)) & 0xff)<<11;
00186 *val_st_position |= ((uint32_t)(*(inbuffer + offset)) & 0x0f)<<19;
00187 uint32_t exp_st_position = ((uint32_t)(*(inbuffer + offset++))&0xf0)>>4;
00188 exp_st_position |= ((uint32_t)(*(inbuffer + offset)) & 0x7f)<<4;
00189 if(exp_st_position !=0)
00190 *val_st_position |= ((exp_st_position)-1023+127)<<23;
00191 if( ((*(inbuffer+offset++)) & 0x80) > 0) this->st_position = -this->st_position;
00192 memcpy( &(this->position[i]), &(this->st_position), sizeof(float));
00193 }
00194 uint8_t rate_lengthT = *(inbuffer + offset++);
00195 if(rate_lengthT > rate_length)
00196 this->rate = (float*)realloc(this->rate, rate_lengthT * sizeof(float));
00197 offset += 3;
00198 rate_length = rate_lengthT;
00199 for( uint8_t i = 0; i < rate_length; i++){
00200 uint32_t * val_st_rate = (uint32_t*) &(this->st_rate);
00201 offset += 3;
00202 *val_st_rate = ((uint32_t)(*(inbuffer + offset++))>>5 & 0x07);
00203 *val_st_rate |= ((uint32_t)(*(inbuffer + offset++)) & 0xff)<<3;
00204 *val_st_rate |= ((uint32_t)(*(inbuffer + offset++)) & 0xff)<<11;
00205 *val_st_rate |= ((uint32_t)(*(inbuffer + offset)) & 0x0f)<<19;
00206 uint32_t exp_st_rate = ((uint32_t)(*(inbuffer + offset++))&0xf0)>>4;
00207 exp_st_rate |= ((uint32_t)(*(inbuffer + offset)) & 0x7f)<<4;
00208 if(exp_st_rate !=0)
00209 *val_st_rate |= ((exp_st_rate)-1023+127)<<23;
00210 if( ((*(inbuffer+offset++)) & 0x80) > 0) this->st_rate = -this->st_rate;
00211 memcpy( &(this->rate[i]), &(this->st_rate), sizeof(float));
00212 }
00213 union {
00214 bool real;
00215 uint8_t base;
00216 } u_success;
00217 u_success.base = 0;
00218 u_success.base |= ((uint8_t) (*(inbuffer + offset + 0))) << (8 * 0);
00219 this->success = u_success.real;
00220 offset += sizeof(this->success);
00221 uint32_t length_status_message;
00222 memcpy(&length_status_message, (inbuffer + offset), sizeof(uint32_t));
00223 offset += 4;
00224 for(unsigned int k= offset; k< offset+length_status_message; ++k){
00225 inbuffer[k-1]=inbuffer[k];
00226 }
00227 inbuffer[offset+length_status_message-1]=0;
00228 this->status_message = (char *)(inbuffer + offset-1);
00229 offset += length_status_message;
00230 return offset;
00231 }
00232
00233 const char * getType(){ return GETJOINTPROPERTIES; };
00234 const char * getMD5(){ return "cd7b30a39faa372283dc94c5f6457f82"; };
00235
00236 };
00237
00238 class GetJointProperties {
00239 public:
00240 typedef GetJointPropertiesRequest Request;
00241 typedef GetJointPropertiesResponse Response;
00242 };
00243
00244 }
00245 #endif