PID.h
Go to the documentation of this file.
1 #ifndef _ROS_diffbot_msgs_PID_h
2 #define _ROS_diffbot_msgs_PID_h
3 
4 #include <stdint.h>
5 #include <string.h>
6 #include <stdlib.h>
7 #include "ros/msg.h"
8 
9 namespace diffbot_msgs
10 {
11 
12  class PID : public ros::Msg
13  {
14  public:
15  typedef float _kp_type;
17  typedef float _ki_type;
19  typedef float _kd_type;
21 
22  PID():
23  kp(0),
24  ki(0),
25  kd(0)
26  {
27  }
28 
29  virtual int serialize(unsigned char *outbuffer) const override
30  {
31  int offset = 0;
32  union {
33  float real;
34  uint32_t base;
35  } u_kp;
36  u_kp.real = this->kp;
37  *(outbuffer + offset + 0) = (u_kp.base >> (8 * 0)) & 0xFF;
38  *(outbuffer + offset + 1) = (u_kp.base >> (8 * 1)) & 0xFF;
39  *(outbuffer + offset + 2) = (u_kp.base >> (8 * 2)) & 0xFF;
40  *(outbuffer + offset + 3) = (u_kp.base >> (8 * 3)) & 0xFF;
41  offset += sizeof(this->kp);
42  union {
43  float real;
44  uint32_t base;
45  } u_ki;
46  u_ki.real = this->ki;
47  *(outbuffer + offset + 0) = (u_ki.base >> (8 * 0)) & 0xFF;
48  *(outbuffer + offset + 1) = (u_ki.base >> (8 * 1)) & 0xFF;
49  *(outbuffer + offset + 2) = (u_ki.base >> (8 * 2)) & 0xFF;
50  *(outbuffer + offset + 3) = (u_ki.base >> (8 * 3)) & 0xFF;
51  offset += sizeof(this->ki);
52  union {
53  float real;
54  uint32_t base;
55  } u_kd;
56  u_kd.real = this->kd;
57  *(outbuffer + offset + 0) = (u_kd.base >> (8 * 0)) & 0xFF;
58  *(outbuffer + offset + 1) = (u_kd.base >> (8 * 1)) & 0xFF;
59  *(outbuffer + offset + 2) = (u_kd.base >> (8 * 2)) & 0xFF;
60  *(outbuffer + offset + 3) = (u_kd.base >> (8 * 3)) & 0xFF;
61  offset += sizeof(this->kd);
62  return offset;
63  }
64 
65  virtual int deserialize(unsigned char *inbuffer) override
66  {
67  int offset = 0;
68  union {
69  float real;
70  uint32_t base;
71  } u_kp;
72  u_kp.base = 0;
73  u_kp.base |= ((uint32_t) (*(inbuffer + offset + 0))) << (8 * 0);
74  u_kp.base |= ((uint32_t) (*(inbuffer + offset + 1))) << (8 * 1);
75  u_kp.base |= ((uint32_t) (*(inbuffer + offset + 2))) << (8 * 2);
76  u_kp.base |= ((uint32_t) (*(inbuffer + offset + 3))) << (8 * 3);
77  this->kp = u_kp.real;
78  offset += sizeof(this->kp);
79  union {
80  float real;
81  uint32_t base;
82  } u_ki;
83  u_ki.base = 0;
84  u_ki.base |= ((uint32_t) (*(inbuffer + offset + 0))) << (8 * 0);
85  u_ki.base |= ((uint32_t) (*(inbuffer + offset + 1))) << (8 * 1);
86  u_ki.base |= ((uint32_t) (*(inbuffer + offset + 2))) << (8 * 2);
87  u_ki.base |= ((uint32_t) (*(inbuffer + offset + 3))) << (8 * 3);
88  this->ki = u_ki.real;
89  offset += sizeof(this->ki);
90  union {
91  float real;
92  uint32_t base;
93  } u_kd;
94  u_kd.base = 0;
95  u_kd.base |= ((uint32_t) (*(inbuffer + offset + 0))) << (8 * 0);
96  u_kd.base |= ((uint32_t) (*(inbuffer + offset + 1))) << (8 * 1);
97  u_kd.base |= ((uint32_t) (*(inbuffer + offset + 2))) << (8 * 2);
98  u_kd.base |= ((uint32_t) (*(inbuffer + offset + 3))) << (8 * 3);
99  this->kd = u_kd.real;
100  offset += sizeof(this->kd);
101  return offset;
102  }
103 
104  virtual const char * getType() override { return "diffbot_msgs/PID"; };
105  virtual const char * getMD5() override { return "08d0ca1f582560895ecba909de1d88ec"; };
106 
107  };
108 
109 }
110 #endif
diffbot_msgs::PID::getType
virtual const char * getType() override
Definition: PID.h:104
diffbot_msgs::PID::ki
_ki_type ki
Definition: PID.h:18
diffbot_msgs::PID::_kp_type
float _kp_type
Definition: PID.h:15
diffbot_msgs::PID::deserialize
virtual int deserialize(unsigned char *inbuffer) override
Definition: PID.h:65
diffbot_msgs::PID::serialize
virtual int serialize(unsigned char *outbuffer) const override
Definition: PID.h:29
diffbot_msgs::PID::getMD5
virtual const char * getMD5() override
Definition: PID.h:105
diffbot_msgs::PID::_ki_type
float _ki_type
Definition: PID.h:17
ros::Msg
diffbot_msgs::PID::PID
PID()
Definition: PID.h:22
diffbot_msgs
Definition: AngularVelocities.h:9
diffbot_msgs::PID
Definition: PID.h:12
msg.h
diffbot_msgs::PID::kp
_kp_type kp
Definition: PID.h:16
diffbot_msgs::PID::_kd_type
float _kd_type
Definition: PID.h:19
diffbot_msgs::PID::kd
_kd_type kd
Definition: PID.h:20


diffbot_base
Author(s):
autogenerated on Thu Sep 7 2023 02:35:23