Important changes to repositories hosted on mbed.com
Mbed hosted mercurial repositories are deprecated and are due to be permanently deleted in July 2026.
To keep a copy of this software download the repository Zip archive or clone locally using Mercurial.
It is also possible to export all your personal repositories from the account settings page.
FibonacciFeedback.h
00001 #ifndef _ROS_actionlib_tutorials_FibonacciFeedback_h 00002 #define _ROS_actionlib_tutorials_FibonacciFeedback_h 00003 00004 #include <stdint.h> 00005 #include <string.h> 00006 #include <stdlib.h> 00007 #include "ros/msg.h" 00008 00009 namespace actionlib_tutorials 00010 { 00011 00012 class FibonacciFeedback : public ros::Msg 00013 { 00014 public: 00015 uint32_t sequence_length; 00016 typedef int32_t _sequence_type; 00017 _sequence_type st_sequence; 00018 _sequence_type * sequence; 00019 00020 FibonacciFeedback(): 00021 sequence_length(0), sequence(NULL) 00022 { 00023 } 00024 00025 virtual int serialize(unsigned char *outbuffer) const 00026 { 00027 int offset = 0; 00028 *(outbuffer + offset + 0) = (this->sequence_length >> (8 * 0)) & 0xFF; 00029 *(outbuffer + offset + 1) = (this->sequence_length >> (8 * 1)) & 0xFF; 00030 *(outbuffer + offset + 2) = (this->sequence_length >> (8 * 2)) & 0xFF; 00031 *(outbuffer + offset + 3) = (this->sequence_length >> (8 * 3)) & 0xFF; 00032 offset += sizeof(this->sequence_length); 00033 for( uint32_t i = 0; i < sequence_length; i++){ 00034 union { 00035 int32_t real; 00036 uint32_t base; 00037 } u_sequencei; 00038 u_sequencei.real = this->sequence[i]; 00039 *(outbuffer + offset + 0) = (u_sequencei.base >> (8 * 0)) & 0xFF; 00040 *(outbuffer + offset + 1) = (u_sequencei.base >> (8 * 1)) & 0xFF; 00041 *(outbuffer + offset + 2) = (u_sequencei.base >> (8 * 2)) & 0xFF; 00042 *(outbuffer + offset + 3) = (u_sequencei.base >> (8 * 3)) & 0xFF; 00043 offset += sizeof(this->sequence[i]); 00044 } 00045 return offset; 00046 } 00047 00048 virtual int deserialize(unsigned char *inbuffer) 00049 { 00050 int offset = 0; 00051 uint32_t sequence_lengthT = ((uint32_t) (*(inbuffer + offset))); 00052 sequence_lengthT |= ((uint32_t) (*(inbuffer + offset + 1))) << (8 * 1); 00053 sequence_lengthT |= ((uint32_t) (*(inbuffer + offset + 2))) << (8 * 2); 00054 sequence_lengthT |= ((uint32_t) (*(inbuffer + offset + 3))) << (8 * 3); 00055 offset += sizeof(this->sequence_length); 00056 if(sequence_lengthT > sequence_length) 00057 this->sequence = (int32_t*)realloc(this->sequence, sequence_lengthT * sizeof(int32_t)); 00058 sequence_length = sequence_lengthT; 00059 for( uint32_t i = 0; i < sequence_length; i++){ 00060 union { 00061 int32_t real; 00062 uint32_t base; 00063 } u_st_sequence; 00064 u_st_sequence.base = 0; 00065 u_st_sequence.base |= ((uint32_t) (*(inbuffer + offset + 0))) << (8 * 0); 00066 u_st_sequence.base |= ((uint32_t) (*(inbuffer + offset + 1))) << (8 * 1); 00067 u_st_sequence.base |= ((uint32_t) (*(inbuffer + offset + 2))) << (8 * 2); 00068 u_st_sequence.base |= ((uint32_t) (*(inbuffer + offset + 3))) << (8 * 3); 00069 this->st_sequence = u_st_sequence.real; 00070 offset += sizeof(this->st_sequence); 00071 memcpy( &(this->sequence[i]), &(this->st_sequence), sizeof(int32_t)); 00072 } 00073 return offset; 00074 } 00075 00076 const char * getType(){ return "actionlib_tutorials/FibonacciFeedback"; }; 00077 const char * getMD5(){ return "b81e37d2a31925a0e8ae261a8699cb79"; }; 00078 00079 }; 00080 00081 } 00082 #endif
Generated on Wed Jul 13 2022 23:30:17 by
