ros melodic library with custom message
Dependents: Robot_team1_QEI_Douglas Robot_team1
ros_lib/gazebo_msgs/GetLightProperties.h@0:020db18a476d, 2019-10-30 (annotated)
- Committer:
- scarter1
- Date:
- Wed Oct 30 14:59:49 2019 +0000
- Revision:
- 0:020db18a476d
melodic library;
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
scarter1 | 0:020db18a476d | 1 | #ifndef _ROS_SERVICE_GetLightProperties_h |
scarter1 | 0:020db18a476d | 2 | #define _ROS_SERVICE_GetLightProperties_h |
scarter1 | 0:020db18a476d | 3 | #include <stdint.h> |
scarter1 | 0:020db18a476d | 4 | #include <string.h> |
scarter1 | 0:020db18a476d | 5 | #include <stdlib.h> |
scarter1 | 0:020db18a476d | 6 | #include "ros/msg.h" |
scarter1 | 0:020db18a476d | 7 | #include "std_msgs/ColorRGBA.h" |
scarter1 | 0:020db18a476d | 8 | |
scarter1 | 0:020db18a476d | 9 | namespace gazebo_msgs |
scarter1 | 0:020db18a476d | 10 | { |
scarter1 | 0:020db18a476d | 11 | |
scarter1 | 0:020db18a476d | 12 | static const char GETLIGHTPROPERTIES[] = "gazebo_msgs/GetLightProperties"; |
scarter1 | 0:020db18a476d | 13 | |
scarter1 | 0:020db18a476d | 14 | class GetLightPropertiesRequest : public ros::Msg |
scarter1 | 0:020db18a476d | 15 | { |
scarter1 | 0:020db18a476d | 16 | public: |
scarter1 | 0:020db18a476d | 17 | typedef const char* _light_name_type; |
scarter1 | 0:020db18a476d | 18 | _light_name_type light_name; |
scarter1 | 0:020db18a476d | 19 | |
scarter1 | 0:020db18a476d | 20 | GetLightPropertiesRequest(): |
scarter1 | 0:020db18a476d | 21 | light_name("") |
scarter1 | 0:020db18a476d | 22 | { |
scarter1 | 0:020db18a476d | 23 | } |
scarter1 | 0:020db18a476d | 24 | |
scarter1 | 0:020db18a476d | 25 | virtual int serialize(unsigned char *outbuffer) const |
scarter1 | 0:020db18a476d | 26 | { |
scarter1 | 0:020db18a476d | 27 | int offset = 0; |
scarter1 | 0:020db18a476d | 28 | uint32_t length_light_name = strlen(this->light_name); |
scarter1 | 0:020db18a476d | 29 | varToArr(outbuffer + offset, length_light_name); |
scarter1 | 0:020db18a476d | 30 | offset += 4; |
scarter1 | 0:020db18a476d | 31 | memcpy(outbuffer + offset, this->light_name, length_light_name); |
scarter1 | 0:020db18a476d | 32 | offset += length_light_name; |
scarter1 | 0:020db18a476d | 33 | return offset; |
scarter1 | 0:020db18a476d | 34 | } |
scarter1 | 0:020db18a476d | 35 | |
scarter1 | 0:020db18a476d | 36 | virtual int deserialize(unsigned char *inbuffer) |
scarter1 | 0:020db18a476d | 37 | { |
scarter1 | 0:020db18a476d | 38 | int offset = 0; |
scarter1 | 0:020db18a476d | 39 | uint32_t length_light_name; |
scarter1 | 0:020db18a476d | 40 | arrToVar(length_light_name, (inbuffer + offset)); |
scarter1 | 0:020db18a476d | 41 | offset += 4; |
scarter1 | 0:020db18a476d | 42 | for(unsigned int k= offset; k< offset+length_light_name; ++k){ |
scarter1 | 0:020db18a476d | 43 | inbuffer[k-1]=inbuffer[k]; |
scarter1 | 0:020db18a476d | 44 | } |
scarter1 | 0:020db18a476d | 45 | inbuffer[offset+length_light_name-1]=0; |
scarter1 | 0:020db18a476d | 46 | this->light_name = (char *)(inbuffer + offset-1); |
scarter1 | 0:020db18a476d | 47 | offset += length_light_name; |
scarter1 | 0:020db18a476d | 48 | return offset; |
scarter1 | 0:020db18a476d | 49 | } |
scarter1 | 0:020db18a476d | 50 | |
scarter1 | 0:020db18a476d | 51 | const char * getType(){ return GETLIGHTPROPERTIES; }; |
scarter1 | 0:020db18a476d | 52 | const char * getMD5(){ return "4fb676dfb4741fc866365702a859441c"; }; |
scarter1 | 0:020db18a476d | 53 | |
scarter1 | 0:020db18a476d | 54 | }; |
scarter1 | 0:020db18a476d | 55 | |
scarter1 | 0:020db18a476d | 56 | class GetLightPropertiesResponse : public ros::Msg |
scarter1 | 0:020db18a476d | 57 | { |
scarter1 | 0:020db18a476d | 58 | public: |
scarter1 | 0:020db18a476d | 59 | typedef std_msgs::ColorRGBA _diffuse_type; |
scarter1 | 0:020db18a476d | 60 | _diffuse_type diffuse; |
scarter1 | 0:020db18a476d | 61 | typedef double _attenuation_constant_type; |
scarter1 | 0:020db18a476d | 62 | _attenuation_constant_type attenuation_constant; |
scarter1 | 0:020db18a476d | 63 | typedef double _attenuation_linear_type; |
scarter1 | 0:020db18a476d | 64 | _attenuation_linear_type attenuation_linear; |
scarter1 | 0:020db18a476d | 65 | typedef double _attenuation_quadratic_type; |
scarter1 | 0:020db18a476d | 66 | _attenuation_quadratic_type attenuation_quadratic; |
scarter1 | 0:020db18a476d | 67 | typedef bool _success_type; |
scarter1 | 0:020db18a476d | 68 | _success_type success; |
scarter1 | 0:020db18a476d | 69 | typedef const char* _status_message_type; |
scarter1 | 0:020db18a476d | 70 | _status_message_type status_message; |
scarter1 | 0:020db18a476d | 71 | |
scarter1 | 0:020db18a476d | 72 | GetLightPropertiesResponse(): |
scarter1 | 0:020db18a476d | 73 | diffuse(), |
scarter1 | 0:020db18a476d | 74 | attenuation_constant(0), |
scarter1 | 0:020db18a476d | 75 | attenuation_linear(0), |
scarter1 | 0:020db18a476d | 76 | attenuation_quadratic(0), |
scarter1 | 0:020db18a476d | 77 | success(0), |
scarter1 | 0:020db18a476d | 78 | status_message("") |
scarter1 | 0:020db18a476d | 79 | { |
scarter1 | 0:020db18a476d | 80 | } |
scarter1 | 0:020db18a476d | 81 | |
scarter1 | 0:020db18a476d | 82 | virtual int serialize(unsigned char *outbuffer) const |
scarter1 | 0:020db18a476d | 83 | { |
scarter1 | 0:020db18a476d | 84 | int offset = 0; |
scarter1 | 0:020db18a476d | 85 | offset += this->diffuse.serialize(outbuffer + offset); |
scarter1 | 0:020db18a476d | 86 | union { |
scarter1 | 0:020db18a476d | 87 | double real; |
scarter1 | 0:020db18a476d | 88 | uint64_t base; |
scarter1 | 0:020db18a476d | 89 | } u_attenuation_constant; |
scarter1 | 0:020db18a476d | 90 | u_attenuation_constant.real = this->attenuation_constant; |
scarter1 | 0:020db18a476d | 91 | *(outbuffer + offset + 0) = (u_attenuation_constant.base >> (8 * 0)) & 0xFF; |
scarter1 | 0:020db18a476d | 92 | *(outbuffer + offset + 1) = (u_attenuation_constant.base >> (8 * 1)) & 0xFF; |
scarter1 | 0:020db18a476d | 93 | *(outbuffer + offset + 2) = (u_attenuation_constant.base >> (8 * 2)) & 0xFF; |
scarter1 | 0:020db18a476d | 94 | *(outbuffer + offset + 3) = (u_attenuation_constant.base >> (8 * 3)) & 0xFF; |
scarter1 | 0:020db18a476d | 95 | *(outbuffer + offset + 4) = (u_attenuation_constant.base >> (8 * 4)) & 0xFF; |
scarter1 | 0:020db18a476d | 96 | *(outbuffer + offset + 5) = (u_attenuation_constant.base >> (8 * 5)) & 0xFF; |
scarter1 | 0:020db18a476d | 97 | *(outbuffer + offset + 6) = (u_attenuation_constant.base >> (8 * 6)) & 0xFF; |
scarter1 | 0:020db18a476d | 98 | *(outbuffer + offset + 7) = (u_attenuation_constant.base >> (8 * 7)) & 0xFF; |
scarter1 | 0:020db18a476d | 99 | offset += sizeof(this->attenuation_constant); |
scarter1 | 0:020db18a476d | 100 | union { |
scarter1 | 0:020db18a476d | 101 | double real; |
scarter1 | 0:020db18a476d | 102 | uint64_t base; |
scarter1 | 0:020db18a476d | 103 | } u_attenuation_linear; |
scarter1 | 0:020db18a476d | 104 | u_attenuation_linear.real = this->attenuation_linear; |
scarter1 | 0:020db18a476d | 105 | *(outbuffer + offset + 0) = (u_attenuation_linear.base >> (8 * 0)) & 0xFF; |
scarter1 | 0:020db18a476d | 106 | *(outbuffer + offset + 1) = (u_attenuation_linear.base >> (8 * 1)) & 0xFF; |
scarter1 | 0:020db18a476d | 107 | *(outbuffer + offset + 2) = (u_attenuation_linear.base >> (8 * 2)) & 0xFF; |
scarter1 | 0:020db18a476d | 108 | *(outbuffer + offset + 3) = (u_attenuation_linear.base >> (8 * 3)) & 0xFF; |
scarter1 | 0:020db18a476d | 109 | *(outbuffer + offset + 4) = (u_attenuation_linear.base >> (8 * 4)) & 0xFF; |
scarter1 | 0:020db18a476d | 110 | *(outbuffer + offset + 5) = (u_attenuation_linear.base >> (8 * 5)) & 0xFF; |
scarter1 | 0:020db18a476d | 111 | *(outbuffer + offset + 6) = (u_attenuation_linear.base >> (8 * 6)) & 0xFF; |
scarter1 | 0:020db18a476d | 112 | *(outbuffer + offset + 7) = (u_attenuation_linear.base >> (8 * 7)) & 0xFF; |
scarter1 | 0:020db18a476d | 113 | offset += sizeof(this->attenuation_linear); |
scarter1 | 0:020db18a476d | 114 | union { |
scarter1 | 0:020db18a476d | 115 | double real; |
scarter1 | 0:020db18a476d | 116 | uint64_t base; |
scarter1 | 0:020db18a476d | 117 | } u_attenuation_quadratic; |
scarter1 | 0:020db18a476d | 118 | u_attenuation_quadratic.real = this->attenuation_quadratic; |
scarter1 | 0:020db18a476d | 119 | *(outbuffer + offset + 0) = (u_attenuation_quadratic.base >> (8 * 0)) & 0xFF; |
scarter1 | 0:020db18a476d | 120 | *(outbuffer + offset + 1) = (u_attenuation_quadratic.base >> (8 * 1)) & 0xFF; |
scarter1 | 0:020db18a476d | 121 | *(outbuffer + offset + 2) = (u_attenuation_quadratic.base >> (8 * 2)) & 0xFF; |
scarter1 | 0:020db18a476d | 122 | *(outbuffer + offset + 3) = (u_attenuation_quadratic.base >> (8 * 3)) & 0xFF; |
scarter1 | 0:020db18a476d | 123 | *(outbuffer + offset + 4) = (u_attenuation_quadratic.base >> (8 * 4)) & 0xFF; |
scarter1 | 0:020db18a476d | 124 | *(outbuffer + offset + 5) = (u_attenuation_quadratic.base >> (8 * 5)) & 0xFF; |
scarter1 | 0:020db18a476d | 125 | *(outbuffer + offset + 6) = (u_attenuation_quadratic.base >> (8 * 6)) & 0xFF; |
scarter1 | 0:020db18a476d | 126 | *(outbuffer + offset + 7) = (u_attenuation_quadratic.base >> (8 * 7)) & 0xFF; |
scarter1 | 0:020db18a476d | 127 | offset += sizeof(this->attenuation_quadratic); |
scarter1 | 0:020db18a476d | 128 | union { |
scarter1 | 0:020db18a476d | 129 | bool real; |
scarter1 | 0:020db18a476d | 130 | uint8_t base; |
scarter1 | 0:020db18a476d | 131 | } u_success; |
scarter1 | 0:020db18a476d | 132 | u_success.real = this->success; |
scarter1 | 0:020db18a476d | 133 | *(outbuffer + offset + 0) = (u_success.base >> (8 * 0)) & 0xFF; |
scarter1 | 0:020db18a476d | 134 | offset += sizeof(this->success); |
scarter1 | 0:020db18a476d | 135 | uint32_t length_status_message = strlen(this->status_message); |
scarter1 | 0:020db18a476d | 136 | varToArr(outbuffer + offset, length_status_message); |
scarter1 | 0:020db18a476d | 137 | offset += 4; |
scarter1 | 0:020db18a476d | 138 | memcpy(outbuffer + offset, this->status_message, length_status_message); |
scarter1 | 0:020db18a476d | 139 | offset += length_status_message; |
scarter1 | 0:020db18a476d | 140 | return offset; |
scarter1 | 0:020db18a476d | 141 | } |
scarter1 | 0:020db18a476d | 142 | |
scarter1 | 0:020db18a476d | 143 | virtual int deserialize(unsigned char *inbuffer) |
scarter1 | 0:020db18a476d | 144 | { |
scarter1 | 0:020db18a476d | 145 | int offset = 0; |
scarter1 | 0:020db18a476d | 146 | offset += this->diffuse.deserialize(inbuffer + offset); |
scarter1 | 0:020db18a476d | 147 | union { |
scarter1 | 0:020db18a476d | 148 | double real; |
scarter1 | 0:020db18a476d | 149 | uint64_t base; |
scarter1 | 0:020db18a476d | 150 | } u_attenuation_constant; |
scarter1 | 0:020db18a476d | 151 | u_attenuation_constant.base = 0; |
scarter1 | 0:020db18a476d | 152 | u_attenuation_constant.base |= ((uint64_t) (*(inbuffer + offset + 0))) << (8 * 0); |
scarter1 | 0:020db18a476d | 153 | u_attenuation_constant.base |= ((uint64_t) (*(inbuffer + offset + 1))) << (8 * 1); |
scarter1 | 0:020db18a476d | 154 | u_attenuation_constant.base |= ((uint64_t) (*(inbuffer + offset + 2))) << (8 * 2); |
scarter1 | 0:020db18a476d | 155 | u_attenuation_constant.base |= ((uint64_t) (*(inbuffer + offset + 3))) << (8 * 3); |
scarter1 | 0:020db18a476d | 156 | u_attenuation_constant.base |= ((uint64_t) (*(inbuffer + offset + 4))) << (8 * 4); |
scarter1 | 0:020db18a476d | 157 | u_attenuation_constant.base |= ((uint64_t) (*(inbuffer + offset + 5))) << (8 * 5); |
scarter1 | 0:020db18a476d | 158 | u_attenuation_constant.base |= ((uint64_t) (*(inbuffer + offset + 6))) << (8 * 6); |
scarter1 | 0:020db18a476d | 159 | u_attenuation_constant.base |= ((uint64_t) (*(inbuffer + offset + 7))) << (8 * 7); |
scarter1 | 0:020db18a476d | 160 | this->attenuation_constant = u_attenuation_constant.real; |
scarter1 | 0:020db18a476d | 161 | offset += sizeof(this->attenuation_constant); |
scarter1 | 0:020db18a476d | 162 | union { |
scarter1 | 0:020db18a476d | 163 | double real; |
scarter1 | 0:020db18a476d | 164 | uint64_t base; |
scarter1 | 0:020db18a476d | 165 | } u_attenuation_linear; |
scarter1 | 0:020db18a476d | 166 | u_attenuation_linear.base = 0; |
scarter1 | 0:020db18a476d | 167 | u_attenuation_linear.base |= ((uint64_t) (*(inbuffer + offset + 0))) << (8 * 0); |
scarter1 | 0:020db18a476d | 168 | u_attenuation_linear.base |= ((uint64_t) (*(inbuffer + offset + 1))) << (8 * 1); |
scarter1 | 0:020db18a476d | 169 | u_attenuation_linear.base |= ((uint64_t) (*(inbuffer + offset + 2))) << (8 * 2); |
scarter1 | 0:020db18a476d | 170 | u_attenuation_linear.base |= ((uint64_t) (*(inbuffer + offset + 3))) << (8 * 3); |
scarter1 | 0:020db18a476d | 171 | u_attenuation_linear.base |= ((uint64_t) (*(inbuffer + offset + 4))) << (8 * 4); |
scarter1 | 0:020db18a476d | 172 | u_attenuation_linear.base |= ((uint64_t) (*(inbuffer + offset + 5))) << (8 * 5); |
scarter1 | 0:020db18a476d | 173 | u_attenuation_linear.base |= ((uint64_t) (*(inbuffer + offset + 6))) << (8 * 6); |
scarter1 | 0:020db18a476d | 174 | u_attenuation_linear.base |= ((uint64_t) (*(inbuffer + offset + 7))) << (8 * 7); |
scarter1 | 0:020db18a476d | 175 | this->attenuation_linear = u_attenuation_linear.real; |
scarter1 | 0:020db18a476d | 176 | offset += sizeof(this->attenuation_linear); |
scarter1 | 0:020db18a476d | 177 | union { |
scarter1 | 0:020db18a476d | 178 | double real; |
scarter1 | 0:020db18a476d | 179 | uint64_t base; |
scarter1 | 0:020db18a476d | 180 | } u_attenuation_quadratic; |
scarter1 | 0:020db18a476d | 181 | u_attenuation_quadratic.base = 0; |
scarter1 | 0:020db18a476d | 182 | u_attenuation_quadratic.base |= ((uint64_t) (*(inbuffer + offset + 0))) << (8 * 0); |
scarter1 | 0:020db18a476d | 183 | u_attenuation_quadratic.base |= ((uint64_t) (*(inbuffer + offset + 1))) << (8 * 1); |
scarter1 | 0:020db18a476d | 184 | u_attenuation_quadratic.base |= ((uint64_t) (*(inbuffer + offset + 2))) << (8 * 2); |
scarter1 | 0:020db18a476d | 185 | u_attenuation_quadratic.base |= ((uint64_t) (*(inbuffer + offset + 3))) << (8 * 3); |
scarter1 | 0:020db18a476d | 186 | u_attenuation_quadratic.base |= ((uint64_t) (*(inbuffer + offset + 4))) << (8 * 4); |
scarter1 | 0:020db18a476d | 187 | u_attenuation_quadratic.base |= ((uint64_t) (*(inbuffer + offset + 5))) << (8 * 5); |
scarter1 | 0:020db18a476d | 188 | u_attenuation_quadratic.base |= ((uint64_t) (*(inbuffer + offset + 6))) << (8 * 6); |
scarter1 | 0:020db18a476d | 189 | u_attenuation_quadratic.base |= ((uint64_t) (*(inbuffer + offset + 7))) << (8 * 7); |
scarter1 | 0:020db18a476d | 190 | this->attenuation_quadratic = u_attenuation_quadratic.real; |
scarter1 | 0:020db18a476d | 191 | offset += sizeof(this->attenuation_quadratic); |
scarter1 | 0:020db18a476d | 192 | union { |
scarter1 | 0:020db18a476d | 193 | bool real; |
scarter1 | 0:020db18a476d | 194 | uint8_t base; |
scarter1 | 0:020db18a476d | 195 | } u_success; |
scarter1 | 0:020db18a476d | 196 | u_success.base = 0; |
scarter1 | 0:020db18a476d | 197 | u_success.base |= ((uint8_t) (*(inbuffer + offset + 0))) << (8 * 0); |
scarter1 | 0:020db18a476d | 198 | this->success = u_success.real; |
scarter1 | 0:020db18a476d | 199 | offset += sizeof(this->success); |
scarter1 | 0:020db18a476d | 200 | uint32_t length_status_message; |
scarter1 | 0:020db18a476d | 201 | arrToVar(length_status_message, (inbuffer + offset)); |
scarter1 | 0:020db18a476d | 202 | offset += 4; |
scarter1 | 0:020db18a476d | 203 | for(unsigned int k= offset; k< offset+length_status_message; ++k){ |
scarter1 | 0:020db18a476d | 204 | inbuffer[k-1]=inbuffer[k]; |
scarter1 | 0:020db18a476d | 205 | } |
scarter1 | 0:020db18a476d | 206 | inbuffer[offset+length_status_message-1]=0; |
scarter1 | 0:020db18a476d | 207 | this->status_message = (char *)(inbuffer + offset-1); |
scarter1 | 0:020db18a476d | 208 | offset += length_status_message; |
scarter1 | 0:020db18a476d | 209 | return offset; |
scarter1 | 0:020db18a476d | 210 | } |
scarter1 | 0:020db18a476d | 211 | |
scarter1 | 0:020db18a476d | 212 | const char * getType(){ return GETLIGHTPROPERTIES; }; |
scarter1 | 0:020db18a476d | 213 | const char * getMD5(){ return "9a19ddd5aab4c13b7643d1722c709f1f"; }; |
scarter1 | 0:020db18a476d | 214 | |
scarter1 | 0:020db18a476d | 215 | }; |
scarter1 | 0:020db18a476d | 216 | |
scarter1 | 0:020db18a476d | 217 | class GetLightProperties { |
scarter1 | 0:020db18a476d | 218 | public: |
scarter1 | 0:020db18a476d | 219 | typedef GetLightPropertiesRequest Request; |
scarter1 | 0:020db18a476d | 220 | typedef GetLightPropertiesResponse Response; |
scarter1 | 0:020db18a476d | 221 | }; |
scarter1 | 0:020db18a476d | 222 | |
scarter1 | 0:020db18a476d | 223 | } |
scarter1 | 0:020db18a476d | 224 | #endif |