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

Dependencies:   BufferedSerial

Dependents:   rosserial_mbed_hello_world_publisher_melodic Motortest Nucleo_vr_servo_project NucleoFM ... more

ROSSerial_mbed for Melodic 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_melodic

rosserial_mbed Hello World example for Melodic Morenia distribution

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();
    }
}
Committer:
Gary Servin
Date:
Fri Nov 08 14:55:04 2019 -0300
Revision:
1:da82487f547e
Parent:
0:04ac6be8229a
Add missing round() method

Who changed what in which revision?

UserRevisionLine numberNew contents of line
Gary Servin 0:04ac6be8229a 1 #ifndef _ROS_visualization_msgs_Marker_h
Gary Servin 0:04ac6be8229a 2 #define _ROS_visualization_msgs_Marker_h
Gary Servin 0:04ac6be8229a 3
Gary Servin 0:04ac6be8229a 4 #include <stdint.h>
Gary Servin 0:04ac6be8229a 5 #include <string.h>
Gary Servin 0:04ac6be8229a 6 #include <stdlib.h>
Gary Servin 0:04ac6be8229a 7 #include "ros/msg.h"
Gary Servin 0:04ac6be8229a 8 #include "std_msgs/Header.h"
Gary Servin 0:04ac6be8229a 9 #include "geometry_msgs/Pose.h"
Gary Servin 0:04ac6be8229a 10 #include "geometry_msgs/Vector3.h"
Gary Servin 0:04ac6be8229a 11 #include "std_msgs/ColorRGBA.h"
Gary Servin 0:04ac6be8229a 12 #include "ros/duration.h"
Gary Servin 0:04ac6be8229a 13 #include "geometry_msgs/Point.h"
Gary Servin 0:04ac6be8229a 14
Gary Servin 0:04ac6be8229a 15 namespace visualization_msgs
Gary Servin 0:04ac6be8229a 16 {
Gary Servin 0:04ac6be8229a 17
Gary Servin 0:04ac6be8229a 18 class Marker : public ros::Msg
Gary Servin 0:04ac6be8229a 19 {
Gary Servin 0:04ac6be8229a 20 public:
Gary Servin 0:04ac6be8229a 21 typedef std_msgs::Header _header_type;
Gary Servin 0:04ac6be8229a 22 _header_type header;
Gary Servin 0:04ac6be8229a 23 typedef const char* _ns_type;
Gary Servin 0:04ac6be8229a 24 _ns_type ns;
Gary Servin 0:04ac6be8229a 25 typedef int32_t _id_type;
Gary Servin 0:04ac6be8229a 26 _id_type id;
Gary Servin 0:04ac6be8229a 27 typedef int32_t _type_type;
Gary Servin 0:04ac6be8229a 28 _type_type type;
Gary Servin 0:04ac6be8229a 29 typedef int32_t _action_type;
Gary Servin 0:04ac6be8229a 30 _action_type action;
Gary Servin 0:04ac6be8229a 31 typedef geometry_msgs::Pose _pose_type;
Gary Servin 0:04ac6be8229a 32 _pose_type pose;
Gary Servin 0:04ac6be8229a 33 typedef geometry_msgs::Vector3 _scale_type;
Gary Servin 0:04ac6be8229a 34 _scale_type scale;
Gary Servin 0:04ac6be8229a 35 typedef std_msgs::ColorRGBA _color_type;
Gary Servin 0:04ac6be8229a 36 _color_type color;
Gary Servin 0:04ac6be8229a 37 typedef ros::Duration _lifetime_type;
Gary Servin 0:04ac6be8229a 38 _lifetime_type lifetime;
Gary Servin 0:04ac6be8229a 39 typedef bool _frame_locked_type;
Gary Servin 0:04ac6be8229a 40 _frame_locked_type frame_locked;
Gary Servin 0:04ac6be8229a 41 uint32_t points_length;
Gary Servin 0:04ac6be8229a 42 typedef geometry_msgs::Point _points_type;
Gary Servin 0:04ac6be8229a 43 _points_type st_points;
Gary Servin 0:04ac6be8229a 44 _points_type * points;
Gary Servin 0:04ac6be8229a 45 uint32_t colors_length;
Gary Servin 0:04ac6be8229a 46 typedef std_msgs::ColorRGBA _colors_type;
Gary Servin 0:04ac6be8229a 47 _colors_type st_colors;
Gary Servin 0:04ac6be8229a 48 _colors_type * colors;
Gary Servin 0:04ac6be8229a 49 typedef const char* _text_type;
Gary Servin 0:04ac6be8229a 50 _text_type text;
Gary Servin 0:04ac6be8229a 51 typedef const char* _mesh_resource_type;
Gary Servin 0:04ac6be8229a 52 _mesh_resource_type mesh_resource;
Gary Servin 0:04ac6be8229a 53 typedef bool _mesh_use_embedded_materials_type;
Gary Servin 0:04ac6be8229a 54 _mesh_use_embedded_materials_type mesh_use_embedded_materials;
Gary Servin 0:04ac6be8229a 55 enum { ARROW = 0 };
Gary Servin 0:04ac6be8229a 56 enum { CUBE = 1 };
Gary Servin 0:04ac6be8229a 57 enum { SPHERE = 2 };
Gary Servin 0:04ac6be8229a 58 enum { CYLINDER = 3 };
Gary Servin 0:04ac6be8229a 59 enum { LINE_STRIP = 4 };
Gary Servin 0:04ac6be8229a 60 enum { LINE_LIST = 5 };
Gary Servin 0:04ac6be8229a 61 enum { CUBE_LIST = 6 };
Gary Servin 0:04ac6be8229a 62 enum { SPHERE_LIST = 7 };
Gary Servin 0:04ac6be8229a 63 enum { POINTS = 8 };
Gary Servin 0:04ac6be8229a 64 enum { TEXT_VIEW_FACING = 9 };
Gary Servin 0:04ac6be8229a 65 enum { MESH_RESOURCE = 10 };
Gary Servin 0:04ac6be8229a 66 enum { TRIANGLE_LIST = 11 };
Gary Servin 0:04ac6be8229a 67 enum { ADD = 0 };
Gary Servin 0:04ac6be8229a 68 enum { MODIFY = 0 };
Gary Servin 0:04ac6be8229a 69 enum { DELETE = 2 };
Gary Servin 0:04ac6be8229a 70 enum { DELETEALL = 3 };
Gary Servin 0:04ac6be8229a 71
Gary Servin 0:04ac6be8229a 72 Marker():
Gary Servin 0:04ac6be8229a 73 header(),
Gary Servin 0:04ac6be8229a 74 ns(""),
Gary Servin 0:04ac6be8229a 75 id(0),
Gary Servin 0:04ac6be8229a 76 type(0),
Gary Servin 0:04ac6be8229a 77 action(0),
Gary Servin 0:04ac6be8229a 78 pose(),
Gary Servin 0:04ac6be8229a 79 scale(),
Gary Servin 0:04ac6be8229a 80 color(),
Gary Servin 0:04ac6be8229a 81 lifetime(),
Gary Servin 0:04ac6be8229a 82 frame_locked(0),
Gary Servin 0:04ac6be8229a 83 points_length(0), points(NULL),
Gary Servin 0:04ac6be8229a 84 colors_length(0), colors(NULL),
Gary Servin 0:04ac6be8229a 85 text(""),
Gary Servin 0:04ac6be8229a 86 mesh_resource(""),
Gary Servin 0:04ac6be8229a 87 mesh_use_embedded_materials(0)
Gary Servin 0:04ac6be8229a 88 {
Gary Servin 0:04ac6be8229a 89 }
Gary Servin 0:04ac6be8229a 90
Gary Servin 0:04ac6be8229a 91 virtual int serialize(unsigned char *outbuffer) const
Gary Servin 0:04ac6be8229a 92 {
Gary Servin 0:04ac6be8229a 93 int offset = 0;
Gary Servin 0:04ac6be8229a 94 offset += this->header.serialize(outbuffer + offset);
Gary Servin 0:04ac6be8229a 95 uint32_t length_ns = strlen(this->ns);
Gary Servin 0:04ac6be8229a 96 varToArr(outbuffer + offset, length_ns);
Gary Servin 0:04ac6be8229a 97 offset += 4;
Gary Servin 0:04ac6be8229a 98 memcpy(outbuffer + offset, this->ns, length_ns);
Gary Servin 0:04ac6be8229a 99 offset += length_ns;
Gary Servin 0:04ac6be8229a 100 union {
Gary Servin 0:04ac6be8229a 101 int32_t real;
Gary Servin 0:04ac6be8229a 102 uint32_t base;
Gary Servin 0:04ac6be8229a 103 } u_id;
Gary Servin 0:04ac6be8229a 104 u_id.real = this->id;
Gary Servin 0:04ac6be8229a 105 *(outbuffer + offset + 0) = (u_id.base >> (8 * 0)) & 0xFF;
Gary Servin 0:04ac6be8229a 106 *(outbuffer + offset + 1) = (u_id.base >> (8 * 1)) & 0xFF;
Gary Servin 0:04ac6be8229a 107 *(outbuffer + offset + 2) = (u_id.base >> (8 * 2)) & 0xFF;
Gary Servin 0:04ac6be8229a 108 *(outbuffer + offset + 3) = (u_id.base >> (8 * 3)) & 0xFF;
Gary Servin 0:04ac6be8229a 109 offset += sizeof(this->id);
Gary Servin 0:04ac6be8229a 110 union {
Gary Servin 0:04ac6be8229a 111 int32_t real;
Gary Servin 0:04ac6be8229a 112 uint32_t base;
Gary Servin 0:04ac6be8229a 113 } u_type;
Gary Servin 0:04ac6be8229a 114 u_type.real = this->type;
Gary Servin 0:04ac6be8229a 115 *(outbuffer + offset + 0) = (u_type.base >> (8 * 0)) & 0xFF;
Gary Servin 0:04ac6be8229a 116 *(outbuffer + offset + 1) = (u_type.base >> (8 * 1)) & 0xFF;
Gary Servin 0:04ac6be8229a 117 *(outbuffer + offset + 2) = (u_type.base >> (8 * 2)) & 0xFF;
Gary Servin 0:04ac6be8229a 118 *(outbuffer + offset + 3) = (u_type.base >> (8 * 3)) & 0xFF;
Gary Servin 0:04ac6be8229a 119 offset += sizeof(this->type);
Gary Servin 0:04ac6be8229a 120 union {
Gary Servin 0:04ac6be8229a 121 int32_t real;
Gary Servin 0:04ac6be8229a 122 uint32_t base;
Gary Servin 0:04ac6be8229a 123 } u_action;
Gary Servin 0:04ac6be8229a 124 u_action.real = this->action;
Gary Servin 0:04ac6be8229a 125 *(outbuffer + offset + 0) = (u_action.base >> (8 * 0)) & 0xFF;
Gary Servin 0:04ac6be8229a 126 *(outbuffer + offset + 1) = (u_action.base >> (8 * 1)) & 0xFF;
Gary Servin 0:04ac6be8229a 127 *(outbuffer + offset + 2) = (u_action.base >> (8 * 2)) & 0xFF;
Gary Servin 0:04ac6be8229a 128 *(outbuffer + offset + 3) = (u_action.base >> (8 * 3)) & 0xFF;
Gary Servin 0:04ac6be8229a 129 offset += sizeof(this->action);
Gary Servin 0:04ac6be8229a 130 offset += this->pose.serialize(outbuffer + offset);
Gary Servin 0:04ac6be8229a 131 offset += this->scale.serialize(outbuffer + offset);
Gary Servin 0:04ac6be8229a 132 offset += this->color.serialize(outbuffer + offset);
Gary Servin 0:04ac6be8229a 133 *(outbuffer + offset + 0) = (this->lifetime.sec >> (8 * 0)) & 0xFF;
Gary Servin 0:04ac6be8229a 134 *(outbuffer + offset + 1) = (this->lifetime.sec >> (8 * 1)) & 0xFF;
Gary Servin 0:04ac6be8229a 135 *(outbuffer + offset + 2) = (this->lifetime.sec >> (8 * 2)) & 0xFF;
Gary Servin 0:04ac6be8229a 136 *(outbuffer + offset + 3) = (this->lifetime.sec >> (8 * 3)) & 0xFF;
Gary Servin 0:04ac6be8229a 137 offset += sizeof(this->lifetime.sec);
Gary Servin 0:04ac6be8229a 138 *(outbuffer + offset + 0) = (this->lifetime.nsec >> (8 * 0)) & 0xFF;
Gary Servin 0:04ac6be8229a 139 *(outbuffer + offset + 1) = (this->lifetime.nsec >> (8 * 1)) & 0xFF;
Gary Servin 0:04ac6be8229a 140 *(outbuffer + offset + 2) = (this->lifetime.nsec >> (8 * 2)) & 0xFF;
Gary Servin 0:04ac6be8229a 141 *(outbuffer + offset + 3) = (this->lifetime.nsec >> (8 * 3)) & 0xFF;
Gary Servin 0:04ac6be8229a 142 offset += sizeof(this->lifetime.nsec);
Gary Servin 0:04ac6be8229a 143 union {
Gary Servin 0:04ac6be8229a 144 bool real;
Gary Servin 0:04ac6be8229a 145 uint8_t base;
Gary Servin 0:04ac6be8229a 146 } u_frame_locked;
Gary Servin 0:04ac6be8229a 147 u_frame_locked.real = this->frame_locked;
Gary Servin 0:04ac6be8229a 148 *(outbuffer + offset + 0) = (u_frame_locked.base >> (8 * 0)) & 0xFF;
Gary Servin 0:04ac6be8229a 149 offset += sizeof(this->frame_locked);
Gary Servin 0:04ac6be8229a 150 *(outbuffer + offset + 0) = (this->points_length >> (8 * 0)) & 0xFF;
Gary Servin 0:04ac6be8229a 151 *(outbuffer + offset + 1) = (this->points_length >> (8 * 1)) & 0xFF;
Gary Servin 0:04ac6be8229a 152 *(outbuffer + offset + 2) = (this->points_length >> (8 * 2)) & 0xFF;
Gary Servin 0:04ac6be8229a 153 *(outbuffer + offset + 3) = (this->points_length >> (8 * 3)) & 0xFF;
Gary Servin 0:04ac6be8229a 154 offset += sizeof(this->points_length);
Gary Servin 0:04ac6be8229a 155 for( uint32_t i = 0; i < points_length; i++){
Gary Servin 0:04ac6be8229a 156 offset += this->points[i].serialize(outbuffer + offset);
Gary Servin 0:04ac6be8229a 157 }
Gary Servin 0:04ac6be8229a 158 *(outbuffer + offset + 0) = (this->colors_length >> (8 * 0)) & 0xFF;
Gary Servin 0:04ac6be8229a 159 *(outbuffer + offset + 1) = (this->colors_length >> (8 * 1)) & 0xFF;
Gary Servin 0:04ac6be8229a 160 *(outbuffer + offset + 2) = (this->colors_length >> (8 * 2)) & 0xFF;
Gary Servin 0:04ac6be8229a 161 *(outbuffer + offset + 3) = (this->colors_length >> (8 * 3)) & 0xFF;
Gary Servin 0:04ac6be8229a 162 offset += sizeof(this->colors_length);
Gary Servin 0:04ac6be8229a 163 for( uint32_t i = 0; i < colors_length; i++){
Gary Servin 0:04ac6be8229a 164 offset += this->colors[i].serialize(outbuffer + offset);
Gary Servin 0:04ac6be8229a 165 }
Gary Servin 0:04ac6be8229a 166 uint32_t length_text = strlen(this->text);
Gary Servin 0:04ac6be8229a 167 varToArr(outbuffer + offset, length_text);
Gary Servin 0:04ac6be8229a 168 offset += 4;
Gary Servin 0:04ac6be8229a 169 memcpy(outbuffer + offset, this->text, length_text);
Gary Servin 0:04ac6be8229a 170 offset += length_text;
Gary Servin 0:04ac6be8229a 171 uint32_t length_mesh_resource = strlen(this->mesh_resource);
Gary Servin 0:04ac6be8229a 172 varToArr(outbuffer + offset, length_mesh_resource);
Gary Servin 0:04ac6be8229a 173 offset += 4;
Gary Servin 0:04ac6be8229a 174 memcpy(outbuffer + offset, this->mesh_resource, length_mesh_resource);
Gary Servin 0:04ac6be8229a 175 offset += length_mesh_resource;
Gary Servin 0:04ac6be8229a 176 union {
Gary Servin 0:04ac6be8229a 177 bool real;
Gary Servin 0:04ac6be8229a 178 uint8_t base;
Gary Servin 0:04ac6be8229a 179 } u_mesh_use_embedded_materials;
Gary Servin 0:04ac6be8229a 180 u_mesh_use_embedded_materials.real = this->mesh_use_embedded_materials;
Gary Servin 0:04ac6be8229a 181 *(outbuffer + offset + 0) = (u_mesh_use_embedded_materials.base >> (8 * 0)) & 0xFF;
Gary Servin 0:04ac6be8229a 182 offset += sizeof(this->mesh_use_embedded_materials);
Gary Servin 0:04ac6be8229a 183 return offset;
Gary Servin 0:04ac6be8229a 184 }
Gary Servin 0:04ac6be8229a 185
Gary Servin 0:04ac6be8229a 186 virtual int deserialize(unsigned char *inbuffer)
Gary Servin 0:04ac6be8229a 187 {
Gary Servin 0:04ac6be8229a 188 int offset = 0;
Gary Servin 0:04ac6be8229a 189 offset += this->header.deserialize(inbuffer + offset);
Gary Servin 0:04ac6be8229a 190 uint32_t length_ns;
Gary Servin 0:04ac6be8229a 191 arrToVar(length_ns, (inbuffer + offset));
Gary Servin 0:04ac6be8229a 192 offset += 4;
Gary Servin 0:04ac6be8229a 193 for(unsigned int k= offset; k< offset+length_ns; ++k){
Gary Servin 0:04ac6be8229a 194 inbuffer[k-1]=inbuffer[k];
Gary Servin 0:04ac6be8229a 195 }
Gary Servin 0:04ac6be8229a 196 inbuffer[offset+length_ns-1]=0;
Gary Servin 0:04ac6be8229a 197 this->ns = (char *)(inbuffer + offset-1);
Gary Servin 0:04ac6be8229a 198 offset += length_ns;
Gary Servin 0:04ac6be8229a 199 union {
Gary Servin 0:04ac6be8229a 200 int32_t real;
Gary Servin 0:04ac6be8229a 201 uint32_t base;
Gary Servin 0:04ac6be8229a 202 } u_id;
Gary Servin 0:04ac6be8229a 203 u_id.base = 0;
Gary Servin 0:04ac6be8229a 204 u_id.base |= ((uint32_t) (*(inbuffer + offset + 0))) << (8 * 0);
Gary Servin 0:04ac6be8229a 205 u_id.base |= ((uint32_t) (*(inbuffer + offset + 1))) << (8 * 1);
Gary Servin 0:04ac6be8229a 206 u_id.base |= ((uint32_t) (*(inbuffer + offset + 2))) << (8 * 2);
Gary Servin 0:04ac6be8229a 207 u_id.base |= ((uint32_t) (*(inbuffer + offset + 3))) << (8 * 3);
Gary Servin 0:04ac6be8229a 208 this->id = u_id.real;
Gary Servin 0:04ac6be8229a 209 offset += sizeof(this->id);
Gary Servin 0:04ac6be8229a 210 union {
Gary Servin 0:04ac6be8229a 211 int32_t real;
Gary Servin 0:04ac6be8229a 212 uint32_t base;
Gary Servin 0:04ac6be8229a 213 } u_type;
Gary Servin 0:04ac6be8229a 214 u_type.base = 0;
Gary Servin 0:04ac6be8229a 215 u_type.base |= ((uint32_t) (*(inbuffer + offset + 0))) << (8 * 0);
Gary Servin 0:04ac6be8229a 216 u_type.base |= ((uint32_t) (*(inbuffer + offset + 1))) << (8 * 1);
Gary Servin 0:04ac6be8229a 217 u_type.base |= ((uint32_t) (*(inbuffer + offset + 2))) << (8 * 2);
Gary Servin 0:04ac6be8229a 218 u_type.base |= ((uint32_t) (*(inbuffer + offset + 3))) << (8 * 3);
Gary Servin 0:04ac6be8229a 219 this->type = u_type.real;
Gary Servin 0:04ac6be8229a 220 offset += sizeof(this->type);
Gary Servin 0:04ac6be8229a 221 union {
Gary Servin 0:04ac6be8229a 222 int32_t real;
Gary Servin 0:04ac6be8229a 223 uint32_t base;
Gary Servin 0:04ac6be8229a 224 } u_action;
Gary Servin 0:04ac6be8229a 225 u_action.base = 0;
Gary Servin 0:04ac6be8229a 226 u_action.base |= ((uint32_t) (*(inbuffer + offset + 0))) << (8 * 0);
Gary Servin 0:04ac6be8229a 227 u_action.base |= ((uint32_t) (*(inbuffer + offset + 1))) << (8 * 1);
Gary Servin 0:04ac6be8229a 228 u_action.base |= ((uint32_t) (*(inbuffer + offset + 2))) << (8 * 2);
Gary Servin 0:04ac6be8229a 229 u_action.base |= ((uint32_t) (*(inbuffer + offset + 3))) << (8 * 3);
Gary Servin 0:04ac6be8229a 230 this->action = u_action.real;
Gary Servin 0:04ac6be8229a 231 offset += sizeof(this->action);
Gary Servin 0:04ac6be8229a 232 offset += this->pose.deserialize(inbuffer + offset);
Gary Servin 0:04ac6be8229a 233 offset += this->scale.deserialize(inbuffer + offset);
Gary Servin 0:04ac6be8229a 234 offset += this->color.deserialize(inbuffer + offset);
Gary Servin 0:04ac6be8229a 235 this->lifetime.sec = ((uint32_t) (*(inbuffer + offset)));
Gary Servin 0:04ac6be8229a 236 this->lifetime.sec |= ((uint32_t) (*(inbuffer + offset + 1))) << (8 * 1);
Gary Servin 0:04ac6be8229a 237 this->lifetime.sec |= ((uint32_t) (*(inbuffer + offset + 2))) << (8 * 2);
Gary Servin 0:04ac6be8229a 238 this->lifetime.sec |= ((uint32_t) (*(inbuffer + offset + 3))) << (8 * 3);
Gary Servin 0:04ac6be8229a 239 offset += sizeof(this->lifetime.sec);
Gary Servin 0:04ac6be8229a 240 this->lifetime.nsec = ((uint32_t) (*(inbuffer + offset)));
Gary Servin 0:04ac6be8229a 241 this->lifetime.nsec |= ((uint32_t) (*(inbuffer + offset + 1))) << (8 * 1);
Gary Servin 0:04ac6be8229a 242 this->lifetime.nsec |= ((uint32_t) (*(inbuffer + offset + 2))) << (8 * 2);
Gary Servin 0:04ac6be8229a 243 this->lifetime.nsec |= ((uint32_t) (*(inbuffer + offset + 3))) << (8 * 3);
Gary Servin 0:04ac6be8229a 244 offset += sizeof(this->lifetime.nsec);
Gary Servin 0:04ac6be8229a 245 union {
Gary Servin 0:04ac6be8229a 246 bool real;
Gary Servin 0:04ac6be8229a 247 uint8_t base;
Gary Servin 0:04ac6be8229a 248 } u_frame_locked;
Gary Servin 0:04ac6be8229a 249 u_frame_locked.base = 0;
Gary Servin 0:04ac6be8229a 250 u_frame_locked.base |= ((uint8_t) (*(inbuffer + offset + 0))) << (8 * 0);
Gary Servin 0:04ac6be8229a 251 this->frame_locked = u_frame_locked.real;
Gary Servin 0:04ac6be8229a 252 offset += sizeof(this->frame_locked);
Gary Servin 0:04ac6be8229a 253 uint32_t points_lengthT = ((uint32_t) (*(inbuffer + offset)));
Gary Servin 0:04ac6be8229a 254 points_lengthT |= ((uint32_t) (*(inbuffer + offset + 1))) << (8 * 1);
Gary Servin 0:04ac6be8229a 255 points_lengthT |= ((uint32_t) (*(inbuffer + offset + 2))) << (8 * 2);
Gary Servin 0:04ac6be8229a 256 points_lengthT |= ((uint32_t) (*(inbuffer + offset + 3))) << (8 * 3);
Gary Servin 0:04ac6be8229a 257 offset += sizeof(this->points_length);
Gary Servin 0:04ac6be8229a 258 if(points_lengthT > points_length)
Gary Servin 0:04ac6be8229a 259 this->points = (geometry_msgs::Point*)realloc(this->points, points_lengthT * sizeof(geometry_msgs::Point));
Gary Servin 0:04ac6be8229a 260 points_length = points_lengthT;
Gary Servin 0:04ac6be8229a 261 for( uint32_t i = 0; i < points_length; i++){
Gary Servin 0:04ac6be8229a 262 offset += this->st_points.deserialize(inbuffer + offset);
Gary Servin 0:04ac6be8229a 263 memcpy( &(this->points[i]), &(this->st_points), sizeof(geometry_msgs::Point));
Gary Servin 0:04ac6be8229a 264 }
Gary Servin 0:04ac6be8229a 265 uint32_t colors_lengthT = ((uint32_t) (*(inbuffer + offset)));
Gary Servin 0:04ac6be8229a 266 colors_lengthT |= ((uint32_t) (*(inbuffer + offset + 1))) << (8 * 1);
Gary Servin 0:04ac6be8229a 267 colors_lengthT |= ((uint32_t) (*(inbuffer + offset + 2))) << (8 * 2);
Gary Servin 0:04ac6be8229a 268 colors_lengthT |= ((uint32_t) (*(inbuffer + offset + 3))) << (8 * 3);
Gary Servin 0:04ac6be8229a 269 offset += sizeof(this->colors_length);
Gary Servin 0:04ac6be8229a 270 if(colors_lengthT > colors_length)
Gary Servin 0:04ac6be8229a 271 this->colors = (std_msgs::ColorRGBA*)realloc(this->colors, colors_lengthT * sizeof(std_msgs::ColorRGBA));
Gary Servin 0:04ac6be8229a 272 colors_length = colors_lengthT;
Gary Servin 0:04ac6be8229a 273 for( uint32_t i = 0; i < colors_length; i++){
Gary Servin 0:04ac6be8229a 274 offset += this->st_colors.deserialize(inbuffer + offset);
Gary Servin 0:04ac6be8229a 275 memcpy( &(this->colors[i]), &(this->st_colors), sizeof(std_msgs::ColorRGBA));
Gary Servin 0:04ac6be8229a 276 }
Gary Servin 0:04ac6be8229a 277 uint32_t length_text;
Gary Servin 0:04ac6be8229a 278 arrToVar(length_text, (inbuffer + offset));
Gary Servin 0:04ac6be8229a 279 offset += 4;
Gary Servin 0:04ac6be8229a 280 for(unsigned int k= offset; k< offset+length_text; ++k){
Gary Servin 0:04ac6be8229a 281 inbuffer[k-1]=inbuffer[k];
Gary Servin 0:04ac6be8229a 282 }
Gary Servin 0:04ac6be8229a 283 inbuffer[offset+length_text-1]=0;
Gary Servin 0:04ac6be8229a 284 this->text = (char *)(inbuffer + offset-1);
Gary Servin 0:04ac6be8229a 285 offset += length_text;
Gary Servin 0:04ac6be8229a 286 uint32_t length_mesh_resource;
Gary Servin 0:04ac6be8229a 287 arrToVar(length_mesh_resource, (inbuffer + offset));
Gary Servin 0:04ac6be8229a 288 offset += 4;
Gary Servin 0:04ac6be8229a 289 for(unsigned int k= offset; k< offset+length_mesh_resource; ++k){
Gary Servin 0:04ac6be8229a 290 inbuffer[k-1]=inbuffer[k];
Gary Servin 0:04ac6be8229a 291 }
Gary Servin 0:04ac6be8229a 292 inbuffer[offset+length_mesh_resource-1]=0;
Gary Servin 0:04ac6be8229a 293 this->mesh_resource = (char *)(inbuffer + offset-1);
Gary Servin 0:04ac6be8229a 294 offset += length_mesh_resource;
Gary Servin 0:04ac6be8229a 295 union {
Gary Servin 0:04ac6be8229a 296 bool real;
Gary Servin 0:04ac6be8229a 297 uint8_t base;
Gary Servin 0:04ac6be8229a 298 } u_mesh_use_embedded_materials;
Gary Servin 0:04ac6be8229a 299 u_mesh_use_embedded_materials.base = 0;
Gary Servin 0:04ac6be8229a 300 u_mesh_use_embedded_materials.base |= ((uint8_t) (*(inbuffer + offset + 0))) << (8 * 0);
Gary Servin 0:04ac6be8229a 301 this->mesh_use_embedded_materials = u_mesh_use_embedded_materials.real;
Gary Servin 0:04ac6be8229a 302 offset += sizeof(this->mesh_use_embedded_materials);
Gary Servin 0:04ac6be8229a 303 return offset;
Gary Servin 0:04ac6be8229a 304 }
Gary Servin 0:04ac6be8229a 305
Gary Servin 0:04ac6be8229a 306 const char * getType(){ return "visualization_msgs/Marker"; };
Gary Servin 0:04ac6be8229a 307 const char * getMD5(){ return "4048c9de2a16f4ae8e0538085ebf1b97"; };
Gary Servin 0:04ac6be8229a 308
Gary Servin 0:04ac6be8229a 309 };
Gary Servin 0:04ac6be8229a 310
Gary Servin 0:04ac6be8229a 311 }
Gary Servin 0:04ac6be8229a 312 #endif