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_sensor_msgs_TimeReference_h
garyservin 0:9e9b7db60fd5 2 #define _ROS_sensor_msgs_TimeReference_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 #include "ros/time.h"
garyservin 0:9e9b7db60fd5 10
garyservin 0:9e9b7db60fd5 11 namespace sensor_msgs
garyservin 0:9e9b7db60fd5 12 {
garyservin 0:9e9b7db60fd5 13
garyservin 0:9e9b7db60fd5 14 class TimeReference : public ros::Msg
garyservin 0:9e9b7db60fd5 15 {
garyservin 0:9e9b7db60fd5 16 public:
garyservin 0:9e9b7db60fd5 17 typedef std_msgs::Header _header_type;
garyservin 0:9e9b7db60fd5 18 _header_type header;
garyservin 0:9e9b7db60fd5 19 typedef ros::Time _time_ref_type;
garyservin 0:9e9b7db60fd5 20 _time_ref_type time_ref;
garyservin 0:9e9b7db60fd5 21 typedef const char* _source_type;
garyservin 0:9e9b7db60fd5 22 _source_type source;
garyservin 0:9e9b7db60fd5 23
garyservin 0:9e9b7db60fd5 24 TimeReference():
garyservin 0:9e9b7db60fd5 25 header(),
garyservin 0:9e9b7db60fd5 26 time_ref(),
garyservin 0:9e9b7db60fd5 27 source("")
garyservin 0:9e9b7db60fd5 28 {
garyservin 0:9e9b7db60fd5 29 }
garyservin 0:9e9b7db60fd5 30
garyservin 0:9e9b7db60fd5 31 virtual int serialize(unsigned char *outbuffer) const
garyservin 0:9e9b7db60fd5 32 {
garyservin 0:9e9b7db60fd5 33 int offset = 0;
garyservin 0:9e9b7db60fd5 34 offset += this->header.serialize(outbuffer + offset);
garyservin 0:9e9b7db60fd5 35 *(outbuffer + offset + 0) = (this->time_ref.sec >> (8 * 0)) & 0xFF;
garyservin 0:9e9b7db60fd5 36 *(outbuffer + offset + 1) = (this->time_ref.sec >> (8 * 1)) & 0xFF;
garyservin 0:9e9b7db60fd5 37 *(outbuffer + offset + 2) = (this->time_ref.sec >> (8 * 2)) & 0xFF;
garyservin 0:9e9b7db60fd5 38 *(outbuffer + offset + 3) = (this->time_ref.sec >> (8 * 3)) & 0xFF;
garyservin 0:9e9b7db60fd5 39 offset += sizeof(this->time_ref.sec);
garyservin 0:9e9b7db60fd5 40 *(outbuffer + offset + 0) = (this->time_ref.nsec >> (8 * 0)) & 0xFF;
garyservin 0:9e9b7db60fd5 41 *(outbuffer + offset + 1) = (this->time_ref.nsec >> (8 * 1)) & 0xFF;
garyservin 0:9e9b7db60fd5 42 *(outbuffer + offset + 2) = (this->time_ref.nsec >> (8 * 2)) & 0xFF;
garyservin 0:9e9b7db60fd5 43 *(outbuffer + offset + 3) = (this->time_ref.nsec >> (8 * 3)) & 0xFF;
garyservin 0:9e9b7db60fd5 44 offset += sizeof(this->time_ref.nsec);
garyservin 0:9e9b7db60fd5 45 uint32_t length_source = strlen(this->source);
garyservin 0:9e9b7db60fd5 46 varToArr(outbuffer + offset, length_source);
garyservin 0:9e9b7db60fd5 47 offset += 4;
garyservin 0:9e9b7db60fd5 48 memcpy(outbuffer + offset, this->source, length_source);
garyservin 0:9e9b7db60fd5 49 offset += length_source;
garyservin 0:9e9b7db60fd5 50 return offset;
garyservin 0:9e9b7db60fd5 51 }
garyservin 0:9e9b7db60fd5 52
garyservin 0:9e9b7db60fd5 53 virtual int deserialize(unsigned char *inbuffer)
garyservin 0:9e9b7db60fd5 54 {
garyservin 0:9e9b7db60fd5 55 int offset = 0;
garyservin 0:9e9b7db60fd5 56 offset += this->header.deserialize(inbuffer + offset);
garyservin 0:9e9b7db60fd5 57 this->time_ref.sec = ((uint32_t) (*(inbuffer + offset)));
garyservin 0:9e9b7db60fd5 58 this->time_ref.sec |= ((uint32_t) (*(inbuffer + offset + 1))) << (8 * 1);
garyservin 0:9e9b7db60fd5 59 this->time_ref.sec |= ((uint32_t) (*(inbuffer + offset + 2))) << (8 * 2);
garyservin 0:9e9b7db60fd5 60 this->time_ref.sec |= ((uint32_t) (*(inbuffer + offset + 3))) << (8 * 3);
garyservin 0:9e9b7db60fd5 61 offset += sizeof(this->time_ref.sec);
garyservin 0:9e9b7db60fd5 62 this->time_ref.nsec = ((uint32_t) (*(inbuffer + offset)));
garyservin 0:9e9b7db60fd5 63 this->time_ref.nsec |= ((uint32_t) (*(inbuffer + offset + 1))) << (8 * 1);
garyservin 0:9e9b7db60fd5 64 this->time_ref.nsec |= ((uint32_t) (*(inbuffer + offset + 2))) << (8 * 2);
garyservin 0:9e9b7db60fd5 65 this->time_ref.nsec |= ((uint32_t) (*(inbuffer + offset + 3))) << (8 * 3);
garyservin 0:9e9b7db60fd5 66 offset += sizeof(this->time_ref.nsec);
garyservin 0:9e9b7db60fd5 67 uint32_t length_source;
garyservin 0:9e9b7db60fd5 68 arrToVar(length_source, (inbuffer + offset));
garyservin 0:9e9b7db60fd5 69 offset += 4;
garyservin 0:9e9b7db60fd5 70 for(unsigned int k= offset; k< offset+length_source; ++k){
garyservin 0:9e9b7db60fd5 71 inbuffer[k-1]=inbuffer[k];
garyservin 0:9e9b7db60fd5 72 }
garyservin 0:9e9b7db60fd5 73 inbuffer[offset+length_source-1]=0;
garyservin 0:9e9b7db60fd5 74 this->source = (char *)(inbuffer + offset-1);
garyservin 0:9e9b7db60fd5 75 offset += length_source;
garyservin 0:9e9b7db60fd5 76 return offset;
garyservin 0:9e9b7db60fd5 77 }
garyservin 0:9e9b7db60fd5 78
garyservin 0:9e9b7db60fd5 79 const char * getType(){ return "sensor_msgs/TimeReference"; };
garyservin 0:9e9b7db60fd5 80 const char * getMD5(){ return "fded64a0265108ba86c3d38fb11c0c16"; };
garyservin 0:9e9b7db60fd5 81
garyservin 0:9e9b7db60fd5 82 };
garyservin 0:9e9b7db60fd5 83
garyservin 0:9e9b7db60fd5 84 }
garyservin 0:9e9b7db60fd5 85 #endif