Irfan Tito Kurniawan / ros_lib
Committer:
irfantitok
Date:
Wed Sep 02 13:51:31 2020 +0000
Revision:
0:8f3710bfd298
Resolved round not found

Who changed what in which revision?

UserRevisionLine numberNew contents of line
irfantitok 0:8f3710bfd298 1 #ifndef _ROS_control_msgs_PointHeadGoal_h
irfantitok 0:8f3710bfd298 2 #define _ROS_control_msgs_PointHeadGoal_h
irfantitok 0:8f3710bfd298 3
irfantitok 0:8f3710bfd298 4 #include <stdint.h>
irfantitok 0:8f3710bfd298 5 #include <string.h>
irfantitok 0:8f3710bfd298 6 #include <stdlib.h>
irfantitok 0:8f3710bfd298 7 #include "ros/msg.h"
irfantitok 0:8f3710bfd298 8 #include "geometry_msgs/PointStamped.h"
irfantitok 0:8f3710bfd298 9 #include "geometry_msgs/Vector3.h"
irfantitok 0:8f3710bfd298 10 #include "ros/duration.h"
irfantitok 0:8f3710bfd298 11
irfantitok 0:8f3710bfd298 12 namespace control_msgs
irfantitok 0:8f3710bfd298 13 {
irfantitok 0:8f3710bfd298 14
irfantitok 0:8f3710bfd298 15 class PointHeadGoal : public ros::Msg
irfantitok 0:8f3710bfd298 16 {
irfantitok 0:8f3710bfd298 17 public:
irfantitok 0:8f3710bfd298 18 typedef geometry_msgs::PointStamped _target_type;
irfantitok 0:8f3710bfd298 19 _target_type target;
irfantitok 0:8f3710bfd298 20 typedef geometry_msgs::Vector3 _pointing_axis_type;
irfantitok 0:8f3710bfd298 21 _pointing_axis_type pointing_axis;
irfantitok 0:8f3710bfd298 22 typedef const char* _pointing_frame_type;
irfantitok 0:8f3710bfd298 23 _pointing_frame_type pointing_frame;
irfantitok 0:8f3710bfd298 24 typedef ros::Duration _min_duration_type;
irfantitok 0:8f3710bfd298 25 _min_duration_type min_duration;
irfantitok 0:8f3710bfd298 26 typedef double _max_velocity_type;
irfantitok 0:8f3710bfd298 27 _max_velocity_type max_velocity;
irfantitok 0:8f3710bfd298 28
irfantitok 0:8f3710bfd298 29 PointHeadGoal():
irfantitok 0:8f3710bfd298 30 target(),
irfantitok 0:8f3710bfd298 31 pointing_axis(),
irfantitok 0:8f3710bfd298 32 pointing_frame(""),
irfantitok 0:8f3710bfd298 33 min_duration(),
irfantitok 0:8f3710bfd298 34 max_velocity(0)
irfantitok 0:8f3710bfd298 35 {
irfantitok 0:8f3710bfd298 36 }
irfantitok 0:8f3710bfd298 37
irfantitok 0:8f3710bfd298 38 virtual int serialize(unsigned char *outbuffer) const
irfantitok 0:8f3710bfd298 39 {
irfantitok 0:8f3710bfd298 40 int offset = 0;
irfantitok 0:8f3710bfd298 41 offset += this->target.serialize(outbuffer + offset);
irfantitok 0:8f3710bfd298 42 offset += this->pointing_axis.serialize(outbuffer + offset);
irfantitok 0:8f3710bfd298 43 uint32_t length_pointing_frame = strlen(this->pointing_frame);
irfantitok 0:8f3710bfd298 44 varToArr(outbuffer + offset, length_pointing_frame);
irfantitok 0:8f3710bfd298 45 offset += 4;
irfantitok 0:8f3710bfd298 46 memcpy(outbuffer + offset, this->pointing_frame, length_pointing_frame);
irfantitok 0:8f3710bfd298 47 offset += length_pointing_frame;
irfantitok 0:8f3710bfd298 48 *(outbuffer + offset + 0) = (this->min_duration.sec >> (8 * 0)) & 0xFF;
irfantitok 0:8f3710bfd298 49 *(outbuffer + offset + 1) = (this->min_duration.sec >> (8 * 1)) & 0xFF;
irfantitok 0:8f3710bfd298 50 *(outbuffer + offset + 2) = (this->min_duration.sec >> (8 * 2)) & 0xFF;
irfantitok 0:8f3710bfd298 51 *(outbuffer + offset + 3) = (this->min_duration.sec >> (8 * 3)) & 0xFF;
irfantitok 0:8f3710bfd298 52 offset += sizeof(this->min_duration.sec);
irfantitok 0:8f3710bfd298 53 *(outbuffer + offset + 0) = (this->min_duration.nsec >> (8 * 0)) & 0xFF;
irfantitok 0:8f3710bfd298 54 *(outbuffer + offset + 1) = (this->min_duration.nsec >> (8 * 1)) & 0xFF;
irfantitok 0:8f3710bfd298 55 *(outbuffer + offset + 2) = (this->min_duration.nsec >> (8 * 2)) & 0xFF;
irfantitok 0:8f3710bfd298 56 *(outbuffer + offset + 3) = (this->min_duration.nsec >> (8 * 3)) & 0xFF;
irfantitok 0:8f3710bfd298 57 offset += sizeof(this->min_duration.nsec);
irfantitok 0:8f3710bfd298 58 union {
irfantitok 0:8f3710bfd298 59 double real;
irfantitok 0:8f3710bfd298 60 uint64_t base;
irfantitok 0:8f3710bfd298 61 } u_max_velocity;
irfantitok 0:8f3710bfd298 62 u_max_velocity.real = this->max_velocity;
irfantitok 0:8f3710bfd298 63 *(outbuffer + offset + 0) = (u_max_velocity.base >> (8 * 0)) & 0xFF;
irfantitok 0:8f3710bfd298 64 *(outbuffer + offset + 1) = (u_max_velocity.base >> (8 * 1)) & 0xFF;
irfantitok 0:8f3710bfd298 65 *(outbuffer + offset + 2) = (u_max_velocity.base >> (8 * 2)) & 0xFF;
irfantitok 0:8f3710bfd298 66 *(outbuffer + offset + 3) = (u_max_velocity.base >> (8 * 3)) & 0xFF;
irfantitok 0:8f3710bfd298 67 *(outbuffer + offset + 4) = (u_max_velocity.base >> (8 * 4)) & 0xFF;
irfantitok 0:8f3710bfd298 68 *(outbuffer + offset + 5) = (u_max_velocity.base >> (8 * 5)) & 0xFF;
irfantitok 0:8f3710bfd298 69 *(outbuffer + offset + 6) = (u_max_velocity.base >> (8 * 6)) & 0xFF;
irfantitok 0:8f3710bfd298 70 *(outbuffer + offset + 7) = (u_max_velocity.base >> (8 * 7)) & 0xFF;
irfantitok 0:8f3710bfd298 71 offset += sizeof(this->max_velocity);
irfantitok 0:8f3710bfd298 72 return offset;
irfantitok 0:8f3710bfd298 73 }
irfantitok 0:8f3710bfd298 74
irfantitok 0:8f3710bfd298 75 virtual int deserialize(unsigned char *inbuffer)
irfantitok 0:8f3710bfd298 76 {
irfantitok 0:8f3710bfd298 77 int offset = 0;
irfantitok 0:8f3710bfd298 78 offset += this->target.deserialize(inbuffer + offset);
irfantitok 0:8f3710bfd298 79 offset += this->pointing_axis.deserialize(inbuffer + offset);
irfantitok 0:8f3710bfd298 80 uint32_t length_pointing_frame;
irfantitok 0:8f3710bfd298 81 arrToVar(length_pointing_frame, (inbuffer + offset));
irfantitok 0:8f3710bfd298 82 offset += 4;
irfantitok 0:8f3710bfd298 83 for(unsigned int k= offset; k< offset+length_pointing_frame; ++k){
irfantitok 0:8f3710bfd298 84 inbuffer[k-1]=inbuffer[k];
irfantitok 0:8f3710bfd298 85 }
irfantitok 0:8f3710bfd298 86 inbuffer[offset+length_pointing_frame-1]=0;
irfantitok 0:8f3710bfd298 87 this->pointing_frame = (char *)(inbuffer + offset-1);
irfantitok 0:8f3710bfd298 88 offset += length_pointing_frame;
irfantitok 0:8f3710bfd298 89 this->min_duration.sec = ((uint32_t) (*(inbuffer + offset)));
irfantitok 0:8f3710bfd298 90 this->min_duration.sec |= ((uint32_t) (*(inbuffer + offset + 1))) << (8 * 1);
irfantitok 0:8f3710bfd298 91 this->min_duration.sec |= ((uint32_t) (*(inbuffer + offset + 2))) << (8 * 2);
irfantitok 0:8f3710bfd298 92 this->min_duration.sec |= ((uint32_t) (*(inbuffer + offset + 3))) << (8 * 3);
irfantitok 0:8f3710bfd298 93 offset += sizeof(this->min_duration.sec);
irfantitok 0:8f3710bfd298 94 this->min_duration.nsec = ((uint32_t) (*(inbuffer + offset)));
irfantitok 0:8f3710bfd298 95 this->min_duration.nsec |= ((uint32_t) (*(inbuffer + offset + 1))) << (8 * 1);
irfantitok 0:8f3710bfd298 96 this->min_duration.nsec |= ((uint32_t) (*(inbuffer + offset + 2))) << (8 * 2);
irfantitok 0:8f3710bfd298 97 this->min_duration.nsec |= ((uint32_t) (*(inbuffer + offset + 3))) << (8 * 3);
irfantitok 0:8f3710bfd298 98 offset += sizeof(this->min_duration.nsec);
irfantitok 0:8f3710bfd298 99 union {
irfantitok 0:8f3710bfd298 100 double real;
irfantitok 0:8f3710bfd298 101 uint64_t base;
irfantitok 0:8f3710bfd298 102 } u_max_velocity;
irfantitok 0:8f3710bfd298 103 u_max_velocity.base = 0;
irfantitok 0:8f3710bfd298 104 u_max_velocity.base |= ((uint64_t) (*(inbuffer + offset + 0))) << (8 * 0);
irfantitok 0:8f3710bfd298 105 u_max_velocity.base |= ((uint64_t) (*(inbuffer + offset + 1))) << (8 * 1);
irfantitok 0:8f3710bfd298 106 u_max_velocity.base |= ((uint64_t) (*(inbuffer + offset + 2))) << (8 * 2);
irfantitok 0:8f3710bfd298 107 u_max_velocity.base |= ((uint64_t) (*(inbuffer + offset + 3))) << (8 * 3);
irfantitok 0:8f3710bfd298 108 u_max_velocity.base |= ((uint64_t) (*(inbuffer + offset + 4))) << (8 * 4);
irfantitok 0:8f3710bfd298 109 u_max_velocity.base |= ((uint64_t) (*(inbuffer + offset + 5))) << (8 * 5);
irfantitok 0:8f3710bfd298 110 u_max_velocity.base |= ((uint64_t) (*(inbuffer + offset + 6))) << (8 * 6);
irfantitok 0:8f3710bfd298 111 u_max_velocity.base |= ((uint64_t) (*(inbuffer + offset + 7))) << (8 * 7);
irfantitok 0:8f3710bfd298 112 this->max_velocity = u_max_velocity.real;
irfantitok 0:8f3710bfd298 113 offset += sizeof(this->max_velocity);
irfantitok 0:8f3710bfd298 114 return offset;
irfantitok 0:8f3710bfd298 115 }
irfantitok 0:8f3710bfd298 116
irfantitok 0:8f3710bfd298 117 const char * getType(){ return "control_msgs/PointHeadGoal"; };
irfantitok 0:8f3710bfd298 118 const char * getMD5(){ return "8b92b1cd5e06c8a94c917dc3209a4c1d"; };
irfantitok 0:8f3710bfd298 119
irfantitok 0:8f3710bfd298 120 };
irfantitok 0:8f3710bfd298 121
irfantitok 0:8f3710bfd298 122 }
irfantitok 0:8f3710bfd298 123 #endif