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
GripperCommandResult.h
00001 #ifndef _ROS_control_msgs_GripperCommandResult_h 00002 #define _ROS_control_msgs_GripperCommandResult_h 00003 00004 #include <stdint.h> 00005 #include <string.h> 00006 #include <stdlib.h> 00007 #include "ros/msg.h" 00008 00009 namespace control_msgs 00010 { 00011 00012 class GripperCommandResult : public ros::Msg 00013 { 00014 public: 00015 double position; 00016 double effort; 00017 bool stalled; 00018 bool reached_goal; 00019 00020 GripperCommandResult(): 00021 position(0), 00022 effort(0), 00023 stalled(0), 00024 reached_goal(0) 00025 { 00026 } 00027 00028 virtual int serialize(unsigned char *outbuffer) const 00029 { 00030 int offset = 0; 00031 union { 00032 double real; 00033 uint64_t base; 00034 } u_position; 00035 u_position.real = this->position; 00036 *(outbuffer + offset + 0) = (u_position.base >> (8 * 0)) & 0xFF; 00037 *(outbuffer + offset + 1) = (u_position.base >> (8 * 1)) & 0xFF; 00038 *(outbuffer + offset + 2) = (u_position.base >> (8 * 2)) & 0xFF; 00039 *(outbuffer + offset + 3) = (u_position.base >> (8 * 3)) & 0xFF; 00040 *(outbuffer + offset + 4) = (u_position.base >> (8 * 4)) & 0xFF; 00041 *(outbuffer + offset + 5) = (u_position.base >> (8 * 5)) & 0xFF; 00042 *(outbuffer + offset + 6) = (u_position.base >> (8 * 6)) & 0xFF; 00043 *(outbuffer + offset + 7) = (u_position.base >> (8 * 7)) & 0xFF; 00044 offset += sizeof(this->position); 00045 union { 00046 double real; 00047 uint64_t base; 00048 } u_effort; 00049 u_effort.real = this->effort; 00050 *(outbuffer + offset + 0) = (u_effort.base >> (8 * 0)) & 0xFF; 00051 *(outbuffer + offset + 1) = (u_effort.base >> (8 * 1)) & 0xFF; 00052 *(outbuffer + offset + 2) = (u_effort.base >> (8 * 2)) & 0xFF; 00053 *(outbuffer + offset + 3) = (u_effort.base >> (8 * 3)) & 0xFF; 00054 *(outbuffer + offset + 4) = (u_effort.base >> (8 * 4)) & 0xFF; 00055 *(outbuffer + offset + 5) = (u_effort.base >> (8 * 5)) & 0xFF; 00056 *(outbuffer + offset + 6) = (u_effort.base >> (8 * 6)) & 0xFF; 00057 *(outbuffer + offset + 7) = (u_effort.base >> (8 * 7)) & 0xFF; 00058 offset += sizeof(this->effort); 00059 union { 00060 bool real; 00061 uint8_t base; 00062 } u_stalled; 00063 u_stalled.real = this->stalled; 00064 *(outbuffer + offset + 0) = (u_stalled.base >> (8 * 0)) & 0xFF; 00065 offset += sizeof(this->stalled); 00066 union { 00067 bool real; 00068 uint8_t base; 00069 } u_reached_goal; 00070 u_reached_goal.real = this->reached_goal; 00071 *(outbuffer + offset + 0) = (u_reached_goal.base >> (8 * 0)) & 0xFF; 00072 offset += sizeof(this->reached_goal); 00073 return offset; 00074 } 00075 00076 virtual int deserialize(unsigned char *inbuffer) 00077 { 00078 int offset = 0; 00079 union { 00080 double real; 00081 uint64_t base; 00082 } u_position; 00083 u_position.base = 0; 00084 u_position.base |= ((uint64_t) (*(inbuffer + offset + 0))) << (8 * 0); 00085 u_position.base |= ((uint64_t) (*(inbuffer + offset + 1))) << (8 * 1); 00086 u_position.base |= ((uint64_t) (*(inbuffer + offset + 2))) << (8 * 2); 00087 u_position.base |= ((uint64_t) (*(inbuffer + offset + 3))) << (8 * 3); 00088 u_position.base |= ((uint64_t) (*(inbuffer + offset + 4))) << (8 * 4); 00089 u_position.base |= ((uint64_t) (*(inbuffer + offset + 5))) << (8 * 5); 00090 u_position.base |= ((uint64_t) (*(inbuffer + offset + 6))) << (8 * 6); 00091 u_position.base |= ((uint64_t) (*(inbuffer + offset + 7))) << (8 * 7); 00092 this->position = u_position.real; 00093 offset += sizeof(this->position); 00094 union { 00095 double real; 00096 uint64_t base; 00097 } u_effort; 00098 u_effort.base = 0; 00099 u_effort.base |= ((uint64_t) (*(inbuffer + offset + 0))) << (8 * 0); 00100 u_effort.base |= ((uint64_t) (*(inbuffer + offset + 1))) << (8 * 1); 00101 u_effort.base |= ((uint64_t) (*(inbuffer + offset + 2))) << (8 * 2); 00102 u_effort.base |= ((uint64_t) (*(inbuffer + offset + 3))) << (8 * 3); 00103 u_effort.base |= ((uint64_t) (*(inbuffer + offset + 4))) << (8 * 4); 00104 u_effort.base |= ((uint64_t) (*(inbuffer + offset + 5))) << (8 * 5); 00105 u_effort.base |= ((uint64_t) (*(inbuffer + offset + 6))) << (8 * 6); 00106 u_effort.base |= ((uint64_t) (*(inbuffer + offset + 7))) << (8 * 7); 00107 this->effort = u_effort.real; 00108 offset += sizeof(this->effort); 00109 union { 00110 bool real; 00111 uint8_t base; 00112 } u_stalled; 00113 u_stalled.base = 0; 00114 u_stalled.base |= ((uint8_t) (*(inbuffer + offset + 0))) << (8 * 0); 00115 this->stalled = u_stalled.real; 00116 offset += sizeof(this->stalled); 00117 union { 00118 bool real; 00119 uint8_t base; 00120 } u_reached_goal; 00121 u_reached_goal.base = 0; 00122 u_reached_goal.base |= ((uint8_t) (*(inbuffer + offset + 0))) << (8 * 0); 00123 this->reached_goal = u_reached_goal.real; 00124 offset += sizeof(this->reached_goal); 00125 return offset; 00126 } 00127 00128 const char * getType(){ return "control_msgs/GripperCommandResult"; }; 00129 const char * getMD5(){ return "e4cbff56d3562bcf113da5a5adeef91f"; }; 00130 00131 }; 00132 00133 } 00134 #endif
Generated on Tue Jul 12 2022 18:39:39 by 1.7.2