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
ROSSerial_mbed for Indigo Distribution
The Robot Operating System (ROS) is a flexible framework for writing robot software. It is a collection of tools, libraries, and conventions that aim to simplify the task of creating complex and robust robot behavior across a wide variety of robotic platforms.
The rosserial_mbed package allows to write ROS nodes on any mbed enabled devices and have them connected to a running ROS system on your computer using the serial port.
Hello World (example publisher)
Import programrosserial_mbed_hello_world_publisher
rosserial_mbed Hello World
Running the Code
Now, launch the roscore in a new terminal window:
Quote:
$ roscore
Next, run the rosserial client application that forwards your MBED messages to the rest of ROS. Make sure to use the correct serial port:
Quote:
$ rosrun rosserial_python serial_node.py /dev/ttyACM0
Finally, watch the greetings come in from your MBED by launching a new terminal window and entering :
Quote:
$ rostopic echo chatter
See Also
More examples
Blink
/* * rosserial Subscriber Example * Blinks an LED on callback */ #include "mbed.h" #include <ros.h> #include <std_msgs/Empty.h> ros::NodeHandle nh; DigitalOut myled(LED1); void messageCb(const std_msgs::Empty& toggle_msg){ myled = !myled; // blink the led } ros::Subscriber<std_msgs::Empty> sub("toggle_led", &messageCb); int main() { nh.initNode(); nh.subscribe(sub); while (1) { nh.spinOnce(); wait_ms(1); } }
Push
/* * Button Example for Rosserial */ #include "mbed.h" #include <ros.h> #include <std_msgs/Bool.h> PinName button = p20; ros::NodeHandle nh; std_msgs::Bool pushed_msg; ros::Publisher pub_button("pushed", &pushed_msg); DigitalIn button_pin(button); DigitalOut led_pin(LED1); bool last_reading; long last_debounce_time=0; long debounce_delay=50; bool published = true; Timer t; int main() { t.start(); nh.initNode(); nh.advertise(pub_button); //Enable the pullup resistor on the button button_pin.mode(PullUp); //The button is a normally button last_reading = ! button_pin; while (1) { bool reading = ! button_pin; if (last_reading!= reading) { last_debounce_time = t.read_ms(); published = false; } //if the button value has not changed for the debounce delay, we know its stable if ( !published && (t.read_ms() - last_debounce_time) > debounce_delay) { led_pin = reading; pushed_msg.data = reading; pub_button.publish(&pushed_msg); published = true; } last_reading = reading; nh.spinOnce(); } }
visualization_msgs/ImageMarker.h@0:fd24f7ca9688, 2016-03-31 (annotated)
- Committer:
- garyservin
- Date:
- Thu Mar 31 14:22:59 2016 +0000
- Revision:
- 0:fd24f7ca9688
Initial commit, generated based on a clean indigo-desktop-full
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
garyservin | 0:fd24f7ca9688 | 1 | #ifndef _ROS_visualization_msgs_ImageMarker_h |
garyservin | 0:fd24f7ca9688 | 2 | #define _ROS_visualization_msgs_ImageMarker_h |
garyservin | 0:fd24f7ca9688 | 3 | |
garyservin | 0:fd24f7ca9688 | 4 | #include <stdint.h> |
garyservin | 0:fd24f7ca9688 | 5 | #include <string.h> |
garyservin | 0:fd24f7ca9688 | 6 | #include <stdlib.h> |
garyservin | 0:fd24f7ca9688 | 7 | #include "ros/msg.h" |
garyservin | 0:fd24f7ca9688 | 8 | #include "std_msgs/Header.h" |
garyservin | 0:fd24f7ca9688 | 9 | #include "geometry_msgs/Point.h" |
garyservin | 0:fd24f7ca9688 | 10 | #include "std_msgs/ColorRGBA.h" |
garyservin | 0:fd24f7ca9688 | 11 | #include "ros/duration.h" |
garyservin | 0:fd24f7ca9688 | 12 | |
garyservin | 0:fd24f7ca9688 | 13 | namespace visualization_msgs |
garyservin | 0:fd24f7ca9688 | 14 | { |
garyservin | 0:fd24f7ca9688 | 15 | |
garyservin | 0:fd24f7ca9688 | 16 | class ImageMarker : public ros::Msg |
garyservin | 0:fd24f7ca9688 | 17 | { |
garyservin | 0:fd24f7ca9688 | 18 | public: |
garyservin | 0:fd24f7ca9688 | 19 | std_msgs::Header header; |
garyservin | 0:fd24f7ca9688 | 20 | const char* ns; |
garyservin | 0:fd24f7ca9688 | 21 | int32_t id; |
garyservin | 0:fd24f7ca9688 | 22 | int32_t type; |
garyservin | 0:fd24f7ca9688 | 23 | int32_t action; |
garyservin | 0:fd24f7ca9688 | 24 | geometry_msgs::Point position; |
garyservin | 0:fd24f7ca9688 | 25 | float scale; |
garyservin | 0:fd24f7ca9688 | 26 | std_msgs::ColorRGBA outline_color; |
garyservin | 0:fd24f7ca9688 | 27 | uint8_t filled; |
garyservin | 0:fd24f7ca9688 | 28 | std_msgs::ColorRGBA fill_color; |
garyservin | 0:fd24f7ca9688 | 29 | ros::Duration lifetime; |
garyservin | 0:fd24f7ca9688 | 30 | uint8_t points_length; |
garyservin | 0:fd24f7ca9688 | 31 | geometry_msgs::Point st_points; |
garyservin | 0:fd24f7ca9688 | 32 | geometry_msgs::Point * points; |
garyservin | 0:fd24f7ca9688 | 33 | uint8_t outline_colors_length; |
garyservin | 0:fd24f7ca9688 | 34 | std_msgs::ColorRGBA st_outline_colors; |
garyservin | 0:fd24f7ca9688 | 35 | std_msgs::ColorRGBA * outline_colors; |
garyservin | 0:fd24f7ca9688 | 36 | enum { CIRCLE = 0 }; |
garyservin | 0:fd24f7ca9688 | 37 | enum { LINE_STRIP = 1 }; |
garyservin | 0:fd24f7ca9688 | 38 | enum { LINE_LIST = 2 }; |
garyservin | 0:fd24f7ca9688 | 39 | enum { POLYGON = 3 }; |
garyservin | 0:fd24f7ca9688 | 40 | enum { POINTS = 4 }; |
garyservin | 0:fd24f7ca9688 | 41 | enum { ADD = 0 }; |
garyservin | 0:fd24f7ca9688 | 42 | enum { REMOVE = 1 }; |
garyservin | 0:fd24f7ca9688 | 43 | |
garyservin | 0:fd24f7ca9688 | 44 | ImageMarker(): |
garyservin | 0:fd24f7ca9688 | 45 | header(), |
garyservin | 0:fd24f7ca9688 | 46 | ns(""), |
garyservin | 0:fd24f7ca9688 | 47 | id(0), |
garyservin | 0:fd24f7ca9688 | 48 | type(0), |
garyservin | 0:fd24f7ca9688 | 49 | action(0), |
garyservin | 0:fd24f7ca9688 | 50 | position(), |
garyservin | 0:fd24f7ca9688 | 51 | scale(0), |
garyservin | 0:fd24f7ca9688 | 52 | outline_color(), |
garyservin | 0:fd24f7ca9688 | 53 | filled(0), |
garyservin | 0:fd24f7ca9688 | 54 | fill_color(), |
garyservin | 0:fd24f7ca9688 | 55 | lifetime(), |
garyservin | 0:fd24f7ca9688 | 56 | points_length(0), points(NULL), |
garyservin | 0:fd24f7ca9688 | 57 | outline_colors_length(0), outline_colors(NULL) |
garyservin | 0:fd24f7ca9688 | 58 | { |
garyservin | 0:fd24f7ca9688 | 59 | } |
garyservin | 0:fd24f7ca9688 | 60 | |
garyservin | 0:fd24f7ca9688 | 61 | virtual int serialize(unsigned char *outbuffer) const |
garyservin | 0:fd24f7ca9688 | 62 | { |
garyservin | 0:fd24f7ca9688 | 63 | int offset = 0; |
garyservin | 0:fd24f7ca9688 | 64 | offset += this->header.serialize(outbuffer + offset); |
garyservin | 0:fd24f7ca9688 | 65 | uint32_t length_ns = strlen(this->ns); |
garyservin | 0:fd24f7ca9688 | 66 | memcpy(outbuffer + offset, &length_ns, sizeof(uint32_t)); |
garyservin | 0:fd24f7ca9688 | 67 | offset += 4; |
garyservin | 0:fd24f7ca9688 | 68 | memcpy(outbuffer + offset, this->ns, length_ns); |
garyservin | 0:fd24f7ca9688 | 69 | offset += length_ns; |
garyservin | 0:fd24f7ca9688 | 70 | union { |
garyservin | 0:fd24f7ca9688 | 71 | int32_t real; |
garyservin | 0:fd24f7ca9688 | 72 | uint32_t base; |
garyservin | 0:fd24f7ca9688 | 73 | } u_id; |
garyservin | 0:fd24f7ca9688 | 74 | u_id.real = this->id; |
garyservin | 0:fd24f7ca9688 | 75 | *(outbuffer + offset + 0) = (u_id.base >> (8 * 0)) & 0xFF; |
garyservin | 0:fd24f7ca9688 | 76 | *(outbuffer + offset + 1) = (u_id.base >> (8 * 1)) & 0xFF; |
garyservin | 0:fd24f7ca9688 | 77 | *(outbuffer + offset + 2) = (u_id.base >> (8 * 2)) & 0xFF; |
garyservin | 0:fd24f7ca9688 | 78 | *(outbuffer + offset + 3) = (u_id.base >> (8 * 3)) & 0xFF; |
garyservin | 0:fd24f7ca9688 | 79 | offset += sizeof(this->id); |
garyservin | 0:fd24f7ca9688 | 80 | union { |
garyservin | 0:fd24f7ca9688 | 81 | int32_t real; |
garyservin | 0:fd24f7ca9688 | 82 | uint32_t base; |
garyservin | 0:fd24f7ca9688 | 83 | } u_type; |
garyservin | 0:fd24f7ca9688 | 84 | u_type.real = this->type; |
garyservin | 0:fd24f7ca9688 | 85 | *(outbuffer + offset + 0) = (u_type.base >> (8 * 0)) & 0xFF; |
garyservin | 0:fd24f7ca9688 | 86 | *(outbuffer + offset + 1) = (u_type.base >> (8 * 1)) & 0xFF; |
garyservin | 0:fd24f7ca9688 | 87 | *(outbuffer + offset + 2) = (u_type.base >> (8 * 2)) & 0xFF; |
garyservin | 0:fd24f7ca9688 | 88 | *(outbuffer + offset + 3) = (u_type.base >> (8 * 3)) & 0xFF; |
garyservin | 0:fd24f7ca9688 | 89 | offset += sizeof(this->type); |
garyservin | 0:fd24f7ca9688 | 90 | union { |
garyservin | 0:fd24f7ca9688 | 91 | int32_t real; |
garyservin | 0:fd24f7ca9688 | 92 | uint32_t base; |
garyservin | 0:fd24f7ca9688 | 93 | } u_action; |
garyservin | 0:fd24f7ca9688 | 94 | u_action.real = this->action; |
garyservin | 0:fd24f7ca9688 | 95 | *(outbuffer + offset + 0) = (u_action.base >> (8 * 0)) & 0xFF; |
garyservin | 0:fd24f7ca9688 | 96 | *(outbuffer + offset + 1) = (u_action.base >> (8 * 1)) & 0xFF; |
garyservin | 0:fd24f7ca9688 | 97 | *(outbuffer + offset + 2) = (u_action.base >> (8 * 2)) & 0xFF; |
garyservin | 0:fd24f7ca9688 | 98 | *(outbuffer + offset + 3) = (u_action.base >> (8 * 3)) & 0xFF; |
garyservin | 0:fd24f7ca9688 | 99 | offset += sizeof(this->action); |
garyservin | 0:fd24f7ca9688 | 100 | offset += this->position.serialize(outbuffer + offset); |
garyservin | 0:fd24f7ca9688 | 101 | union { |
garyservin | 0:fd24f7ca9688 | 102 | float real; |
garyservin | 0:fd24f7ca9688 | 103 | uint32_t base; |
garyservin | 0:fd24f7ca9688 | 104 | } u_scale; |
garyservin | 0:fd24f7ca9688 | 105 | u_scale.real = this->scale; |
garyservin | 0:fd24f7ca9688 | 106 | *(outbuffer + offset + 0) = (u_scale.base >> (8 * 0)) & 0xFF; |
garyservin | 0:fd24f7ca9688 | 107 | *(outbuffer + offset + 1) = (u_scale.base >> (8 * 1)) & 0xFF; |
garyservin | 0:fd24f7ca9688 | 108 | *(outbuffer + offset + 2) = (u_scale.base >> (8 * 2)) & 0xFF; |
garyservin | 0:fd24f7ca9688 | 109 | *(outbuffer + offset + 3) = (u_scale.base >> (8 * 3)) & 0xFF; |
garyservin | 0:fd24f7ca9688 | 110 | offset += sizeof(this->scale); |
garyservin | 0:fd24f7ca9688 | 111 | offset += this->outline_color.serialize(outbuffer + offset); |
garyservin | 0:fd24f7ca9688 | 112 | *(outbuffer + offset + 0) = (this->filled >> (8 * 0)) & 0xFF; |
garyservin | 0:fd24f7ca9688 | 113 | offset += sizeof(this->filled); |
garyservin | 0:fd24f7ca9688 | 114 | offset += this->fill_color.serialize(outbuffer + offset); |
garyservin | 0:fd24f7ca9688 | 115 | *(outbuffer + offset + 0) = (this->lifetime.sec >> (8 * 0)) & 0xFF; |
garyservin | 0:fd24f7ca9688 | 116 | *(outbuffer + offset + 1) = (this->lifetime.sec >> (8 * 1)) & 0xFF; |
garyservin | 0:fd24f7ca9688 | 117 | *(outbuffer + offset + 2) = (this->lifetime.sec >> (8 * 2)) & 0xFF; |
garyservin | 0:fd24f7ca9688 | 118 | *(outbuffer + offset + 3) = (this->lifetime.sec >> (8 * 3)) & 0xFF; |
garyservin | 0:fd24f7ca9688 | 119 | offset += sizeof(this->lifetime.sec); |
garyservin | 0:fd24f7ca9688 | 120 | *(outbuffer + offset + 0) = (this->lifetime.nsec >> (8 * 0)) & 0xFF; |
garyservin | 0:fd24f7ca9688 | 121 | *(outbuffer + offset + 1) = (this->lifetime.nsec >> (8 * 1)) & 0xFF; |
garyservin | 0:fd24f7ca9688 | 122 | *(outbuffer + offset + 2) = (this->lifetime.nsec >> (8 * 2)) & 0xFF; |
garyservin | 0:fd24f7ca9688 | 123 | *(outbuffer + offset + 3) = (this->lifetime.nsec >> (8 * 3)) & 0xFF; |
garyservin | 0:fd24f7ca9688 | 124 | offset += sizeof(this->lifetime.nsec); |
garyservin | 0:fd24f7ca9688 | 125 | *(outbuffer + offset++) = points_length; |
garyservin | 0:fd24f7ca9688 | 126 | *(outbuffer + offset++) = 0; |
garyservin | 0:fd24f7ca9688 | 127 | *(outbuffer + offset++) = 0; |
garyservin | 0:fd24f7ca9688 | 128 | *(outbuffer + offset++) = 0; |
garyservin | 0:fd24f7ca9688 | 129 | for( uint8_t i = 0; i < points_length; i++){ |
garyservin | 0:fd24f7ca9688 | 130 | offset += this->points[i].serialize(outbuffer + offset); |
garyservin | 0:fd24f7ca9688 | 131 | } |
garyservin | 0:fd24f7ca9688 | 132 | *(outbuffer + offset++) = outline_colors_length; |
garyservin | 0:fd24f7ca9688 | 133 | *(outbuffer + offset++) = 0; |
garyservin | 0:fd24f7ca9688 | 134 | *(outbuffer + offset++) = 0; |
garyservin | 0:fd24f7ca9688 | 135 | *(outbuffer + offset++) = 0; |
garyservin | 0:fd24f7ca9688 | 136 | for( uint8_t i = 0; i < outline_colors_length; i++){ |
garyservin | 0:fd24f7ca9688 | 137 | offset += this->outline_colors[i].serialize(outbuffer + offset); |
garyservin | 0:fd24f7ca9688 | 138 | } |
garyservin | 0:fd24f7ca9688 | 139 | return offset; |
garyservin | 0:fd24f7ca9688 | 140 | } |
garyservin | 0:fd24f7ca9688 | 141 | |
garyservin | 0:fd24f7ca9688 | 142 | virtual int deserialize(unsigned char *inbuffer) |
garyservin | 0:fd24f7ca9688 | 143 | { |
garyservin | 0:fd24f7ca9688 | 144 | int offset = 0; |
garyservin | 0:fd24f7ca9688 | 145 | offset += this->header.deserialize(inbuffer + offset); |
garyservin | 0:fd24f7ca9688 | 146 | uint32_t length_ns; |
garyservin | 0:fd24f7ca9688 | 147 | memcpy(&length_ns, (inbuffer + offset), sizeof(uint32_t)); |
garyservin | 0:fd24f7ca9688 | 148 | offset += 4; |
garyservin | 0:fd24f7ca9688 | 149 | for(unsigned int k= offset; k< offset+length_ns; ++k){ |
garyservin | 0:fd24f7ca9688 | 150 | inbuffer[k-1]=inbuffer[k]; |
garyservin | 0:fd24f7ca9688 | 151 | } |
garyservin | 0:fd24f7ca9688 | 152 | inbuffer[offset+length_ns-1]=0; |
garyservin | 0:fd24f7ca9688 | 153 | this->ns = (char *)(inbuffer + offset-1); |
garyservin | 0:fd24f7ca9688 | 154 | offset += length_ns; |
garyservin | 0:fd24f7ca9688 | 155 | union { |
garyservin | 0:fd24f7ca9688 | 156 | int32_t real; |
garyservin | 0:fd24f7ca9688 | 157 | uint32_t base; |
garyservin | 0:fd24f7ca9688 | 158 | } u_id; |
garyservin | 0:fd24f7ca9688 | 159 | u_id.base = 0; |
garyservin | 0:fd24f7ca9688 | 160 | u_id.base |= ((uint32_t) (*(inbuffer + offset + 0))) << (8 * 0); |
garyservin | 0:fd24f7ca9688 | 161 | u_id.base |= ((uint32_t) (*(inbuffer + offset + 1))) << (8 * 1); |
garyservin | 0:fd24f7ca9688 | 162 | u_id.base |= ((uint32_t) (*(inbuffer + offset + 2))) << (8 * 2); |
garyservin | 0:fd24f7ca9688 | 163 | u_id.base |= ((uint32_t) (*(inbuffer + offset + 3))) << (8 * 3); |
garyservin | 0:fd24f7ca9688 | 164 | this->id = u_id.real; |
garyservin | 0:fd24f7ca9688 | 165 | offset += sizeof(this->id); |
garyservin | 0:fd24f7ca9688 | 166 | union { |
garyservin | 0:fd24f7ca9688 | 167 | int32_t real; |
garyservin | 0:fd24f7ca9688 | 168 | uint32_t base; |
garyservin | 0:fd24f7ca9688 | 169 | } u_type; |
garyservin | 0:fd24f7ca9688 | 170 | u_type.base = 0; |
garyservin | 0:fd24f7ca9688 | 171 | u_type.base |= ((uint32_t) (*(inbuffer + offset + 0))) << (8 * 0); |
garyservin | 0:fd24f7ca9688 | 172 | u_type.base |= ((uint32_t) (*(inbuffer + offset + 1))) << (8 * 1); |
garyservin | 0:fd24f7ca9688 | 173 | u_type.base |= ((uint32_t) (*(inbuffer + offset + 2))) << (8 * 2); |
garyservin | 0:fd24f7ca9688 | 174 | u_type.base |= ((uint32_t) (*(inbuffer + offset + 3))) << (8 * 3); |
garyservin | 0:fd24f7ca9688 | 175 | this->type = u_type.real; |
garyservin | 0:fd24f7ca9688 | 176 | offset += sizeof(this->type); |
garyservin | 0:fd24f7ca9688 | 177 | union { |
garyservin | 0:fd24f7ca9688 | 178 | int32_t real; |
garyservin | 0:fd24f7ca9688 | 179 | uint32_t base; |
garyservin | 0:fd24f7ca9688 | 180 | } u_action; |
garyservin | 0:fd24f7ca9688 | 181 | u_action.base = 0; |
garyservin | 0:fd24f7ca9688 | 182 | u_action.base |= ((uint32_t) (*(inbuffer + offset + 0))) << (8 * 0); |
garyservin | 0:fd24f7ca9688 | 183 | u_action.base |= ((uint32_t) (*(inbuffer + offset + 1))) << (8 * 1); |
garyservin | 0:fd24f7ca9688 | 184 | u_action.base |= ((uint32_t) (*(inbuffer + offset + 2))) << (8 * 2); |
garyservin | 0:fd24f7ca9688 | 185 | u_action.base |= ((uint32_t) (*(inbuffer + offset + 3))) << (8 * 3); |
garyservin | 0:fd24f7ca9688 | 186 | this->action = u_action.real; |
garyservin | 0:fd24f7ca9688 | 187 | offset += sizeof(this->action); |
garyservin | 0:fd24f7ca9688 | 188 | offset += this->position.deserialize(inbuffer + offset); |
garyservin | 0:fd24f7ca9688 | 189 | union { |
garyservin | 0:fd24f7ca9688 | 190 | float real; |
garyservin | 0:fd24f7ca9688 | 191 | uint32_t base; |
garyservin | 0:fd24f7ca9688 | 192 | } u_scale; |
garyservin | 0:fd24f7ca9688 | 193 | u_scale.base = 0; |
garyservin | 0:fd24f7ca9688 | 194 | u_scale.base |= ((uint32_t) (*(inbuffer + offset + 0))) << (8 * 0); |
garyservin | 0:fd24f7ca9688 | 195 | u_scale.base |= ((uint32_t) (*(inbuffer + offset + 1))) << (8 * 1); |
garyservin | 0:fd24f7ca9688 | 196 | u_scale.base |= ((uint32_t) (*(inbuffer + offset + 2))) << (8 * 2); |
garyservin | 0:fd24f7ca9688 | 197 | u_scale.base |= ((uint32_t) (*(inbuffer + offset + 3))) << (8 * 3); |
garyservin | 0:fd24f7ca9688 | 198 | this->scale = u_scale.real; |
garyservin | 0:fd24f7ca9688 | 199 | offset += sizeof(this->scale); |
garyservin | 0:fd24f7ca9688 | 200 | offset += this->outline_color.deserialize(inbuffer + offset); |
garyservin | 0:fd24f7ca9688 | 201 | this->filled = ((uint8_t) (*(inbuffer + offset))); |
garyservin | 0:fd24f7ca9688 | 202 | offset += sizeof(this->filled); |
garyservin | 0:fd24f7ca9688 | 203 | offset += this->fill_color.deserialize(inbuffer + offset); |
garyservin | 0:fd24f7ca9688 | 204 | this->lifetime.sec = ((uint32_t) (*(inbuffer + offset))); |
garyservin | 0:fd24f7ca9688 | 205 | this->lifetime.sec |= ((uint32_t) (*(inbuffer + offset + 1))) << (8 * 1); |
garyservin | 0:fd24f7ca9688 | 206 | this->lifetime.sec |= ((uint32_t) (*(inbuffer + offset + 2))) << (8 * 2); |
garyservin | 0:fd24f7ca9688 | 207 | this->lifetime.sec |= ((uint32_t) (*(inbuffer + offset + 3))) << (8 * 3); |
garyservin | 0:fd24f7ca9688 | 208 | offset += sizeof(this->lifetime.sec); |
garyservin | 0:fd24f7ca9688 | 209 | this->lifetime.nsec = ((uint32_t) (*(inbuffer + offset))); |
garyservin | 0:fd24f7ca9688 | 210 | this->lifetime.nsec |= ((uint32_t) (*(inbuffer + offset + 1))) << (8 * 1); |
garyservin | 0:fd24f7ca9688 | 211 | this->lifetime.nsec |= ((uint32_t) (*(inbuffer + offset + 2))) << (8 * 2); |
garyservin | 0:fd24f7ca9688 | 212 | this->lifetime.nsec |= ((uint32_t) (*(inbuffer + offset + 3))) << (8 * 3); |
garyservin | 0:fd24f7ca9688 | 213 | offset += sizeof(this->lifetime.nsec); |
garyservin | 0:fd24f7ca9688 | 214 | uint8_t points_lengthT = *(inbuffer + offset++); |
garyservin | 0:fd24f7ca9688 | 215 | if(points_lengthT > points_length) |
garyservin | 0:fd24f7ca9688 | 216 | this->points = (geometry_msgs::Point*)realloc(this->points, points_lengthT * sizeof(geometry_msgs::Point)); |
garyservin | 0:fd24f7ca9688 | 217 | offset += 3; |
garyservin | 0:fd24f7ca9688 | 218 | points_length = points_lengthT; |
garyservin | 0:fd24f7ca9688 | 219 | for( uint8_t i = 0; i < points_length; i++){ |
garyservin | 0:fd24f7ca9688 | 220 | offset += this->st_points.deserialize(inbuffer + offset); |
garyservin | 0:fd24f7ca9688 | 221 | memcpy( &(this->points[i]), &(this->st_points), sizeof(geometry_msgs::Point)); |
garyservin | 0:fd24f7ca9688 | 222 | } |
garyservin | 0:fd24f7ca9688 | 223 | uint8_t outline_colors_lengthT = *(inbuffer + offset++); |
garyservin | 0:fd24f7ca9688 | 224 | if(outline_colors_lengthT > outline_colors_length) |
garyservin | 0:fd24f7ca9688 | 225 | this->outline_colors = (std_msgs::ColorRGBA*)realloc(this->outline_colors, outline_colors_lengthT * sizeof(std_msgs::ColorRGBA)); |
garyservin | 0:fd24f7ca9688 | 226 | offset += 3; |
garyservin | 0:fd24f7ca9688 | 227 | outline_colors_length = outline_colors_lengthT; |
garyservin | 0:fd24f7ca9688 | 228 | for( uint8_t i = 0; i < outline_colors_length; i++){ |
garyservin | 0:fd24f7ca9688 | 229 | offset += this->st_outline_colors.deserialize(inbuffer + offset); |
garyservin | 0:fd24f7ca9688 | 230 | memcpy( &(this->outline_colors[i]), &(this->st_outline_colors), sizeof(std_msgs::ColorRGBA)); |
garyservin | 0:fd24f7ca9688 | 231 | } |
garyservin | 0:fd24f7ca9688 | 232 | return offset; |
garyservin | 0:fd24f7ca9688 | 233 | } |
garyservin | 0:fd24f7ca9688 | 234 | |
garyservin | 0:fd24f7ca9688 | 235 | const char * getType(){ return "visualization_msgs/ImageMarker"; }; |
garyservin | 0:fd24f7ca9688 | 236 | const char * getMD5(){ return "1de93c67ec8858b831025a08fbf1b35c"; }; |
garyservin | 0:fd24f7ca9688 | 237 | |
garyservin | 0:fd24f7ca9688 | 238 | }; |
garyservin | 0:fd24f7ca9688 | 239 | |
garyservin | 0:fd24f7ca9688 | 240 | } |
garyservin | 0:fd24f7ca9688 | 241 | #endif |