Lib for Gobeur action

Dependents:  

Committer:
mondiaye
Date:
Mon Jul 05 16:47:35 2021 +0000
Revision:
0:7312173b8d5f
Child:
2:853546cbc5fe
First working or not program

Who changed what in which revision?

UserRevisionLine numberNew contents of line
mondiaye 0:7312173b8d5f 1 #ifndef _ROS_stm32_gobeur_Gobeur_h
mondiaye 0:7312173b8d5f 2 #define _ROS_stm32_gobeur_Gobeur_h
mondiaye 0:7312173b8d5f 3
mondiaye 0:7312173b8d5f 4 #include <stdint.h>
mondiaye 0:7312173b8d5f 5 #include <string.h>
mondiaye 0:7312173b8d5f 6 #include <stdlib.h>
mondiaye 0:7312173b8d5f 7 #include "ros/msg.h"
mondiaye 0:7312173b8d5f 8
mondiaye 0:7312173b8d5f 9 namespace stm32_gobeur
mondiaye 0:7312173b8d5f 10 {
mondiaye 0:7312173b8d5f 11
mondiaye 0:7312173b8d5f 12 class Gobeur : public ros::Msg
mondiaye 0:7312173b8d5f 13 {
mondiaye 0:7312173b8d5f 14 public:
mondiaye 0:7312173b8d5f 15 typedef uint8_t _gobeur_right_status_type;
mondiaye 0:7312173b8d5f 16 _gobeur_right_status_type gobeur_right_status;
mondiaye 0:7312173b8d5f 17 typedef uint8_t _gobeur_left_status_type;
mondiaye 0:7312173b8d5f 18 _gobeur_left_status_type gobeur_left_status;
mondiaye 0:7312173b8d5f 19 typedef uint8_t _gobeur_right_aspire_type;
mondiaye 0:7312173b8d5f 20 _gobeur_right_aspire_type gobeur_right_aspire;
mondiaye 0:7312173b8d5f 21 typedef uint8_t _gobeur_left_aspire_type;
mondiaye 0:7312173b8d5f 22 _gobeur_left_aspire_type gobeur_left_aspire;
mondiaye 0:7312173b8d5f 23 typedef uint8_t _game_status_type;
mondiaye 0:7312173b8d5f 24 _game_status_type game_status;
mondiaye 0:7312173b8d5f 25 typedef uint8_t _init_status_type;
mondiaye 0:7312173b8d5f 26 _init_status_type init_status;
mondiaye 0:7312173b8d5f 27
mondiaye 0:7312173b8d5f 28 Gobeur():
mondiaye 0:7312173b8d5f 29 gobeur_right_status(0),
mondiaye 0:7312173b8d5f 30 gobeur_left_status(0),
mondiaye 0:7312173b8d5f 31 gobeur_right_aspire(0),
mondiaye 0:7312173b8d5f 32 gobeur_left_aspire(0),
mondiaye 0:7312173b8d5f 33 game_status(0),
mondiaye 0:7312173b8d5f 34 init_status(0)
mondiaye 0:7312173b8d5f 35 {
mondiaye 0:7312173b8d5f 36 }
mondiaye 0:7312173b8d5f 37
mondiaye 0:7312173b8d5f 38 virtual int serialize(unsigned char *outbuffer) const
mondiaye 0:7312173b8d5f 39 {
mondiaye 0:7312173b8d5f 40 int offset = 0;
mondiaye 0:7312173b8d5f 41 *(outbuffer + offset + 0) = (this->gobeur_right_status >> (8 * 0)) & 0xFF;
mondiaye 0:7312173b8d5f 42 offset += sizeof(this->gobeur_right_status);
mondiaye 0:7312173b8d5f 43 *(outbuffer + offset + 0) = (this->gobeur_left_status >> (8 * 0)) & 0xFF;
mondiaye 0:7312173b8d5f 44 offset += sizeof(this->gobeur_left_status);
mondiaye 0:7312173b8d5f 45 *(outbuffer + offset + 0) = (this->gobeur_right_aspire >> (8 * 0)) & 0xFF;
mondiaye 0:7312173b8d5f 46 offset += sizeof(this->gobeur_right_aspire);
mondiaye 0:7312173b8d5f 47 *(outbuffer + offset + 0) = (this->gobeur_left_aspire >> (8 * 0)) & 0xFF;
mondiaye 0:7312173b8d5f 48 offset += sizeof(this->gobeur_left_aspire);
mondiaye 0:7312173b8d5f 49 *(outbuffer + offset + 0) = (this->game_status >> (8 * 0)) & 0xFF;
mondiaye 0:7312173b8d5f 50 offset += sizeof(this->game_status);
mondiaye 0:7312173b8d5f 51 *(outbuffer + offset + 0) = (this->init_status >> (8 * 0)) & 0xFF;
mondiaye 0:7312173b8d5f 52 offset += sizeof(this->init_status);
mondiaye 0:7312173b8d5f 53 return offset;
mondiaye 0:7312173b8d5f 54 }
mondiaye 0:7312173b8d5f 55
mondiaye 0:7312173b8d5f 56 virtual int deserialize(unsigned char *inbuffer)
mondiaye 0:7312173b8d5f 57 {
mondiaye 0:7312173b8d5f 58 int offset = 0;
mondiaye 0:7312173b8d5f 59 this->gobeur_right_status = ((uint8_t) (*(inbuffer + offset)));
mondiaye 0:7312173b8d5f 60 offset += sizeof(this->gobeur_right_status);
mondiaye 0:7312173b8d5f 61 this->gobeur_left_status = ((uint8_t) (*(inbuffer + offset)));
mondiaye 0:7312173b8d5f 62 offset += sizeof(this->gobeur_left_status);
mondiaye 0:7312173b8d5f 63 this->gobeur_right_aspire = ((uint8_t) (*(inbuffer + offset)));
mondiaye 0:7312173b8d5f 64 offset += sizeof(this->gobeur_right_aspire);
mondiaye 0:7312173b8d5f 65 this->gobeur_left_aspire = ((uint8_t) (*(inbuffer + offset)));
mondiaye 0:7312173b8d5f 66 offset += sizeof(this->gobeur_left_aspire);
mondiaye 0:7312173b8d5f 67 this->game_status = ((uint8_t) (*(inbuffer + offset)));
mondiaye 0:7312173b8d5f 68 offset += sizeof(this->game_status);
mondiaye 0:7312173b8d5f 69 this->init_status = ((uint8_t) (*(inbuffer + offset)));
mondiaye 0:7312173b8d5f 70 offset += sizeof(this->init_status);
mondiaye 0:7312173b8d5f 71 return offset;
mondiaye 0:7312173b8d5f 72 }
mondiaye 0:7312173b8d5f 73
mondiaye 0:7312173b8d5f 74 const char * getType(){ return "stm32_gobeur/Gobeur"; };
mondiaye 0:7312173b8d5f 75 const char * getMD5(){ return "5e6d8a0a49a30fe003418b63e30ef455"; };
mondiaye 0:7312173b8d5f 76
mondiaye 0:7312173b8d5f 77 };
mondiaye 0:7312173b8d5f 78
mondiaye 0:7312173b8d5f 79 }
mondiaye 0:7312173b8d5f 80 #endif