AngularVelocities.h
Go to the documentation of this file.
1 #ifndef _ROS_diffbot_msgs_AngularVelocities_h
2 #define _ROS_diffbot_msgs_AngularVelocities_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 AngularVelocities : public ros::Msg
13  {
14  public:
15  uint32_t joint_length;
16  typedef float _joint_type;
19 
21  joint_length(0), st_joint(), joint(nullptr)
22  {
23  }
24 
25  virtual int serialize(unsigned char *outbuffer) const override
26  {
27  int offset = 0;
28  *(outbuffer + offset + 0) = (this->joint_length >> (8 * 0)) & 0xFF;
29  *(outbuffer + offset + 1) = (this->joint_length >> (8 * 1)) & 0xFF;
30  *(outbuffer + offset + 2) = (this->joint_length >> (8 * 2)) & 0xFF;
31  *(outbuffer + offset + 3) = (this->joint_length >> (8 * 3)) & 0xFF;
32  offset += sizeof(this->joint_length);
33  for( uint32_t i = 0; i < joint_length; i++){
34  union {
35  float real;
36  uint32_t base;
37  } u_jointi;
38  u_jointi.real = this->joint[i];
39  *(outbuffer + offset + 0) = (u_jointi.base >> (8 * 0)) & 0xFF;
40  *(outbuffer + offset + 1) = (u_jointi.base >> (8 * 1)) & 0xFF;
41  *(outbuffer + offset + 2) = (u_jointi.base >> (8 * 2)) & 0xFF;
42  *(outbuffer + offset + 3) = (u_jointi.base >> (8 * 3)) & 0xFF;
43  offset += sizeof(this->joint[i]);
44  }
45  return offset;
46  }
47 
48  virtual int deserialize(unsigned char *inbuffer) override
49  {
50  int offset = 0;
51  uint32_t joint_lengthT = ((uint32_t) (*(inbuffer + offset)));
52  joint_lengthT |= ((uint32_t) (*(inbuffer + offset + 1))) << (8 * 1);
53  joint_lengthT |= ((uint32_t) (*(inbuffer + offset + 2))) << (8 * 2);
54  joint_lengthT |= ((uint32_t) (*(inbuffer + offset + 3))) << (8 * 3);
55  offset += sizeof(this->joint_length);
56  if(joint_lengthT > joint_length)
57  this->joint = (float*)realloc(this->joint, joint_lengthT * sizeof(float));
58  joint_length = joint_lengthT;
59  for( uint32_t i = 0; i < joint_length; i++){
60  union {
61  float real;
62  uint32_t base;
63  } u_st_joint;
64  u_st_joint.base = 0;
65  u_st_joint.base |= ((uint32_t) (*(inbuffer + offset + 0))) << (8 * 0);
66  u_st_joint.base |= ((uint32_t) (*(inbuffer + offset + 1))) << (8 * 1);
67  u_st_joint.base |= ((uint32_t) (*(inbuffer + offset + 2))) << (8 * 2);
68  u_st_joint.base |= ((uint32_t) (*(inbuffer + offset + 3))) << (8 * 3);
69  this->st_joint = u_st_joint.real;
70  offset += sizeof(this->st_joint);
71  memcpy( &(this->joint[i]), &(this->st_joint), sizeof(float));
72  }
73  return offset;
74  }
75 
76  virtual const char * getType() override { return "diffbot_msgs/AngularVelocities"; };
77  virtual const char * getMD5() override { return "edecb4b6fff50f927a908742515e167a"; };
78 
79  };
80 
81 }
82 #endif
diffbot_msgs::AngularVelocities::st_joint
_joint_type st_joint
Definition: AngularVelocities.h:17
diffbot_msgs::AngularVelocities::joint_length
uint32_t joint_length
Definition: AngularVelocities.h:15
diffbot_msgs::AngularVelocities::_joint_type
float _joint_type
Definition: AngularVelocities.h:16
ros::Msg
diffbot_msgs::AngularVelocities::AngularVelocities
AngularVelocities()
Definition: AngularVelocities.h:20
diffbot_msgs::AngularVelocities::getType
virtual const char * getType() override
Definition: AngularVelocities.h:76
diffbot_msgs::AngularVelocities::serialize
virtual int serialize(unsigned char *outbuffer) const override
Definition: AngularVelocities.h:25
diffbot_msgs
Definition: AngularVelocities.h:9
msg.h
diffbot_msgs::AngularVelocities
Definition: AngularVelocities.h:12
diffbot_msgs::AngularVelocities::deserialize
virtual int deserialize(unsigned char *inbuffer) override
Definition: AngularVelocities.h:48
diffbot_msgs::AngularVelocities::joint
_joint_type * joint
Definition: AngularVelocities.h:18
diffbot_msgs::AngularVelocities::getMD5
virtual const char * getMD5() override
Definition: AngularVelocities.h:77


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