n
Dependencies: BufferedSerial
Revision 2:200bb2d0bf4a, committed 2020-01-18
- Comitter:
- BenRJG
- Date:
- Sat Jan 18 02:05:21 2020 +0000
- Parent:
- 1:a849bf78d77f
- Commit message:
- Merged Saleh Code
Changed in this revision
dumbot_control/timeOfFlight.h | Show annotated file Show diff for this revision Revisions of this file |
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/dumbot_control/timeOfFlight.h Sat Jan 18 02:05:21 2020 +0000 @@ -0,0 +1,94 @@ +#ifndef _ROS_dumbot_control_timeOfFlight_h +#define _ROS_dumbot_control_timeOfFlight_h + +#include <stdint.h> +#include <string.h> +#include <stdlib.h> +#include "ros/msg.h" + +namespace dumbot_control +{ + + class timeOfFlight : public ros::Msg + { + public: + typedef uint8_t _sensor1_type; + _sensor1_type sensor1; + typedef uint8_t _sensor2_type; + _sensor2_type sensor2; + typedef uint8_t _sensor3_type; + _sensor3_type sensor3; + typedef uint8_t _sensor4_type; + _sensor4_type sensor4; + typedef uint8_t _sensor5_type; + _sensor5_type sensor5; + typedef uint8_t _sensor6_type; + _sensor6_type sensor6; + typedef uint8_t _sensor7_type; + _sensor7_type sensor7; + typedef uint8_t _sensor8_type; + _sensor8_type sensor8; + + timeOfFlight(): + sensor1(0), + sensor2(0), + sensor3(0), + sensor4(0), + sensor5(0), + sensor6(0), + sensor7(0), + sensor8(0) + { + } + + virtual int serialize(unsigned char *outbuffer) const + { + int offset = 0; + *(outbuffer + offset + 0) = (this->sensor1 >> (8 * 0)) & 0xFF; + offset += sizeof(this->sensor1); + *(outbuffer + offset + 0) = (this->sensor2 >> (8 * 0)) & 0xFF; + offset += sizeof(this->sensor2); + *(outbuffer + offset + 0) = (this->sensor3 >> (8 * 0)) & 0xFF; + offset += sizeof(this->sensor3); + *(outbuffer + offset + 0) = (this->sensor4 >> (8 * 0)) & 0xFF; + offset += sizeof(this->sensor4); + *(outbuffer + offset + 0) = (this->sensor5 >> (8 * 0)) & 0xFF; + offset += sizeof(this->sensor5); + *(outbuffer + offset + 0) = (this->sensor6 >> (8 * 0)) & 0xFF; + offset += sizeof(this->sensor6); + *(outbuffer + offset + 0) = (this->sensor7 >> (8 * 0)) & 0xFF; + offset += sizeof(this->sensor7); + *(outbuffer + offset + 0) = (this->sensor8 >> (8 * 0)) & 0xFF; + offset += sizeof(this->sensor8); + return offset; + } + + virtual int deserialize(unsigned char *inbuffer) + { + int offset = 0; + this->sensor1 = ((uint8_t) (*(inbuffer + offset))); + offset += sizeof(this->sensor1); + this->sensor2 = ((uint8_t) (*(inbuffer + offset))); + offset += sizeof(this->sensor2); + this->sensor3 = ((uint8_t) (*(inbuffer + offset))); + offset += sizeof(this->sensor3); + this->sensor4 = ((uint8_t) (*(inbuffer + offset))); + offset += sizeof(this->sensor4); + this->sensor5 = ((uint8_t) (*(inbuffer + offset))); + offset += sizeof(this->sensor5); + this->sensor6 = ((uint8_t) (*(inbuffer + offset))); + offset += sizeof(this->sensor6); + this->sensor7 = ((uint8_t) (*(inbuffer + offset))); + offset += sizeof(this->sensor7); + this->sensor8 = ((uint8_t) (*(inbuffer + offset))); + offset += sizeof(this->sensor8); + return offset; + } + + const char * getType(){ return "dumbot_control/timeOfFlight"; }; + const char * getMD5(){ return "97bbdd5133a79bdbd77ecbf450b5f54c"; }; + + }; + +} +#endif