It has only one change from original one. I added robotfeedback message on it.
Dependents: RobotFeedback mobileRobotITU
Fork of ros_lib_indigo by
Diff: shape_msgs/SolidPrimitive.h
- Revision:
- 0:fd24f7ca9688
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/shape_msgs/SolidPrimitive.h Thu Mar 31 14:22:59 2016 +0000 @@ -0,0 +1,103 @@ +#ifndef _ROS_shape_msgs_SolidPrimitive_h +#define _ROS_shape_msgs_SolidPrimitive_h + +#include <stdint.h> +#include <string.h> +#include <stdlib.h> +#include "ros/msg.h" + +namespace shape_msgs +{ + + class SolidPrimitive : public ros::Msg + { + public: + uint8_t type; + uint8_t dimensions_length; + double st_dimensions; + double * dimensions; + enum { BOX = 1 }; + enum { SPHERE = 2 }; + enum { CYLINDER = 3 }; + enum { CONE = 4 }; + enum { BOX_X = 0 }; + enum { BOX_Y = 1 }; + enum { BOX_Z = 2 }; + enum { SPHERE_RADIUS = 0 }; + enum { CYLINDER_HEIGHT = 0 }; + enum { CYLINDER_RADIUS = 1 }; + enum { CONE_HEIGHT = 0 }; + enum { CONE_RADIUS = 1 }; + + SolidPrimitive(): + type(0), + dimensions_length(0), dimensions(NULL) + { + } + + virtual int serialize(unsigned char *outbuffer) const + { + int offset = 0; + *(outbuffer + offset + 0) = (this->type >> (8 * 0)) & 0xFF; + offset += sizeof(this->type); + *(outbuffer + offset++) = dimensions_length; + *(outbuffer + offset++) = 0; + *(outbuffer + offset++) = 0; + *(outbuffer + offset++) = 0; + for( uint8_t i = 0; i < dimensions_length; i++){ + union { + double real; + uint64_t base; + } u_dimensionsi; + u_dimensionsi.real = this->dimensions[i]; + *(outbuffer + offset + 0) = (u_dimensionsi.base >> (8 * 0)) & 0xFF; + *(outbuffer + offset + 1) = (u_dimensionsi.base >> (8 * 1)) & 0xFF; + *(outbuffer + offset + 2) = (u_dimensionsi.base >> (8 * 2)) & 0xFF; + *(outbuffer + offset + 3) = (u_dimensionsi.base >> (8 * 3)) & 0xFF; + *(outbuffer + offset + 4) = (u_dimensionsi.base >> (8 * 4)) & 0xFF; + *(outbuffer + offset + 5) = (u_dimensionsi.base >> (8 * 5)) & 0xFF; + *(outbuffer + offset + 6) = (u_dimensionsi.base >> (8 * 6)) & 0xFF; + *(outbuffer + offset + 7) = (u_dimensionsi.base >> (8 * 7)) & 0xFF; + offset += sizeof(this->dimensions[i]); + } + return offset; + } + + virtual int deserialize(unsigned char *inbuffer) + { + int offset = 0; + this->type = ((uint8_t) (*(inbuffer + offset))); + offset += sizeof(this->type); + uint8_t dimensions_lengthT = *(inbuffer + offset++); + if(dimensions_lengthT > dimensions_length) + this->dimensions = (double*)realloc(this->dimensions, dimensions_lengthT * sizeof(double)); + offset += 3; + dimensions_length = dimensions_lengthT; + for( uint8_t i = 0; i < dimensions_length; i++){ + union { + double real; + uint64_t base; + } u_st_dimensions; + u_st_dimensions.base = 0; + u_st_dimensions.base |= ((uint64_t) (*(inbuffer + offset + 0))) << (8 * 0); + u_st_dimensions.base |= ((uint64_t) (*(inbuffer + offset + 1))) << (8 * 1); + u_st_dimensions.base |= ((uint64_t) (*(inbuffer + offset + 2))) << (8 * 2); + u_st_dimensions.base |= ((uint64_t) (*(inbuffer + offset + 3))) << (8 * 3); + u_st_dimensions.base |= ((uint64_t) (*(inbuffer + offset + 4))) << (8 * 4); + u_st_dimensions.base |= ((uint64_t) (*(inbuffer + offset + 5))) << (8 * 5); + u_st_dimensions.base |= ((uint64_t) (*(inbuffer + offset + 6))) << (8 * 6); + u_st_dimensions.base |= ((uint64_t) (*(inbuffer + offset + 7))) << (8 * 7); + this->st_dimensions = u_st_dimensions.real; + offset += sizeof(this->st_dimensions); + memcpy( &(this->dimensions[i]), &(this->st_dimensions), sizeof(double)); + } + return offset; + } + + const char * getType(){ return "shape_msgs/SolidPrimitive"; }; + const char * getMD5(){ return "d8f8cbc74c5ff283fca29569ccefb45d"; }; + + }; + +} +#endif \ No newline at end of file