ROS Serial library for Mbed platforms for ROS Kinetic Kame. Check http://wiki.ros.org/rosserial_mbed/ for more information.

Dependencies:   BufferedSerial

Dependents:   mbed-os-example-blinky

Committer:
garyservin
Date:
Sat Dec 31 00:48:34 2016 +0000
Revision:
0:9e9b7db60fd5
Initial commit, generated based on a clean kinetic-desktop-full

Who changed what in which revision?

UserRevisionLine numberNew contents of line
garyservin 0:9e9b7db60fd5 1 #ifndef _ROS_visualization_msgs_InteractiveMarkerFeedback_h
garyservin 0:9e9b7db60fd5 2 #define _ROS_visualization_msgs_InteractiveMarkerFeedback_h
garyservin 0:9e9b7db60fd5 3
garyservin 0:9e9b7db60fd5 4 #include <stdint.h>
garyservin 0:9e9b7db60fd5 5 #include <string.h>
garyservin 0:9e9b7db60fd5 6 #include <stdlib.h>
garyservin 0:9e9b7db60fd5 7 #include "ros/msg.h"
garyservin 0:9e9b7db60fd5 8 #include "std_msgs/Header.h"
garyservin 0:9e9b7db60fd5 9 #include "geometry_msgs/Pose.h"
garyservin 0:9e9b7db60fd5 10 #include "geometry_msgs/Point.h"
garyservin 0:9e9b7db60fd5 11
garyservin 0:9e9b7db60fd5 12 namespace visualization_msgs
garyservin 0:9e9b7db60fd5 13 {
garyservin 0:9e9b7db60fd5 14
garyservin 0:9e9b7db60fd5 15 class InteractiveMarkerFeedback : public ros::Msg
garyservin 0:9e9b7db60fd5 16 {
garyservin 0:9e9b7db60fd5 17 public:
garyservin 0:9e9b7db60fd5 18 typedef std_msgs::Header _header_type;
garyservin 0:9e9b7db60fd5 19 _header_type header;
garyservin 0:9e9b7db60fd5 20 typedef const char* _client_id_type;
garyservin 0:9e9b7db60fd5 21 _client_id_type client_id;
garyservin 0:9e9b7db60fd5 22 typedef const char* _marker_name_type;
garyservin 0:9e9b7db60fd5 23 _marker_name_type marker_name;
garyservin 0:9e9b7db60fd5 24 typedef const char* _control_name_type;
garyservin 0:9e9b7db60fd5 25 _control_name_type control_name;
garyservin 0:9e9b7db60fd5 26 typedef uint8_t _event_type_type;
garyservin 0:9e9b7db60fd5 27 _event_type_type event_type;
garyservin 0:9e9b7db60fd5 28 typedef geometry_msgs::Pose _pose_type;
garyservin 0:9e9b7db60fd5 29 _pose_type pose;
garyservin 0:9e9b7db60fd5 30 typedef uint32_t _menu_entry_id_type;
garyservin 0:9e9b7db60fd5 31 _menu_entry_id_type menu_entry_id;
garyservin 0:9e9b7db60fd5 32 typedef geometry_msgs::Point _mouse_point_type;
garyservin 0:9e9b7db60fd5 33 _mouse_point_type mouse_point;
garyservin 0:9e9b7db60fd5 34 typedef bool _mouse_point_valid_type;
garyservin 0:9e9b7db60fd5 35 _mouse_point_valid_type mouse_point_valid;
garyservin 0:9e9b7db60fd5 36 enum { KEEP_ALIVE = 0 };
garyservin 0:9e9b7db60fd5 37 enum { POSE_UPDATE = 1 };
garyservin 0:9e9b7db60fd5 38 enum { MENU_SELECT = 2 };
garyservin 0:9e9b7db60fd5 39 enum { BUTTON_CLICK = 3 };
garyservin 0:9e9b7db60fd5 40 enum { MOUSE_DOWN = 4 };
garyservin 0:9e9b7db60fd5 41 enum { MOUSE_UP = 5 };
garyservin 0:9e9b7db60fd5 42
garyservin 0:9e9b7db60fd5 43 InteractiveMarkerFeedback():
garyservin 0:9e9b7db60fd5 44 header(),
garyservin 0:9e9b7db60fd5 45 client_id(""),
garyservin 0:9e9b7db60fd5 46 marker_name(""),
garyservin 0:9e9b7db60fd5 47 control_name(""),
garyservin 0:9e9b7db60fd5 48 event_type(0),
garyservin 0:9e9b7db60fd5 49 pose(),
garyservin 0:9e9b7db60fd5 50 menu_entry_id(0),
garyservin 0:9e9b7db60fd5 51 mouse_point(),
garyservin 0:9e9b7db60fd5 52 mouse_point_valid(0)
garyservin 0:9e9b7db60fd5 53 {
garyservin 0:9e9b7db60fd5 54 }
garyservin 0:9e9b7db60fd5 55
garyservin 0:9e9b7db60fd5 56 virtual int serialize(unsigned char *outbuffer) const
garyservin 0:9e9b7db60fd5 57 {
garyservin 0:9e9b7db60fd5 58 int offset = 0;
garyservin 0:9e9b7db60fd5 59 offset += this->header.serialize(outbuffer + offset);
garyservin 0:9e9b7db60fd5 60 uint32_t length_client_id = strlen(this->client_id);
garyservin 0:9e9b7db60fd5 61 varToArr(outbuffer + offset, length_client_id);
garyservin 0:9e9b7db60fd5 62 offset += 4;
garyservin 0:9e9b7db60fd5 63 memcpy(outbuffer + offset, this->client_id, length_client_id);
garyservin 0:9e9b7db60fd5 64 offset += length_client_id;
garyservin 0:9e9b7db60fd5 65 uint32_t length_marker_name = strlen(this->marker_name);
garyservin 0:9e9b7db60fd5 66 varToArr(outbuffer + offset, length_marker_name);
garyservin 0:9e9b7db60fd5 67 offset += 4;
garyservin 0:9e9b7db60fd5 68 memcpy(outbuffer + offset, this->marker_name, length_marker_name);
garyservin 0:9e9b7db60fd5 69 offset += length_marker_name;
garyservin 0:9e9b7db60fd5 70 uint32_t length_control_name = strlen(this->control_name);
garyservin 0:9e9b7db60fd5 71 varToArr(outbuffer + offset, length_control_name);
garyservin 0:9e9b7db60fd5 72 offset += 4;
garyservin 0:9e9b7db60fd5 73 memcpy(outbuffer + offset, this->control_name, length_control_name);
garyservin 0:9e9b7db60fd5 74 offset += length_control_name;
garyservin 0:9e9b7db60fd5 75 *(outbuffer + offset + 0) = (this->event_type >> (8 * 0)) & 0xFF;
garyservin 0:9e9b7db60fd5 76 offset += sizeof(this->event_type);
garyservin 0:9e9b7db60fd5 77 offset += this->pose.serialize(outbuffer + offset);
garyservin 0:9e9b7db60fd5 78 *(outbuffer + offset + 0) = (this->menu_entry_id >> (8 * 0)) & 0xFF;
garyservin 0:9e9b7db60fd5 79 *(outbuffer + offset + 1) = (this->menu_entry_id >> (8 * 1)) & 0xFF;
garyservin 0:9e9b7db60fd5 80 *(outbuffer + offset + 2) = (this->menu_entry_id >> (8 * 2)) & 0xFF;
garyservin 0:9e9b7db60fd5 81 *(outbuffer + offset + 3) = (this->menu_entry_id >> (8 * 3)) & 0xFF;
garyservin 0:9e9b7db60fd5 82 offset += sizeof(this->menu_entry_id);
garyservin 0:9e9b7db60fd5 83 offset += this->mouse_point.serialize(outbuffer + offset);
garyservin 0:9e9b7db60fd5 84 union {
garyservin 0:9e9b7db60fd5 85 bool real;
garyservin 0:9e9b7db60fd5 86 uint8_t base;
garyservin 0:9e9b7db60fd5 87 } u_mouse_point_valid;
garyservin 0:9e9b7db60fd5 88 u_mouse_point_valid.real = this->mouse_point_valid;
garyservin 0:9e9b7db60fd5 89 *(outbuffer + offset + 0) = (u_mouse_point_valid.base >> (8 * 0)) & 0xFF;
garyservin 0:9e9b7db60fd5 90 offset += sizeof(this->mouse_point_valid);
garyservin 0:9e9b7db60fd5 91 return offset;
garyservin 0:9e9b7db60fd5 92 }
garyservin 0:9e9b7db60fd5 93
garyservin 0:9e9b7db60fd5 94 virtual int deserialize(unsigned char *inbuffer)
garyservin 0:9e9b7db60fd5 95 {
garyservin 0:9e9b7db60fd5 96 int offset = 0;
garyservin 0:9e9b7db60fd5 97 offset += this->header.deserialize(inbuffer + offset);
garyservin 0:9e9b7db60fd5 98 uint32_t length_client_id;
garyservin 0:9e9b7db60fd5 99 arrToVar(length_client_id, (inbuffer + offset));
garyservin 0:9e9b7db60fd5 100 offset += 4;
garyservin 0:9e9b7db60fd5 101 for(unsigned int k= offset; k< offset+length_client_id; ++k){
garyservin 0:9e9b7db60fd5 102 inbuffer[k-1]=inbuffer[k];
garyservin 0:9e9b7db60fd5 103 }
garyservin 0:9e9b7db60fd5 104 inbuffer[offset+length_client_id-1]=0;
garyservin 0:9e9b7db60fd5 105 this->client_id = (char *)(inbuffer + offset-1);
garyservin 0:9e9b7db60fd5 106 offset += length_client_id;
garyservin 0:9e9b7db60fd5 107 uint32_t length_marker_name;
garyservin 0:9e9b7db60fd5 108 arrToVar(length_marker_name, (inbuffer + offset));
garyservin 0:9e9b7db60fd5 109 offset += 4;
garyservin 0:9e9b7db60fd5 110 for(unsigned int k= offset; k< offset+length_marker_name; ++k){
garyservin 0:9e9b7db60fd5 111 inbuffer[k-1]=inbuffer[k];
garyservin 0:9e9b7db60fd5 112 }
garyservin 0:9e9b7db60fd5 113 inbuffer[offset+length_marker_name-1]=0;
garyservin 0:9e9b7db60fd5 114 this->marker_name = (char *)(inbuffer + offset-1);
garyservin 0:9e9b7db60fd5 115 offset += length_marker_name;
garyservin 0:9e9b7db60fd5 116 uint32_t length_control_name;
garyservin 0:9e9b7db60fd5 117 arrToVar(length_control_name, (inbuffer + offset));
garyservin 0:9e9b7db60fd5 118 offset += 4;
garyservin 0:9e9b7db60fd5 119 for(unsigned int k= offset; k< offset+length_control_name; ++k){
garyservin 0:9e9b7db60fd5 120 inbuffer[k-1]=inbuffer[k];
garyservin 0:9e9b7db60fd5 121 }
garyservin 0:9e9b7db60fd5 122 inbuffer[offset+length_control_name-1]=0;
garyservin 0:9e9b7db60fd5 123 this->control_name = (char *)(inbuffer + offset-1);
garyservin 0:9e9b7db60fd5 124 offset += length_control_name;
garyservin 0:9e9b7db60fd5 125 this->event_type = ((uint8_t) (*(inbuffer + offset)));
garyservin 0:9e9b7db60fd5 126 offset += sizeof(this->event_type);
garyservin 0:9e9b7db60fd5 127 offset += this->pose.deserialize(inbuffer + offset);
garyservin 0:9e9b7db60fd5 128 this->menu_entry_id = ((uint32_t) (*(inbuffer + offset)));
garyservin 0:9e9b7db60fd5 129 this->menu_entry_id |= ((uint32_t) (*(inbuffer + offset + 1))) << (8 * 1);
garyservin 0:9e9b7db60fd5 130 this->menu_entry_id |= ((uint32_t) (*(inbuffer + offset + 2))) << (8 * 2);
garyservin 0:9e9b7db60fd5 131 this->menu_entry_id |= ((uint32_t) (*(inbuffer + offset + 3))) << (8 * 3);
garyservin 0:9e9b7db60fd5 132 offset += sizeof(this->menu_entry_id);
garyservin 0:9e9b7db60fd5 133 offset += this->mouse_point.deserialize(inbuffer + offset);
garyservin 0:9e9b7db60fd5 134 union {
garyservin 0:9e9b7db60fd5 135 bool real;
garyservin 0:9e9b7db60fd5 136 uint8_t base;
garyservin 0:9e9b7db60fd5 137 } u_mouse_point_valid;
garyservin 0:9e9b7db60fd5 138 u_mouse_point_valid.base = 0;
garyservin 0:9e9b7db60fd5 139 u_mouse_point_valid.base |= ((uint8_t) (*(inbuffer + offset + 0))) << (8 * 0);
garyservin 0:9e9b7db60fd5 140 this->mouse_point_valid = u_mouse_point_valid.real;
garyservin 0:9e9b7db60fd5 141 offset += sizeof(this->mouse_point_valid);
garyservin 0:9e9b7db60fd5 142 return offset;
garyservin 0:9e9b7db60fd5 143 }
garyservin 0:9e9b7db60fd5 144
garyservin 0:9e9b7db60fd5 145 const char * getType(){ return "visualization_msgs/InteractiveMarkerFeedback"; };
garyservin 0:9e9b7db60fd5 146 const char * getMD5(){ return "ab0f1eee058667e28c19ff3ffc3f4b78"; };
garyservin 0:9e9b7db60fd5 147
garyservin 0:9e9b7db60fd5 148 };
garyservin 0:9e9b7db60fd5 149
garyservin 0:9e9b7db60fd5 150 }
garyservin 0:9e9b7db60fd5 151 #endif