This is a fork from the original, including a small change in the buffer size of the hardware interface (increased to 2048) and decreasing the number of publishers and subscribers to 5. Besides, the library about the message Adc.h was modified so as to increase the number of available Adc channels to be read ( from 6 to 7 ) For this modification, a change in checksum was required

Dependencies:   BufferedSerial

Fork of ros_lib_kinetic by Gary Servin

Committer:
jacobepfl1692
Date:
Tue Oct 17 18:49:03 2017 +0000
Revision:
2:9114cc24ddcf
Parent:
0:9e9b7db60fd5
I increased the channels of the ADC to 6 (hence change in checksum) because my application needed it (STM32f407V6)

Who changed what in which revision?

UserRevisionLine numberNew contents of line
garyservin 0:9e9b7db60fd5 1 #ifndef _ROS_SERVICE_NodeletLoad_h
garyservin 0:9e9b7db60fd5 2 #define _ROS_SERVICE_NodeletLoad_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 nodelet
garyservin 0:9e9b7db60fd5 9 {
garyservin 0:9e9b7db60fd5 10
garyservin 0:9e9b7db60fd5 11 static const char NODELETLOAD[] = "nodelet/NodeletLoad";
garyservin 0:9e9b7db60fd5 12
garyservin 0:9e9b7db60fd5 13 class NodeletLoadRequest : public ros::Msg
garyservin 0:9e9b7db60fd5 14 {
garyservin 0:9e9b7db60fd5 15 public:
garyservin 0:9e9b7db60fd5 16 typedef const char* _name_type;
garyservin 0:9e9b7db60fd5 17 _name_type name;
garyservin 0:9e9b7db60fd5 18 typedef const char* _type_type;
garyservin 0:9e9b7db60fd5 19 _type_type type;
garyservin 0:9e9b7db60fd5 20 uint32_t remap_source_args_length;
garyservin 0:9e9b7db60fd5 21 typedef char* _remap_source_args_type;
garyservin 0:9e9b7db60fd5 22 _remap_source_args_type st_remap_source_args;
garyservin 0:9e9b7db60fd5 23 _remap_source_args_type * remap_source_args;
garyservin 0:9e9b7db60fd5 24 uint32_t remap_target_args_length;
garyservin 0:9e9b7db60fd5 25 typedef char* _remap_target_args_type;
garyservin 0:9e9b7db60fd5 26 _remap_target_args_type st_remap_target_args;
garyservin 0:9e9b7db60fd5 27 _remap_target_args_type * remap_target_args;
garyservin 0:9e9b7db60fd5 28 uint32_t my_argv_length;
garyservin 0:9e9b7db60fd5 29 typedef char* _my_argv_type;
garyservin 0:9e9b7db60fd5 30 _my_argv_type st_my_argv;
garyservin 0:9e9b7db60fd5 31 _my_argv_type * my_argv;
garyservin 0:9e9b7db60fd5 32 typedef const char* _bond_id_type;
garyservin 0:9e9b7db60fd5 33 _bond_id_type bond_id;
garyservin 0:9e9b7db60fd5 34
garyservin 0:9e9b7db60fd5 35 NodeletLoadRequest():
garyservin 0:9e9b7db60fd5 36 name(""),
garyservin 0:9e9b7db60fd5 37 type(""),
garyservin 0:9e9b7db60fd5 38 remap_source_args_length(0), remap_source_args(NULL),
garyservin 0:9e9b7db60fd5 39 remap_target_args_length(0), remap_target_args(NULL),
garyservin 0:9e9b7db60fd5 40 my_argv_length(0), my_argv(NULL),
garyservin 0:9e9b7db60fd5 41 bond_id("")
garyservin 0:9e9b7db60fd5 42 {
garyservin 0:9e9b7db60fd5 43 }
garyservin 0:9e9b7db60fd5 44
garyservin 0:9e9b7db60fd5 45 virtual int serialize(unsigned char *outbuffer) const
garyservin 0:9e9b7db60fd5 46 {
garyservin 0:9e9b7db60fd5 47 int offset = 0;
garyservin 0:9e9b7db60fd5 48 uint32_t length_name = strlen(this->name);
garyservin 0:9e9b7db60fd5 49 varToArr(outbuffer + offset, length_name);
garyservin 0:9e9b7db60fd5 50 offset += 4;
garyservin 0:9e9b7db60fd5 51 memcpy(outbuffer + offset, this->name, length_name);
garyservin 0:9e9b7db60fd5 52 offset += length_name;
garyservin 0:9e9b7db60fd5 53 uint32_t length_type = strlen(this->type);
garyservin 0:9e9b7db60fd5 54 varToArr(outbuffer + offset, length_type);
garyservin 0:9e9b7db60fd5 55 offset += 4;
garyservin 0:9e9b7db60fd5 56 memcpy(outbuffer + offset, this->type, length_type);
garyservin 0:9e9b7db60fd5 57 offset += length_type;
garyservin 0:9e9b7db60fd5 58 *(outbuffer + offset + 0) = (this->remap_source_args_length >> (8 * 0)) & 0xFF;
garyservin 0:9e9b7db60fd5 59 *(outbuffer + offset + 1) = (this->remap_source_args_length >> (8 * 1)) & 0xFF;
garyservin 0:9e9b7db60fd5 60 *(outbuffer + offset + 2) = (this->remap_source_args_length >> (8 * 2)) & 0xFF;
garyservin 0:9e9b7db60fd5 61 *(outbuffer + offset + 3) = (this->remap_source_args_length >> (8 * 3)) & 0xFF;
garyservin 0:9e9b7db60fd5 62 offset += sizeof(this->remap_source_args_length);
garyservin 0:9e9b7db60fd5 63 for( uint32_t i = 0; i < remap_source_args_length; i++){
garyservin 0:9e9b7db60fd5 64 uint32_t length_remap_source_argsi = strlen(this->remap_source_args[i]);
garyservin 0:9e9b7db60fd5 65 varToArr(outbuffer + offset, length_remap_source_argsi);
garyservin 0:9e9b7db60fd5 66 offset += 4;
garyservin 0:9e9b7db60fd5 67 memcpy(outbuffer + offset, this->remap_source_args[i], length_remap_source_argsi);
garyservin 0:9e9b7db60fd5 68 offset += length_remap_source_argsi;
garyservin 0:9e9b7db60fd5 69 }
garyservin 0:9e9b7db60fd5 70 *(outbuffer + offset + 0) = (this->remap_target_args_length >> (8 * 0)) & 0xFF;
garyservin 0:9e9b7db60fd5 71 *(outbuffer + offset + 1) = (this->remap_target_args_length >> (8 * 1)) & 0xFF;
garyservin 0:9e9b7db60fd5 72 *(outbuffer + offset + 2) = (this->remap_target_args_length >> (8 * 2)) & 0xFF;
garyservin 0:9e9b7db60fd5 73 *(outbuffer + offset + 3) = (this->remap_target_args_length >> (8 * 3)) & 0xFF;
garyservin 0:9e9b7db60fd5 74 offset += sizeof(this->remap_target_args_length);
garyservin 0:9e9b7db60fd5 75 for( uint32_t i = 0; i < remap_target_args_length; i++){
garyservin 0:9e9b7db60fd5 76 uint32_t length_remap_target_argsi = strlen(this->remap_target_args[i]);
garyservin 0:9e9b7db60fd5 77 varToArr(outbuffer + offset, length_remap_target_argsi);
garyservin 0:9e9b7db60fd5 78 offset += 4;
garyservin 0:9e9b7db60fd5 79 memcpy(outbuffer + offset, this->remap_target_args[i], length_remap_target_argsi);
garyservin 0:9e9b7db60fd5 80 offset += length_remap_target_argsi;
garyservin 0:9e9b7db60fd5 81 }
garyservin 0:9e9b7db60fd5 82 *(outbuffer + offset + 0) = (this->my_argv_length >> (8 * 0)) & 0xFF;
garyservin 0:9e9b7db60fd5 83 *(outbuffer + offset + 1) = (this->my_argv_length >> (8 * 1)) & 0xFF;
garyservin 0:9e9b7db60fd5 84 *(outbuffer + offset + 2) = (this->my_argv_length >> (8 * 2)) & 0xFF;
garyservin 0:9e9b7db60fd5 85 *(outbuffer + offset + 3) = (this->my_argv_length >> (8 * 3)) & 0xFF;
garyservin 0:9e9b7db60fd5 86 offset += sizeof(this->my_argv_length);
garyservin 0:9e9b7db60fd5 87 for( uint32_t i = 0; i < my_argv_length; i++){
garyservin 0:9e9b7db60fd5 88 uint32_t length_my_argvi = strlen(this->my_argv[i]);
garyservin 0:9e9b7db60fd5 89 varToArr(outbuffer + offset, length_my_argvi);
garyservin 0:9e9b7db60fd5 90 offset += 4;
garyservin 0:9e9b7db60fd5 91 memcpy(outbuffer + offset, this->my_argv[i], length_my_argvi);
garyservin 0:9e9b7db60fd5 92 offset += length_my_argvi;
garyservin 0:9e9b7db60fd5 93 }
garyservin 0:9e9b7db60fd5 94 uint32_t length_bond_id = strlen(this->bond_id);
garyservin 0:9e9b7db60fd5 95 varToArr(outbuffer + offset, length_bond_id);
garyservin 0:9e9b7db60fd5 96 offset += 4;
garyservin 0:9e9b7db60fd5 97 memcpy(outbuffer + offset, this->bond_id, length_bond_id);
garyservin 0:9e9b7db60fd5 98 offset += length_bond_id;
garyservin 0:9e9b7db60fd5 99 return offset;
garyservin 0:9e9b7db60fd5 100 }
garyservin 0:9e9b7db60fd5 101
garyservin 0:9e9b7db60fd5 102 virtual int deserialize(unsigned char *inbuffer)
garyservin 0:9e9b7db60fd5 103 {
garyservin 0:9e9b7db60fd5 104 int offset = 0;
garyservin 0:9e9b7db60fd5 105 uint32_t length_name;
garyservin 0:9e9b7db60fd5 106 arrToVar(length_name, (inbuffer + offset));
garyservin 0:9e9b7db60fd5 107 offset += 4;
garyservin 0:9e9b7db60fd5 108 for(unsigned int k= offset; k< offset+length_name; ++k){
garyservin 0:9e9b7db60fd5 109 inbuffer[k-1]=inbuffer[k];
garyservin 0:9e9b7db60fd5 110 }
garyservin 0:9e9b7db60fd5 111 inbuffer[offset+length_name-1]=0;
garyservin 0:9e9b7db60fd5 112 this->name = (char *)(inbuffer + offset-1);
garyservin 0:9e9b7db60fd5 113 offset += length_name;
garyservin 0:9e9b7db60fd5 114 uint32_t length_type;
garyservin 0:9e9b7db60fd5 115 arrToVar(length_type, (inbuffer + offset));
garyservin 0:9e9b7db60fd5 116 offset += 4;
garyservin 0:9e9b7db60fd5 117 for(unsigned int k= offset; k< offset+length_type; ++k){
garyservin 0:9e9b7db60fd5 118 inbuffer[k-1]=inbuffer[k];
garyservin 0:9e9b7db60fd5 119 }
garyservin 0:9e9b7db60fd5 120 inbuffer[offset+length_type-1]=0;
garyservin 0:9e9b7db60fd5 121 this->type = (char *)(inbuffer + offset-1);
garyservin 0:9e9b7db60fd5 122 offset += length_type;
garyservin 0:9e9b7db60fd5 123 uint32_t remap_source_args_lengthT = ((uint32_t) (*(inbuffer + offset)));
garyservin 0:9e9b7db60fd5 124 remap_source_args_lengthT |= ((uint32_t) (*(inbuffer + offset + 1))) << (8 * 1);
garyservin 0:9e9b7db60fd5 125 remap_source_args_lengthT |= ((uint32_t) (*(inbuffer + offset + 2))) << (8 * 2);
garyservin 0:9e9b7db60fd5 126 remap_source_args_lengthT |= ((uint32_t) (*(inbuffer + offset + 3))) << (8 * 3);
garyservin 0:9e9b7db60fd5 127 offset += sizeof(this->remap_source_args_length);
garyservin 0:9e9b7db60fd5 128 if(remap_source_args_lengthT > remap_source_args_length)
garyservin 0:9e9b7db60fd5 129 this->remap_source_args = (char**)realloc(this->remap_source_args, remap_source_args_lengthT * sizeof(char*));
garyservin 0:9e9b7db60fd5 130 remap_source_args_length = remap_source_args_lengthT;
garyservin 0:9e9b7db60fd5 131 for( uint32_t i = 0; i < remap_source_args_length; i++){
garyservin 0:9e9b7db60fd5 132 uint32_t length_st_remap_source_args;
garyservin 0:9e9b7db60fd5 133 arrToVar(length_st_remap_source_args, (inbuffer + offset));
garyservin 0:9e9b7db60fd5 134 offset += 4;
garyservin 0:9e9b7db60fd5 135 for(unsigned int k= offset; k< offset+length_st_remap_source_args; ++k){
garyservin 0:9e9b7db60fd5 136 inbuffer[k-1]=inbuffer[k];
garyservin 0:9e9b7db60fd5 137 }
garyservin 0:9e9b7db60fd5 138 inbuffer[offset+length_st_remap_source_args-1]=0;
garyservin 0:9e9b7db60fd5 139 this->st_remap_source_args = (char *)(inbuffer + offset-1);
garyservin 0:9e9b7db60fd5 140 offset += length_st_remap_source_args;
garyservin 0:9e9b7db60fd5 141 memcpy( &(this->remap_source_args[i]), &(this->st_remap_source_args), sizeof(char*));
garyservin 0:9e9b7db60fd5 142 }
garyservin 0:9e9b7db60fd5 143 uint32_t remap_target_args_lengthT = ((uint32_t) (*(inbuffer + offset)));
garyservin 0:9e9b7db60fd5 144 remap_target_args_lengthT |= ((uint32_t) (*(inbuffer + offset + 1))) << (8 * 1);
garyservin 0:9e9b7db60fd5 145 remap_target_args_lengthT |= ((uint32_t) (*(inbuffer + offset + 2))) << (8 * 2);
garyservin 0:9e9b7db60fd5 146 remap_target_args_lengthT |= ((uint32_t) (*(inbuffer + offset + 3))) << (8 * 3);
garyservin 0:9e9b7db60fd5 147 offset += sizeof(this->remap_target_args_length);
garyservin 0:9e9b7db60fd5 148 if(remap_target_args_lengthT > remap_target_args_length)
garyservin 0:9e9b7db60fd5 149 this->remap_target_args = (char**)realloc(this->remap_target_args, remap_target_args_lengthT * sizeof(char*));
garyservin 0:9e9b7db60fd5 150 remap_target_args_length = remap_target_args_lengthT;
garyservin 0:9e9b7db60fd5 151 for( uint32_t i = 0; i < remap_target_args_length; i++){
garyservin 0:9e9b7db60fd5 152 uint32_t length_st_remap_target_args;
garyservin 0:9e9b7db60fd5 153 arrToVar(length_st_remap_target_args, (inbuffer + offset));
garyservin 0:9e9b7db60fd5 154 offset += 4;
garyservin 0:9e9b7db60fd5 155 for(unsigned int k= offset; k< offset+length_st_remap_target_args; ++k){
garyservin 0:9e9b7db60fd5 156 inbuffer[k-1]=inbuffer[k];
garyservin 0:9e9b7db60fd5 157 }
garyservin 0:9e9b7db60fd5 158 inbuffer[offset+length_st_remap_target_args-1]=0;
garyservin 0:9e9b7db60fd5 159 this->st_remap_target_args = (char *)(inbuffer + offset-1);
garyservin 0:9e9b7db60fd5 160 offset += length_st_remap_target_args;
garyservin 0:9e9b7db60fd5 161 memcpy( &(this->remap_target_args[i]), &(this->st_remap_target_args), sizeof(char*));
garyservin 0:9e9b7db60fd5 162 }
garyservin 0:9e9b7db60fd5 163 uint32_t my_argv_lengthT = ((uint32_t) (*(inbuffer + offset)));
garyservin 0:9e9b7db60fd5 164 my_argv_lengthT |= ((uint32_t) (*(inbuffer + offset + 1))) << (8 * 1);
garyservin 0:9e9b7db60fd5 165 my_argv_lengthT |= ((uint32_t) (*(inbuffer + offset + 2))) << (8 * 2);
garyservin 0:9e9b7db60fd5 166 my_argv_lengthT |= ((uint32_t) (*(inbuffer + offset + 3))) << (8 * 3);
garyservin 0:9e9b7db60fd5 167 offset += sizeof(this->my_argv_length);
garyservin 0:9e9b7db60fd5 168 if(my_argv_lengthT > my_argv_length)
garyservin 0:9e9b7db60fd5 169 this->my_argv = (char**)realloc(this->my_argv, my_argv_lengthT * sizeof(char*));
garyservin 0:9e9b7db60fd5 170 my_argv_length = my_argv_lengthT;
garyservin 0:9e9b7db60fd5 171 for( uint32_t i = 0; i < my_argv_length; i++){
garyservin 0:9e9b7db60fd5 172 uint32_t length_st_my_argv;
garyservin 0:9e9b7db60fd5 173 arrToVar(length_st_my_argv, (inbuffer + offset));
garyservin 0:9e9b7db60fd5 174 offset += 4;
garyservin 0:9e9b7db60fd5 175 for(unsigned int k= offset; k< offset+length_st_my_argv; ++k){
garyservin 0:9e9b7db60fd5 176 inbuffer[k-1]=inbuffer[k];
garyservin 0:9e9b7db60fd5 177 }
garyservin 0:9e9b7db60fd5 178 inbuffer[offset+length_st_my_argv-1]=0;
garyservin 0:9e9b7db60fd5 179 this->st_my_argv = (char *)(inbuffer + offset-1);
garyservin 0:9e9b7db60fd5 180 offset += length_st_my_argv;
garyservin 0:9e9b7db60fd5 181 memcpy( &(this->my_argv[i]), &(this->st_my_argv), sizeof(char*));
garyservin 0:9e9b7db60fd5 182 }
garyservin 0:9e9b7db60fd5 183 uint32_t length_bond_id;
garyservin 0:9e9b7db60fd5 184 arrToVar(length_bond_id, (inbuffer + offset));
garyservin 0:9e9b7db60fd5 185 offset += 4;
garyservin 0:9e9b7db60fd5 186 for(unsigned int k= offset; k< offset+length_bond_id; ++k){
garyservin 0:9e9b7db60fd5 187 inbuffer[k-1]=inbuffer[k];
garyservin 0:9e9b7db60fd5 188 }
garyservin 0:9e9b7db60fd5 189 inbuffer[offset+length_bond_id-1]=0;
garyservin 0:9e9b7db60fd5 190 this->bond_id = (char *)(inbuffer + offset-1);
garyservin 0:9e9b7db60fd5 191 offset += length_bond_id;
garyservin 0:9e9b7db60fd5 192 return offset;
garyservin 0:9e9b7db60fd5 193 }
garyservin 0:9e9b7db60fd5 194
garyservin 0:9e9b7db60fd5 195 const char * getType(){ return NODELETLOAD; };
garyservin 0:9e9b7db60fd5 196 const char * getMD5(){ return "c6e28cc4d2e259249d96cfb50658fbec"; };
garyservin 0:9e9b7db60fd5 197
garyservin 0:9e9b7db60fd5 198 };
garyservin 0:9e9b7db60fd5 199
garyservin 0:9e9b7db60fd5 200 class NodeletLoadResponse : public ros::Msg
garyservin 0:9e9b7db60fd5 201 {
garyservin 0:9e9b7db60fd5 202 public:
garyservin 0:9e9b7db60fd5 203 typedef bool _success_type;
garyservin 0:9e9b7db60fd5 204 _success_type success;
garyservin 0:9e9b7db60fd5 205
garyservin 0:9e9b7db60fd5 206 NodeletLoadResponse():
garyservin 0:9e9b7db60fd5 207 success(0)
garyservin 0:9e9b7db60fd5 208 {
garyservin 0:9e9b7db60fd5 209 }
garyservin 0:9e9b7db60fd5 210
garyservin 0:9e9b7db60fd5 211 virtual int serialize(unsigned char *outbuffer) const
garyservin 0:9e9b7db60fd5 212 {
garyservin 0:9e9b7db60fd5 213 int offset = 0;
garyservin 0:9e9b7db60fd5 214 union {
garyservin 0:9e9b7db60fd5 215 bool real;
garyservin 0:9e9b7db60fd5 216 uint8_t base;
garyservin 0:9e9b7db60fd5 217 } u_success;
garyservin 0:9e9b7db60fd5 218 u_success.real = this->success;
garyservin 0:9e9b7db60fd5 219 *(outbuffer + offset + 0) = (u_success.base >> (8 * 0)) & 0xFF;
garyservin 0:9e9b7db60fd5 220 offset += sizeof(this->success);
garyservin 0:9e9b7db60fd5 221 return offset;
garyservin 0:9e9b7db60fd5 222 }
garyservin 0:9e9b7db60fd5 223
garyservin 0:9e9b7db60fd5 224 virtual int deserialize(unsigned char *inbuffer)
garyservin 0:9e9b7db60fd5 225 {
garyservin 0:9e9b7db60fd5 226 int offset = 0;
garyservin 0:9e9b7db60fd5 227 union {
garyservin 0:9e9b7db60fd5 228 bool real;
garyservin 0:9e9b7db60fd5 229 uint8_t base;
garyservin 0:9e9b7db60fd5 230 } u_success;
garyservin 0:9e9b7db60fd5 231 u_success.base = 0;
garyservin 0:9e9b7db60fd5 232 u_success.base |= ((uint8_t) (*(inbuffer + offset + 0))) << (8 * 0);
garyservin 0:9e9b7db60fd5 233 this->success = u_success.real;
garyservin 0:9e9b7db60fd5 234 offset += sizeof(this->success);
garyservin 0:9e9b7db60fd5 235 return offset;
garyservin 0:9e9b7db60fd5 236 }
garyservin 0:9e9b7db60fd5 237
garyservin 0:9e9b7db60fd5 238 const char * getType(){ return NODELETLOAD; };
garyservin 0:9e9b7db60fd5 239 const char * getMD5(){ return "358e233cde0c8a8bcfea4ce193f8fc15"; };
garyservin 0:9e9b7db60fd5 240
garyservin 0:9e9b7db60fd5 241 };
garyservin 0:9e9b7db60fd5 242
garyservin 0:9e9b7db60fd5 243 class NodeletLoad {
garyservin 0:9e9b7db60fd5 244 public:
garyservin 0:9e9b7db60fd5 245 typedef NodeletLoadRequest Request;
garyservin 0:9e9b7db60fd5 246 typedef NodeletLoadResponse Response;
garyservin 0:9e9b7db60fd5 247 };
garyservin 0:9e9b7db60fd5 248
garyservin 0:9e9b7db60fd5 249 }
garyservin 0:9e9b7db60fd5 250 #endif