ROS Serial library for Mbed platforms for ROS Indigo Igloo. Check http://wiki.ros.org/rosserial_mbed/ for more information
Dependents: rosserial_mbed_hello_world_publisher rtos_base_control rosserial_mbed_F64MA ROS-RTOS ... more
PointHeadGoal.h
00001 #ifndef _ROS_control_msgs_PointHeadGoal_h 00002 #define _ROS_control_msgs_PointHeadGoal_h 00003 00004 #include <stdint.h> 00005 #include <string.h> 00006 #include <stdlib.h> 00007 #include "ros/msg.h" 00008 #include "geometry_msgs/PointStamped.h" 00009 #include "geometry_msgs/Vector3.h" 00010 #include "ros/duration.h" 00011 00012 namespace control_msgs 00013 { 00014 00015 class PointHeadGoal : public ros::Msg 00016 { 00017 public: 00018 geometry_msgs::PointStamped target; 00019 geometry_msgs::Vector3 pointing_axis; 00020 const char* pointing_frame; 00021 ros::Duration min_duration; 00022 double max_velocity; 00023 00024 PointHeadGoal(): 00025 target(), 00026 pointing_axis(), 00027 pointing_frame(""), 00028 min_duration(), 00029 max_velocity(0) 00030 { 00031 } 00032 00033 virtual int serialize(unsigned char *outbuffer) const 00034 { 00035 int offset = 0; 00036 offset += this->target.serialize(outbuffer + offset); 00037 offset += this->pointing_axis.serialize(outbuffer + offset); 00038 uint32_t length_pointing_frame = strlen(this->pointing_frame); 00039 memcpy(outbuffer + offset, &length_pointing_frame, sizeof(uint32_t)); 00040 offset += 4; 00041 memcpy(outbuffer + offset, this->pointing_frame, length_pointing_frame); 00042 offset += length_pointing_frame; 00043 *(outbuffer + offset + 0) = (this->min_duration.sec >> (8 * 0)) & 0xFF; 00044 *(outbuffer + offset + 1) = (this->min_duration.sec >> (8 * 1)) & 0xFF; 00045 *(outbuffer + offset + 2) = (this->min_duration.sec >> (8 * 2)) & 0xFF; 00046 *(outbuffer + offset + 3) = (this->min_duration.sec >> (8 * 3)) & 0xFF; 00047 offset += sizeof(this->min_duration.sec); 00048 *(outbuffer + offset + 0) = (this->min_duration.nsec >> (8 * 0)) & 0xFF; 00049 *(outbuffer + offset + 1) = (this->min_duration.nsec >> (8 * 1)) & 0xFF; 00050 *(outbuffer + offset + 2) = (this->min_duration.nsec >> (8 * 2)) & 0xFF; 00051 *(outbuffer + offset + 3) = (this->min_duration.nsec >> (8 * 3)) & 0xFF; 00052 offset += sizeof(this->min_duration.nsec); 00053 union { 00054 double real; 00055 uint64_t base; 00056 } u_max_velocity; 00057 u_max_velocity.real = this->max_velocity; 00058 *(outbuffer + offset + 0) = (u_max_velocity.base >> (8 * 0)) & 0xFF; 00059 *(outbuffer + offset + 1) = (u_max_velocity.base >> (8 * 1)) & 0xFF; 00060 *(outbuffer + offset + 2) = (u_max_velocity.base >> (8 * 2)) & 0xFF; 00061 *(outbuffer + offset + 3) = (u_max_velocity.base >> (8 * 3)) & 0xFF; 00062 *(outbuffer + offset + 4) = (u_max_velocity.base >> (8 * 4)) & 0xFF; 00063 *(outbuffer + offset + 5) = (u_max_velocity.base >> (8 * 5)) & 0xFF; 00064 *(outbuffer + offset + 6) = (u_max_velocity.base >> (8 * 6)) & 0xFF; 00065 *(outbuffer + offset + 7) = (u_max_velocity.base >> (8 * 7)) & 0xFF; 00066 offset += sizeof(this->max_velocity); 00067 return offset; 00068 } 00069 00070 virtual int deserialize(unsigned char *inbuffer) 00071 { 00072 int offset = 0; 00073 offset += this->target.deserialize(inbuffer + offset); 00074 offset += this->pointing_axis.deserialize(inbuffer + offset); 00075 uint32_t length_pointing_frame; 00076 memcpy(&length_pointing_frame, (inbuffer + offset), sizeof(uint32_t)); 00077 offset += 4; 00078 for(unsigned int k= offset; k< offset+length_pointing_frame; ++k){ 00079 inbuffer[k-1]=inbuffer[k]; 00080 } 00081 inbuffer[offset+length_pointing_frame-1]=0; 00082 this->pointing_frame = (char *)(inbuffer + offset-1); 00083 offset += length_pointing_frame; 00084 this->min_duration.sec = ((uint32_t) (*(inbuffer + offset))); 00085 this->min_duration.sec |= ((uint32_t) (*(inbuffer + offset + 1))) << (8 * 1); 00086 this->min_duration.sec |= ((uint32_t) (*(inbuffer + offset + 2))) << (8 * 2); 00087 this->min_duration.sec |= ((uint32_t) (*(inbuffer + offset + 3))) << (8 * 3); 00088 offset += sizeof(this->min_duration.sec); 00089 this->min_duration.nsec = ((uint32_t) (*(inbuffer + offset))); 00090 this->min_duration.nsec |= ((uint32_t) (*(inbuffer + offset + 1))) << (8 * 1); 00091 this->min_duration.nsec |= ((uint32_t) (*(inbuffer + offset + 2))) << (8 * 2); 00092 this->min_duration.nsec |= ((uint32_t) (*(inbuffer + offset + 3))) << (8 * 3); 00093 offset += sizeof(this->min_duration.nsec); 00094 union { 00095 double real; 00096 uint64_t base; 00097 } u_max_velocity; 00098 u_max_velocity.base = 0; 00099 u_max_velocity.base |= ((uint64_t) (*(inbuffer + offset + 0))) << (8 * 0); 00100 u_max_velocity.base |= ((uint64_t) (*(inbuffer + offset + 1))) << (8 * 1); 00101 u_max_velocity.base |= ((uint64_t) (*(inbuffer + offset + 2))) << (8 * 2); 00102 u_max_velocity.base |= ((uint64_t) (*(inbuffer + offset + 3))) << (8 * 3); 00103 u_max_velocity.base |= ((uint64_t) (*(inbuffer + offset + 4))) << (8 * 4); 00104 u_max_velocity.base |= ((uint64_t) (*(inbuffer + offset + 5))) << (8 * 5); 00105 u_max_velocity.base |= ((uint64_t) (*(inbuffer + offset + 6))) << (8 * 6); 00106 u_max_velocity.base |= ((uint64_t) (*(inbuffer + offset + 7))) << (8 * 7); 00107 this->max_velocity = u_max_velocity.real; 00108 offset += sizeof(this->max_velocity); 00109 return offset; 00110 } 00111 00112 const char * getType(){ return "control_msgs/PointHeadGoal"; }; 00113 const char * getMD5(){ return "8b92b1cd5e06c8a94c917dc3209a4c1d"; }; 00114 00115 }; 00116 00117 } 00118 #endif
Generated on Tue Jul 12 2022 18:39:40 by 1.7.2