Go to the documentation of this file.00001 #ifndef _ROS_SERVICE_SetCostmap_h
00002 #define _ROS_SERVICE_SetCostmap_h
00003 #include <stdint.h>
00004 #include <string.h>
00005 #include <stdlib.h>
00006 #include "ros/msg.h"
00007
00008 namespace navfn
00009 {
00010
00011 static const char SETCOSTMAP[] = "navfn/SetCostmap";
00012
00013 class SetCostmapRequest : public ros::Msg
00014 {
00015 public:
00016 uint8_t costs_length;
00017 uint8_t st_costs;
00018 uint8_t * costs;
00019 uint16_t height;
00020 uint16_t width;
00021
00022 virtual int serialize(unsigned char *outbuffer) const
00023 {
00024 int offset = 0;
00025 *(outbuffer + offset++) = costs_length;
00026 *(outbuffer + offset++) = 0;
00027 *(outbuffer + offset++) = 0;
00028 *(outbuffer + offset++) = 0;
00029 for( uint8_t i = 0; i < costs_length; i++){
00030 *(outbuffer + offset + 0) = (this->costs[i] >> (8 * 0)) & 0xFF;
00031 offset += sizeof(this->costs[i]);
00032 }
00033 *(outbuffer + offset + 0) = (this->height >> (8 * 0)) & 0xFF;
00034 *(outbuffer + offset + 1) = (this->height >> (8 * 1)) & 0xFF;
00035 offset += sizeof(this->height);
00036 *(outbuffer + offset + 0) = (this->width >> (8 * 0)) & 0xFF;
00037 *(outbuffer + offset + 1) = (this->width >> (8 * 1)) & 0xFF;
00038 offset += sizeof(this->width);
00039 return offset;
00040 }
00041
00042 virtual int deserialize(unsigned char *inbuffer)
00043 {
00044 int offset = 0;
00045 uint8_t costs_lengthT = *(inbuffer + offset++);
00046 if(costs_lengthT > costs_length)
00047 this->costs = (uint8_t*)realloc(this->costs, costs_lengthT * sizeof(uint8_t));
00048 offset += 3;
00049 costs_length = costs_lengthT;
00050 for( uint8_t i = 0; i < costs_length; i++){
00051 this->st_costs = ((uint8_t) (*(inbuffer + offset)));
00052 offset += sizeof(this->st_costs);
00053 memcpy( &(this->costs[i]), &(this->st_costs), sizeof(uint8_t));
00054 }
00055 this->height = ((uint16_t) (*(inbuffer + offset)));
00056 this->height |= ((uint16_t) (*(inbuffer + offset + 1))) << (8 * 1);
00057 offset += sizeof(this->height);
00058 this->width = ((uint16_t) (*(inbuffer + offset)));
00059 this->width |= ((uint16_t) (*(inbuffer + offset + 1))) << (8 * 1);
00060 offset += sizeof(this->width);
00061 return offset;
00062 }
00063
00064 const char * getType(){ return SETCOSTMAP; };
00065 const char * getMD5(){ return "370ec969cdb71f9cde7c7cbe0d752308"; };
00066
00067 };
00068
00069 class SetCostmapResponse : public ros::Msg
00070 {
00071 public:
00072
00073 virtual int serialize(unsigned char *outbuffer) const
00074 {
00075 int offset = 0;
00076 return offset;
00077 }
00078
00079 virtual int deserialize(unsigned char *inbuffer)
00080 {
00081 int offset = 0;
00082 return offset;
00083 }
00084
00085 const char * getType(){ return SETCOSTMAP; };
00086 const char * getMD5(){ return "d41d8cd98f00b204e9800998ecf8427e"; };
00087
00088 };
00089
00090 class SetCostmap {
00091 public:
00092 typedef SetCostmapRequest Request;
00093 typedef SetCostmapResponse Response;
00094 };
00095
00096 }
00097 #endif