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_smach_msgs_SmachContainerStatus_h
garyservin 0:9e9b7db60fd5 2 #define _ROS_smach_msgs_SmachContainerStatus_h
garyservin 0:9e9b7db60fd5 3
garyservin 0:9e9b7db60fd5 4 #include <stdint.h>
garyservin 0:9e9b7db60fd5 5 #include <string.h>
garyservin 0:9e9b7db60fd5 6 #include <stdlib.h>
garyservin 0:9e9b7db60fd5 7 #include "ros/msg.h"
garyservin 0:9e9b7db60fd5 8 #include "std_msgs/Header.h"
garyservin 0:9e9b7db60fd5 9
garyservin 0:9e9b7db60fd5 10 namespace smach_msgs
garyservin 0:9e9b7db60fd5 11 {
garyservin 0:9e9b7db60fd5 12
garyservin 0:9e9b7db60fd5 13 class SmachContainerStatus : public ros::Msg
garyservin 0:9e9b7db60fd5 14 {
garyservin 0:9e9b7db60fd5 15 public:
garyservin 0:9e9b7db60fd5 16 typedef std_msgs::Header _header_type;
garyservin 0:9e9b7db60fd5 17 _header_type header;
garyservin 0:9e9b7db60fd5 18 typedef const char* _path_type;
garyservin 0:9e9b7db60fd5 19 _path_type path;
garyservin 0:9e9b7db60fd5 20 uint32_t initial_states_length;
garyservin 0:9e9b7db60fd5 21 typedef char* _initial_states_type;
garyservin 0:9e9b7db60fd5 22 _initial_states_type st_initial_states;
garyservin 0:9e9b7db60fd5 23 _initial_states_type * initial_states;
garyservin 0:9e9b7db60fd5 24 uint32_t active_states_length;
garyservin 0:9e9b7db60fd5 25 typedef char* _active_states_type;
garyservin 0:9e9b7db60fd5 26 _active_states_type st_active_states;
garyservin 0:9e9b7db60fd5 27 _active_states_type * active_states;
garyservin 0:9e9b7db60fd5 28 typedef const char* _local_data_type;
garyservin 0:9e9b7db60fd5 29 _local_data_type local_data;
garyservin 0:9e9b7db60fd5 30 typedef const char* _info_type;
garyservin 0:9e9b7db60fd5 31 _info_type info;
garyservin 0:9e9b7db60fd5 32
garyservin 0:9e9b7db60fd5 33 SmachContainerStatus():
garyservin 0:9e9b7db60fd5 34 header(),
garyservin 0:9e9b7db60fd5 35 path(""),
garyservin 0:9e9b7db60fd5 36 initial_states_length(0), initial_states(NULL),
garyservin 0:9e9b7db60fd5 37 active_states_length(0), active_states(NULL),
garyservin 0:9e9b7db60fd5 38 local_data(""),
garyservin 0:9e9b7db60fd5 39 info("")
garyservin 0:9e9b7db60fd5 40 {
garyservin 0:9e9b7db60fd5 41 }
garyservin 0:9e9b7db60fd5 42
garyservin 0:9e9b7db60fd5 43 virtual int serialize(unsigned char *outbuffer) const
garyservin 0:9e9b7db60fd5 44 {
garyservin 0:9e9b7db60fd5 45 int offset = 0;
garyservin 0:9e9b7db60fd5 46 offset += this->header.serialize(outbuffer + offset);
garyservin 0:9e9b7db60fd5 47 uint32_t length_path = strlen(this->path);
garyservin 0:9e9b7db60fd5 48 varToArr(outbuffer + offset, length_path);
garyservin 0:9e9b7db60fd5 49 offset += 4;
garyservin 0:9e9b7db60fd5 50 memcpy(outbuffer + offset, this->path, length_path);
garyservin 0:9e9b7db60fd5 51 offset += length_path;
garyservin 0:9e9b7db60fd5 52 *(outbuffer + offset + 0) = (this->initial_states_length >> (8 * 0)) & 0xFF;
garyservin 0:9e9b7db60fd5 53 *(outbuffer + offset + 1) = (this->initial_states_length >> (8 * 1)) & 0xFF;
garyservin 0:9e9b7db60fd5 54 *(outbuffer + offset + 2) = (this->initial_states_length >> (8 * 2)) & 0xFF;
garyservin 0:9e9b7db60fd5 55 *(outbuffer + offset + 3) = (this->initial_states_length >> (8 * 3)) & 0xFF;
garyservin 0:9e9b7db60fd5 56 offset += sizeof(this->initial_states_length);
garyservin 0:9e9b7db60fd5 57 for( uint32_t i = 0; i < initial_states_length; i++){
garyservin 0:9e9b7db60fd5 58 uint32_t length_initial_statesi = strlen(this->initial_states[i]);
garyservin 0:9e9b7db60fd5 59 varToArr(outbuffer + offset, length_initial_statesi);
garyservin 0:9e9b7db60fd5 60 offset += 4;
garyservin 0:9e9b7db60fd5 61 memcpy(outbuffer + offset, this->initial_states[i], length_initial_statesi);
garyservin 0:9e9b7db60fd5 62 offset += length_initial_statesi;
garyservin 0:9e9b7db60fd5 63 }
garyservin 0:9e9b7db60fd5 64 *(outbuffer + offset + 0) = (this->active_states_length >> (8 * 0)) & 0xFF;
garyservin 0:9e9b7db60fd5 65 *(outbuffer + offset + 1) = (this->active_states_length >> (8 * 1)) & 0xFF;
garyservin 0:9e9b7db60fd5 66 *(outbuffer + offset + 2) = (this->active_states_length >> (8 * 2)) & 0xFF;
garyservin 0:9e9b7db60fd5 67 *(outbuffer + offset + 3) = (this->active_states_length >> (8 * 3)) & 0xFF;
garyservin 0:9e9b7db60fd5 68 offset += sizeof(this->active_states_length);
garyservin 0:9e9b7db60fd5 69 for( uint32_t i = 0; i < active_states_length; i++){
garyservin 0:9e9b7db60fd5 70 uint32_t length_active_statesi = strlen(this->active_states[i]);
garyservin 0:9e9b7db60fd5 71 varToArr(outbuffer + offset, length_active_statesi);
garyservin 0:9e9b7db60fd5 72 offset += 4;
garyservin 0:9e9b7db60fd5 73 memcpy(outbuffer + offset, this->active_states[i], length_active_statesi);
garyservin 0:9e9b7db60fd5 74 offset += length_active_statesi;
garyservin 0:9e9b7db60fd5 75 }
garyservin 0:9e9b7db60fd5 76 uint32_t length_local_data = strlen(this->local_data);
garyservin 0:9e9b7db60fd5 77 varToArr(outbuffer + offset, length_local_data);
garyservin 0:9e9b7db60fd5 78 offset += 4;
garyservin 0:9e9b7db60fd5 79 memcpy(outbuffer + offset, this->local_data, length_local_data);
garyservin 0:9e9b7db60fd5 80 offset += length_local_data;
garyservin 0:9e9b7db60fd5 81 uint32_t length_info = strlen(this->info);
garyservin 0:9e9b7db60fd5 82 varToArr(outbuffer + offset, length_info);
garyservin 0:9e9b7db60fd5 83 offset += 4;
garyservin 0:9e9b7db60fd5 84 memcpy(outbuffer + offset, this->info, length_info);
garyservin 0:9e9b7db60fd5 85 offset += length_info;
garyservin 0:9e9b7db60fd5 86 return offset;
garyservin 0:9e9b7db60fd5 87 }
garyservin 0:9e9b7db60fd5 88
garyservin 0:9e9b7db60fd5 89 virtual int deserialize(unsigned char *inbuffer)
garyservin 0:9e9b7db60fd5 90 {
garyservin 0:9e9b7db60fd5 91 int offset = 0;
garyservin 0:9e9b7db60fd5 92 offset += this->header.deserialize(inbuffer + offset);
garyservin 0:9e9b7db60fd5 93 uint32_t length_path;
garyservin 0:9e9b7db60fd5 94 arrToVar(length_path, (inbuffer + offset));
garyservin 0:9e9b7db60fd5 95 offset += 4;
garyservin 0:9e9b7db60fd5 96 for(unsigned int k= offset; k< offset+length_path; ++k){
garyservin 0:9e9b7db60fd5 97 inbuffer[k-1]=inbuffer[k];
garyservin 0:9e9b7db60fd5 98 }
garyservin 0:9e9b7db60fd5 99 inbuffer[offset+length_path-1]=0;
garyservin 0:9e9b7db60fd5 100 this->path = (char *)(inbuffer + offset-1);
garyservin 0:9e9b7db60fd5 101 offset += length_path;
garyservin 0:9e9b7db60fd5 102 uint32_t initial_states_lengthT = ((uint32_t) (*(inbuffer + offset)));
garyservin 0:9e9b7db60fd5 103 initial_states_lengthT |= ((uint32_t) (*(inbuffer + offset + 1))) << (8 * 1);
garyservin 0:9e9b7db60fd5 104 initial_states_lengthT |= ((uint32_t) (*(inbuffer + offset + 2))) << (8 * 2);
garyservin 0:9e9b7db60fd5 105 initial_states_lengthT |= ((uint32_t) (*(inbuffer + offset + 3))) << (8 * 3);
garyservin 0:9e9b7db60fd5 106 offset += sizeof(this->initial_states_length);
garyservin 0:9e9b7db60fd5 107 if(initial_states_lengthT > initial_states_length)
garyservin 0:9e9b7db60fd5 108 this->initial_states = (char**)realloc(this->initial_states, initial_states_lengthT * sizeof(char*));
garyservin 0:9e9b7db60fd5 109 initial_states_length = initial_states_lengthT;
garyservin 0:9e9b7db60fd5 110 for( uint32_t i = 0; i < initial_states_length; i++){
garyservin 0:9e9b7db60fd5 111 uint32_t length_st_initial_states;
garyservin 0:9e9b7db60fd5 112 arrToVar(length_st_initial_states, (inbuffer + offset));
garyservin 0:9e9b7db60fd5 113 offset += 4;
garyservin 0:9e9b7db60fd5 114 for(unsigned int k= offset; k< offset+length_st_initial_states; ++k){
garyservin 0:9e9b7db60fd5 115 inbuffer[k-1]=inbuffer[k];
garyservin 0:9e9b7db60fd5 116 }
garyservin 0:9e9b7db60fd5 117 inbuffer[offset+length_st_initial_states-1]=0;
garyservin 0:9e9b7db60fd5 118 this->st_initial_states = (char *)(inbuffer + offset-1);
garyservin 0:9e9b7db60fd5 119 offset += length_st_initial_states;
garyservin 0:9e9b7db60fd5 120 memcpy( &(this->initial_states[i]), &(this->st_initial_states), sizeof(char*));
garyservin 0:9e9b7db60fd5 121 }
garyservin 0:9e9b7db60fd5 122 uint32_t active_states_lengthT = ((uint32_t) (*(inbuffer + offset)));
garyservin 0:9e9b7db60fd5 123 active_states_lengthT |= ((uint32_t) (*(inbuffer + offset + 1))) << (8 * 1);
garyservin 0:9e9b7db60fd5 124 active_states_lengthT |= ((uint32_t) (*(inbuffer + offset + 2))) << (8 * 2);
garyservin 0:9e9b7db60fd5 125 active_states_lengthT |= ((uint32_t) (*(inbuffer + offset + 3))) << (8 * 3);
garyservin 0:9e9b7db60fd5 126 offset += sizeof(this->active_states_length);
garyservin 0:9e9b7db60fd5 127 if(active_states_lengthT > active_states_length)
garyservin 0:9e9b7db60fd5 128 this->active_states = (char**)realloc(this->active_states, active_states_lengthT * sizeof(char*));
garyservin 0:9e9b7db60fd5 129 active_states_length = active_states_lengthT;
garyservin 0:9e9b7db60fd5 130 for( uint32_t i = 0; i < active_states_length; i++){
garyservin 0:9e9b7db60fd5 131 uint32_t length_st_active_states;
garyservin 0:9e9b7db60fd5 132 arrToVar(length_st_active_states, (inbuffer + offset));
garyservin 0:9e9b7db60fd5 133 offset += 4;
garyservin 0:9e9b7db60fd5 134 for(unsigned int k= offset; k< offset+length_st_active_states; ++k){
garyservin 0:9e9b7db60fd5 135 inbuffer[k-1]=inbuffer[k];
garyservin 0:9e9b7db60fd5 136 }
garyservin 0:9e9b7db60fd5 137 inbuffer[offset+length_st_active_states-1]=0;
garyservin 0:9e9b7db60fd5 138 this->st_active_states = (char *)(inbuffer + offset-1);
garyservin 0:9e9b7db60fd5 139 offset += length_st_active_states;
garyservin 0:9e9b7db60fd5 140 memcpy( &(this->active_states[i]), &(this->st_active_states), sizeof(char*));
garyservin 0:9e9b7db60fd5 141 }
garyservin 0:9e9b7db60fd5 142 uint32_t length_local_data;
garyservin 0:9e9b7db60fd5 143 arrToVar(length_local_data, (inbuffer + offset));
garyservin 0:9e9b7db60fd5 144 offset += 4;
garyservin 0:9e9b7db60fd5 145 for(unsigned int k= offset; k< offset+length_local_data; ++k){
garyservin 0:9e9b7db60fd5 146 inbuffer[k-1]=inbuffer[k];
garyservin 0:9e9b7db60fd5 147 }
garyservin 0:9e9b7db60fd5 148 inbuffer[offset+length_local_data-1]=0;
garyservin 0:9e9b7db60fd5 149 this->local_data = (char *)(inbuffer + offset-1);
garyservin 0:9e9b7db60fd5 150 offset += length_local_data;
garyservin 0:9e9b7db60fd5 151 uint32_t length_info;
garyservin 0:9e9b7db60fd5 152 arrToVar(length_info, (inbuffer + offset));
garyservin 0:9e9b7db60fd5 153 offset += 4;
garyservin 0:9e9b7db60fd5 154 for(unsigned int k= offset; k< offset+length_info; ++k){
garyservin 0:9e9b7db60fd5 155 inbuffer[k-1]=inbuffer[k];
garyservin 0:9e9b7db60fd5 156 }
garyservin 0:9e9b7db60fd5 157 inbuffer[offset+length_info-1]=0;
garyservin 0:9e9b7db60fd5 158 this->info = (char *)(inbuffer + offset-1);
garyservin 0:9e9b7db60fd5 159 offset += length_info;
garyservin 0:9e9b7db60fd5 160 return offset;
garyservin 0:9e9b7db60fd5 161 }
garyservin 0:9e9b7db60fd5 162
garyservin 0:9e9b7db60fd5 163 const char * getType(){ return "smach_msgs/SmachContainerStatus"; };
garyservin 0:9e9b7db60fd5 164 const char * getMD5(){ return "5ba2bb79ac19e3842d562a191f2a675b"; };
garyservin 0:9e9b7db60fd5 165
garyservin 0:9e9b7db60fd5 166 };
garyservin 0:9e9b7db60fd5 167
garyservin 0:9e9b7db60fd5 168 }
garyservin 0:9e9b7db60fd5 169 #endif