JointValues.h
Go to the documentation of this file.
1 /*
2  * Copyright 2017 Fraunhofer Institute for Manufacturing Engineering and Automation (IPA)
3  *
4  * Licensed under the Apache License, Version 2.0 (the "License");
5  * you may not use this file except in compliance with the License.
6  * You may obtain a copy of the License at
7  *
8  * http://www.apache.org/licenses/LICENSE-2.0
9 
10  * Unless required by applicable law or agreed to in writing, software
11  * distributed under the License is distributed on an "AS IS" BASIS,
12  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13  * See the License for the specific language governing permissions and
14  * limitations under the License.
15  */
16 
17 
18 #ifndef _ROS_cob_hand_bridge_JointValues_h
19 #define _ROS_cob_hand_bridge_JointValues_h
20 
21 #include <stdint.h>
22 #include <string.h>
23 #include <stdlib.h>
24 #include "ros/msg.h"
25 
26 namespace cob_hand_bridge
27 {
28 
29  class JointValues : public ros::Msg
30  {
31  public:
32  int16_t position_cdeg[2];
33  int16_t velocity_cdeg_s[2];
34  int16_t current_100uA[2];
35 
37  position_cdeg(),
38  velocity_cdeg_s(),
39  current_100uA()
40  {
41  }
42 
43  virtual int serialize(unsigned char *outbuffer) const
44  {
45  int offset = 0;
46  for( uint8_t i = 0; i < 2; i++){
47  union {
48  int16_t real;
49  uint16_t base;
50  } u_position_cdegi;
51  u_position_cdegi.real = this->position_cdeg[i];
52  *(outbuffer + offset + 0) = (u_position_cdegi.base >> (8 * 0)) & 0xFF;
53  *(outbuffer + offset + 1) = (u_position_cdegi.base >> (8 * 1)) & 0xFF;
54  offset += sizeof(this->position_cdeg[i]);
55  }
56  for( uint8_t i = 0; i < 2; i++){
57  union {
58  int16_t real;
59  uint16_t base;
60  } u_velocity_cdeg_si;
61  u_velocity_cdeg_si.real = this->velocity_cdeg_s[i];
62  *(outbuffer + offset + 0) = (u_velocity_cdeg_si.base >> (8 * 0)) & 0xFF;
63  *(outbuffer + offset + 1) = (u_velocity_cdeg_si.base >> (8 * 1)) & 0xFF;
64  offset += sizeof(this->velocity_cdeg_s[i]);
65  }
66  for( uint8_t i = 0; i < 2; i++){
67  union {
68  int16_t real;
69  uint16_t base;
70  } u_current_100uAi;
71  u_current_100uAi.real = this->current_100uA[i];
72  *(outbuffer + offset + 0) = (u_current_100uAi.base >> (8 * 0)) & 0xFF;
73  *(outbuffer + offset + 1) = (u_current_100uAi.base >> (8 * 1)) & 0xFF;
74  offset += sizeof(this->current_100uA[i]);
75  }
76  return offset;
77  }
78 
79  virtual int deserialize(unsigned char *inbuffer)
80  {
81  int offset = 0;
82  for( uint8_t i = 0; i < 2; i++){
83  union {
84  int16_t real;
85  uint16_t base;
86  } u_position_cdegi;
87  u_position_cdegi.base = 0;
88  u_position_cdegi.base |= ((uint16_t) (*(inbuffer + offset + 0))) << (8 * 0);
89  u_position_cdegi.base |= ((uint16_t) (*(inbuffer + offset + 1))) << (8 * 1);
90  this->position_cdeg[i] = u_position_cdegi.real;
91  offset += sizeof(this->position_cdeg[i]);
92  }
93  for( uint8_t i = 0; i < 2; i++){
94  union {
95  int16_t real;
96  uint16_t base;
97  } u_velocity_cdeg_si;
98  u_velocity_cdeg_si.base = 0;
99  u_velocity_cdeg_si.base |= ((uint16_t) (*(inbuffer + offset + 0))) << (8 * 0);
100  u_velocity_cdeg_si.base |= ((uint16_t) (*(inbuffer + offset + 1))) << (8 * 1);
101  this->velocity_cdeg_s[i] = u_velocity_cdeg_si.real;
102  offset += sizeof(this->velocity_cdeg_s[i]);
103  }
104  for( uint8_t i = 0; i < 2; i++){
105  union {
106  int16_t real;
107  uint16_t base;
108  } u_current_100uAi;
109  u_current_100uAi.base = 0;
110  u_current_100uAi.base |= ((uint16_t) (*(inbuffer + offset + 0))) << (8 * 0);
111  u_current_100uAi.base |= ((uint16_t) (*(inbuffer + offset + 1))) << (8 * 1);
112  this->current_100uA[i] = u_current_100uAi.real;
113  offset += sizeof(this->current_100uA[i]);
114  }
115  return offset;
116  }
117 
118  const char * getType(){ return "cob_hand_bridge/JointValues"; };
119  const char * getMD5(){ return "a8168eaf63b3492bbb7dcd4942c4f1c0"; };
120 
121  };
122 
123 }
124 #endif
virtual int deserialize(unsigned char *inbuffer)
Definition: JointValues.h:79
Definition: msg.h:26
virtual int serialize(unsigned char *outbuffer) const
Definition: JointValues.h:43


cob_hand_bridge
Author(s): Mathias Lüdtke
autogenerated on Tue Oct 20 2020 03:35:57