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_smach_msgs_SmachContainerStructure_h
Gary Servin 0:04ac6be8229a 2 #define _ROS_smach_msgs_SmachContainerStructure_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
Gary Servin 0:04ac6be8229a 10 namespace smach_msgs
Gary Servin 0:04ac6be8229a 11 {
Gary Servin 0:04ac6be8229a 12
Gary Servin 0:04ac6be8229a 13 class SmachContainerStructure : public ros::Msg
Gary Servin 0:04ac6be8229a 14 {
Gary Servin 0:04ac6be8229a 15 public:
Gary Servin 0:04ac6be8229a 16 typedef std_msgs::Header _header_type;
Gary Servin 0:04ac6be8229a 17 _header_type header;
Gary Servin 0:04ac6be8229a 18 typedef const char* _path_type;
Gary Servin 0:04ac6be8229a 19 _path_type path;
Gary Servin 0:04ac6be8229a 20 uint32_t children_length;
Gary Servin 0:04ac6be8229a 21 typedef char* _children_type;
Gary Servin 0:04ac6be8229a 22 _children_type st_children;
Gary Servin 0:04ac6be8229a 23 _children_type * children;
Gary Servin 0:04ac6be8229a 24 uint32_t internal_outcomes_length;
Gary Servin 0:04ac6be8229a 25 typedef char* _internal_outcomes_type;
Gary Servin 0:04ac6be8229a 26 _internal_outcomes_type st_internal_outcomes;
Gary Servin 0:04ac6be8229a 27 _internal_outcomes_type * internal_outcomes;
Gary Servin 0:04ac6be8229a 28 uint32_t outcomes_from_length;
Gary Servin 0:04ac6be8229a 29 typedef char* _outcomes_from_type;
Gary Servin 0:04ac6be8229a 30 _outcomes_from_type st_outcomes_from;
Gary Servin 0:04ac6be8229a 31 _outcomes_from_type * outcomes_from;
Gary Servin 0:04ac6be8229a 32 uint32_t outcomes_to_length;
Gary Servin 0:04ac6be8229a 33 typedef char* _outcomes_to_type;
Gary Servin 0:04ac6be8229a 34 _outcomes_to_type st_outcomes_to;
Gary Servin 0:04ac6be8229a 35 _outcomes_to_type * outcomes_to;
Gary Servin 0:04ac6be8229a 36 uint32_t container_outcomes_length;
Gary Servin 0:04ac6be8229a 37 typedef char* _container_outcomes_type;
Gary Servin 0:04ac6be8229a 38 _container_outcomes_type st_container_outcomes;
Gary Servin 0:04ac6be8229a 39 _container_outcomes_type * container_outcomes;
Gary Servin 0:04ac6be8229a 40
Gary Servin 0:04ac6be8229a 41 SmachContainerStructure():
Gary Servin 0:04ac6be8229a 42 header(),
Gary Servin 0:04ac6be8229a 43 path(""),
Gary Servin 0:04ac6be8229a 44 children_length(0), children(NULL),
Gary Servin 0:04ac6be8229a 45 internal_outcomes_length(0), internal_outcomes(NULL),
Gary Servin 0:04ac6be8229a 46 outcomes_from_length(0), outcomes_from(NULL),
Gary Servin 0:04ac6be8229a 47 outcomes_to_length(0), outcomes_to(NULL),
Gary Servin 0:04ac6be8229a 48 container_outcomes_length(0), container_outcomes(NULL)
Gary Servin 0:04ac6be8229a 49 {
Gary Servin 0:04ac6be8229a 50 }
Gary Servin 0:04ac6be8229a 51
Gary Servin 0:04ac6be8229a 52 virtual int serialize(unsigned char *outbuffer) const
Gary Servin 0:04ac6be8229a 53 {
Gary Servin 0:04ac6be8229a 54 int offset = 0;
Gary Servin 0:04ac6be8229a 55 offset += this->header.serialize(outbuffer + offset);
Gary Servin 0:04ac6be8229a 56 uint32_t length_path = strlen(this->path);
Gary Servin 0:04ac6be8229a 57 varToArr(outbuffer + offset, length_path);
Gary Servin 0:04ac6be8229a 58 offset += 4;
Gary Servin 0:04ac6be8229a 59 memcpy(outbuffer + offset, this->path, length_path);
Gary Servin 0:04ac6be8229a 60 offset += length_path;
Gary Servin 0:04ac6be8229a 61 *(outbuffer + offset + 0) = (this->children_length >> (8 * 0)) & 0xFF;
Gary Servin 0:04ac6be8229a 62 *(outbuffer + offset + 1) = (this->children_length >> (8 * 1)) & 0xFF;
Gary Servin 0:04ac6be8229a 63 *(outbuffer + offset + 2) = (this->children_length >> (8 * 2)) & 0xFF;
Gary Servin 0:04ac6be8229a 64 *(outbuffer + offset + 3) = (this->children_length >> (8 * 3)) & 0xFF;
Gary Servin 0:04ac6be8229a 65 offset += sizeof(this->children_length);
Gary Servin 0:04ac6be8229a 66 for( uint32_t i = 0; i < children_length; i++){
Gary Servin 0:04ac6be8229a 67 uint32_t length_childreni = strlen(this->children[i]);
Gary Servin 0:04ac6be8229a 68 varToArr(outbuffer + offset, length_childreni);
Gary Servin 0:04ac6be8229a 69 offset += 4;
Gary Servin 0:04ac6be8229a 70 memcpy(outbuffer + offset, this->children[i], length_childreni);
Gary Servin 0:04ac6be8229a 71 offset += length_childreni;
Gary Servin 0:04ac6be8229a 72 }
Gary Servin 0:04ac6be8229a 73 *(outbuffer + offset + 0) = (this->internal_outcomes_length >> (8 * 0)) & 0xFF;
Gary Servin 0:04ac6be8229a 74 *(outbuffer + offset + 1) = (this->internal_outcomes_length >> (8 * 1)) & 0xFF;
Gary Servin 0:04ac6be8229a 75 *(outbuffer + offset + 2) = (this->internal_outcomes_length >> (8 * 2)) & 0xFF;
Gary Servin 0:04ac6be8229a 76 *(outbuffer + offset + 3) = (this->internal_outcomes_length >> (8 * 3)) & 0xFF;
Gary Servin 0:04ac6be8229a 77 offset += sizeof(this->internal_outcomes_length);
Gary Servin 0:04ac6be8229a 78 for( uint32_t i = 0; i < internal_outcomes_length; i++){
Gary Servin 0:04ac6be8229a 79 uint32_t length_internal_outcomesi = strlen(this->internal_outcomes[i]);
Gary Servin 0:04ac6be8229a 80 varToArr(outbuffer + offset, length_internal_outcomesi);
Gary Servin 0:04ac6be8229a 81 offset += 4;
Gary Servin 0:04ac6be8229a 82 memcpy(outbuffer + offset, this->internal_outcomes[i], length_internal_outcomesi);
Gary Servin 0:04ac6be8229a 83 offset += length_internal_outcomesi;
Gary Servin 0:04ac6be8229a 84 }
Gary Servin 0:04ac6be8229a 85 *(outbuffer + offset + 0) = (this->outcomes_from_length >> (8 * 0)) & 0xFF;
Gary Servin 0:04ac6be8229a 86 *(outbuffer + offset + 1) = (this->outcomes_from_length >> (8 * 1)) & 0xFF;
Gary Servin 0:04ac6be8229a 87 *(outbuffer + offset + 2) = (this->outcomes_from_length >> (8 * 2)) & 0xFF;
Gary Servin 0:04ac6be8229a 88 *(outbuffer + offset + 3) = (this->outcomes_from_length >> (8 * 3)) & 0xFF;
Gary Servin 0:04ac6be8229a 89 offset += sizeof(this->outcomes_from_length);
Gary Servin 0:04ac6be8229a 90 for( uint32_t i = 0; i < outcomes_from_length; i++){
Gary Servin 0:04ac6be8229a 91 uint32_t length_outcomes_fromi = strlen(this->outcomes_from[i]);
Gary Servin 0:04ac6be8229a 92 varToArr(outbuffer + offset, length_outcomes_fromi);
Gary Servin 0:04ac6be8229a 93 offset += 4;
Gary Servin 0:04ac6be8229a 94 memcpy(outbuffer + offset, this->outcomes_from[i], length_outcomes_fromi);
Gary Servin 0:04ac6be8229a 95 offset += length_outcomes_fromi;
Gary Servin 0:04ac6be8229a 96 }
Gary Servin 0:04ac6be8229a 97 *(outbuffer + offset + 0) = (this->outcomes_to_length >> (8 * 0)) & 0xFF;
Gary Servin 0:04ac6be8229a 98 *(outbuffer + offset + 1) = (this->outcomes_to_length >> (8 * 1)) & 0xFF;
Gary Servin 0:04ac6be8229a 99 *(outbuffer + offset + 2) = (this->outcomes_to_length >> (8 * 2)) & 0xFF;
Gary Servin 0:04ac6be8229a 100 *(outbuffer + offset + 3) = (this->outcomes_to_length >> (8 * 3)) & 0xFF;
Gary Servin 0:04ac6be8229a 101 offset += sizeof(this->outcomes_to_length);
Gary Servin 0:04ac6be8229a 102 for( uint32_t i = 0; i < outcomes_to_length; i++){
Gary Servin 0:04ac6be8229a 103 uint32_t length_outcomes_toi = strlen(this->outcomes_to[i]);
Gary Servin 0:04ac6be8229a 104 varToArr(outbuffer + offset, length_outcomes_toi);
Gary Servin 0:04ac6be8229a 105 offset += 4;
Gary Servin 0:04ac6be8229a 106 memcpy(outbuffer + offset, this->outcomes_to[i], length_outcomes_toi);
Gary Servin 0:04ac6be8229a 107 offset += length_outcomes_toi;
Gary Servin 0:04ac6be8229a 108 }
Gary Servin 0:04ac6be8229a 109 *(outbuffer + offset + 0) = (this->container_outcomes_length >> (8 * 0)) & 0xFF;
Gary Servin 0:04ac6be8229a 110 *(outbuffer + offset + 1) = (this->container_outcomes_length >> (8 * 1)) & 0xFF;
Gary Servin 0:04ac6be8229a 111 *(outbuffer + offset + 2) = (this->container_outcomes_length >> (8 * 2)) & 0xFF;
Gary Servin 0:04ac6be8229a 112 *(outbuffer + offset + 3) = (this->container_outcomes_length >> (8 * 3)) & 0xFF;
Gary Servin 0:04ac6be8229a 113 offset += sizeof(this->container_outcomes_length);
Gary Servin 0:04ac6be8229a 114 for( uint32_t i = 0; i < container_outcomes_length; i++){
Gary Servin 0:04ac6be8229a 115 uint32_t length_container_outcomesi = strlen(this->container_outcomes[i]);
Gary Servin 0:04ac6be8229a 116 varToArr(outbuffer + offset, length_container_outcomesi);
Gary Servin 0:04ac6be8229a 117 offset += 4;
Gary Servin 0:04ac6be8229a 118 memcpy(outbuffer + offset, this->container_outcomes[i], length_container_outcomesi);
Gary Servin 0:04ac6be8229a 119 offset += length_container_outcomesi;
Gary Servin 0:04ac6be8229a 120 }
Gary Servin 0:04ac6be8229a 121 return offset;
Gary Servin 0:04ac6be8229a 122 }
Gary Servin 0:04ac6be8229a 123
Gary Servin 0:04ac6be8229a 124 virtual int deserialize(unsigned char *inbuffer)
Gary Servin 0:04ac6be8229a 125 {
Gary Servin 0:04ac6be8229a 126 int offset = 0;
Gary Servin 0:04ac6be8229a 127 offset += this->header.deserialize(inbuffer + offset);
Gary Servin 0:04ac6be8229a 128 uint32_t length_path;
Gary Servin 0:04ac6be8229a 129 arrToVar(length_path, (inbuffer + offset));
Gary Servin 0:04ac6be8229a 130 offset += 4;
Gary Servin 0:04ac6be8229a 131 for(unsigned int k= offset; k< offset+length_path; ++k){
Gary Servin 0:04ac6be8229a 132 inbuffer[k-1]=inbuffer[k];
Gary Servin 0:04ac6be8229a 133 }
Gary Servin 0:04ac6be8229a 134 inbuffer[offset+length_path-1]=0;
Gary Servin 0:04ac6be8229a 135 this->path = (char *)(inbuffer + offset-1);
Gary Servin 0:04ac6be8229a 136 offset += length_path;
Gary Servin 0:04ac6be8229a 137 uint32_t children_lengthT = ((uint32_t) (*(inbuffer + offset)));
Gary Servin 0:04ac6be8229a 138 children_lengthT |= ((uint32_t) (*(inbuffer + offset + 1))) << (8 * 1);
Gary Servin 0:04ac6be8229a 139 children_lengthT |= ((uint32_t) (*(inbuffer + offset + 2))) << (8 * 2);
Gary Servin 0:04ac6be8229a 140 children_lengthT |= ((uint32_t) (*(inbuffer + offset + 3))) << (8 * 3);
Gary Servin 0:04ac6be8229a 141 offset += sizeof(this->children_length);
Gary Servin 0:04ac6be8229a 142 if(children_lengthT > children_length)
Gary Servin 0:04ac6be8229a 143 this->children = (char**)realloc(this->children, children_lengthT * sizeof(char*));
Gary Servin 0:04ac6be8229a 144 children_length = children_lengthT;
Gary Servin 0:04ac6be8229a 145 for( uint32_t i = 0; i < children_length; i++){
Gary Servin 0:04ac6be8229a 146 uint32_t length_st_children;
Gary Servin 0:04ac6be8229a 147 arrToVar(length_st_children, (inbuffer + offset));
Gary Servin 0:04ac6be8229a 148 offset += 4;
Gary Servin 0:04ac6be8229a 149 for(unsigned int k= offset; k< offset+length_st_children; ++k){
Gary Servin 0:04ac6be8229a 150 inbuffer[k-1]=inbuffer[k];
Gary Servin 0:04ac6be8229a 151 }
Gary Servin 0:04ac6be8229a 152 inbuffer[offset+length_st_children-1]=0;
Gary Servin 0:04ac6be8229a 153 this->st_children = (char *)(inbuffer + offset-1);
Gary Servin 0:04ac6be8229a 154 offset += length_st_children;
Gary Servin 0:04ac6be8229a 155 memcpy( &(this->children[i]), &(this->st_children), sizeof(char*));
Gary Servin 0:04ac6be8229a 156 }
Gary Servin 0:04ac6be8229a 157 uint32_t internal_outcomes_lengthT = ((uint32_t) (*(inbuffer + offset)));
Gary Servin 0:04ac6be8229a 158 internal_outcomes_lengthT |= ((uint32_t) (*(inbuffer + offset + 1))) << (8 * 1);
Gary Servin 0:04ac6be8229a 159 internal_outcomes_lengthT |= ((uint32_t) (*(inbuffer + offset + 2))) << (8 * 2);
Gary Servin 0:04ac6be8229a 160 internal_outcomes_lengthT |= ((uint32_t) (*(inbuffer + offset + 3))) << (8 * 3);
Gary Servin 0:04ac6be8229a 161 offset += sizeof(this->internal_outcomes_length);
Gary Servin 0:04ac6be8229a 162 if(internal_outcomes_lengthT > internal_outcomes_length)
Gary Servin 0:04ac6be8229a 163 this->internal_outcomes = (char**)realloc(this->internal_outcomes, internal_outcomes_lengthT * sizeof(char*));
Gary Servin 0:04ac6be8229a 164 internal_outcomes_length = internal_outcomes_lengthT;
Gary Servin 0:04ac6be8229a 165 for( uint32_t i = 0; i < internal_outcomes_length; i++){
Gary Servin 0:04ac6be8229a 166 uint32_t length_st_internal_outcomes;
Gary Servin 0:04ac6be8229a 167 arrToVar(length_st_internal_outcomes, (inbuffer + offset));
Gary Servin 0:04ac6be8229a 168 offset += 4;
Gary Servin 0:04ac6be8229a 169 for(unsigned int k= offset; k< offset+length_st_internal_outcomes; ++k){
Gary Servin 0:04ac6be8229a 170 inbuffer[k-1]=inbuffer[k];
Gary Servin 0:04ac6be8229a 171 }
Gary Servin 0:04ac6be8229a 172 inbuffer[offset+length_st_internal_outcomes-1]=0;
Gary Servin 0:04ac6be8229a 173 this->st_internal_outcomes = (char *)(inbuffer + offset-1);
Gary Servin 0:04ac6be8229a 174 offset += length_st_internal_outcomes;
Gary Servin 0:04ac6be8229a 175 memcpy( &(this->internal_outcomes[i]), &(this->st_internal_outcomes), sizeof(char*));
Gary Servin 0:04ac6be8229a 176 }
Gary Servin 0:04ac6be8229a 177 uint32_t outcomes_from_lengthT = ((uint32_t) (*(inbuffer + offset)));
Gary Servin 0:04ac6be8229a 178 outcomes_from_lengthT |= ((uint32_t) (*(inbuffer + offset + 1))) << (8 * 1);
Gary Servin 0:04ac6be8229a 179 outcomes_from_lengthT |= ((uint32_t) (*(inbuffer + offset + 2))) << (8 * 2);
Gary Servin 0:04ac6be8229a 180 outcomes_from_lengthT |= ((uint32_t) (*(inbuffer + offset + 3))) << (8 * 3);
Gary Servin 0:04ac6be8229a 181 offset += sizeof(this->outcomes_from_length);
Gary Servin 0:04ac6be8229a 182 if(outcomes_from_lengthT > outcomes_from_length)
Gary Servin 0:04ac6be8229a 183 this->outcomes_from = (char**)realloc(this->outcomes_from, outcomes_from_lengthT * sizeof(char*));
Gary Servin 0:04ac6be8229a 184 outcomes_from_length = outcomes_from_lengthT;
Gary Servin 0:04ac6be8229a 185 for( uint32_t i = 0; i < outcomes_from_length; i++){
Gary Servin 0:04ac6be8229a 186 uint32_t length_st_outcomes_from;
Gary Servin 0:04ac6be8229a 187 arrToVar(length_st_outcomes_from, (inbuffer + offset));
Gary Servin 0:04ac6be8229a 188 offset += 4;
Gary Servin 0:04ac6be8229a 189 for(unsigned int k= offset; k< offset+length_st_outcomes_from; ++k){
Gary Servin 0:04ac6be8229a 190 inbuffer[k-1]=inbuffer[k];
Gary Servin 0:04ac6be8229a 191 }
Gary Servin 0:04ac6be8229a 192 inbuffer[offset+length_st_outcomes_from-1]=0;
Gary Servin 0:04ac6be8229a 193 this->st_outcomes_from = (char *)(inbuffer + offset-1);
Gary Servin 0:04ac6be8229a 194 offset += length_st_outcomes_from;
Gary Servin 0:04ac6be8229a 195 memcpy( &(this->outcomes_from[i]), &(this->st_outcomes_from), sizeof(char*));
Gary Servin 0:04ac6be8229a 196 }
Gary Servin 0:04ac6be8229a 197 uint32_t outcomes_to_lengthT = ((uint32_t) (*(inbuffer + offset)));
Gary Servin 0:04ac6be8229a 198 outcomes_to_lengthT |= ((uint32_t) (*(inbuffer + offset + 1))) << (8 * 1);
Gary Servin 0:04ac6be8229a 199 outcomes_to_lengthT |= ((uint32_t) (*(inbuffer + offset + 2))) << (8 * 2);
Gary Servin 0:04ac6be8229a 200 outcomes_to_lengthT |= ((uint32_t) (*(inbuffer + offset + 3))) << (8 * 3);
Gary Servin 0:04ac6be8229a 201 offset += sizeof(this->outcomes_to_length);
Gary Servin 0:04ac6be8229a 202 if(outcomes_to_lengthT > outcomes_to_length)
Gary Servin 0:04ac6be8229a 203 this->outcomes_to = (char**)realloc(this->outcomes_to, outcomes_to_lengthT * sizeof(char*));
Gary Servin 0:04ac6be8229a 204 outcomes_to_length = outcomes_to_lengthT;
Gary Servin 0:04ac6be8229a 205 for( uint32_t i = 0; i < outcomes_to_length; i++){
Gary Servin 0:04ac6be8229a 206 uint32_t length_st_outcomes_to;
Gary Servin 0:04ac6be8229a 207 arrToVar(length_st_outcomes_to, (inbuffer + offset));
Gary Servin 0:04ac6be8229a 208 offset += 4;
Gary Servin 0:04ac6be8229a 209 for(unsigned int k= offset; k< offset+length_st_outcomes_to; ++k){
Gary Servin 0:04ac6be8229a 210 inbuffer[k-1]=inbuffer[k];
Gary Servin 0:04ac6be8229a 211 }
Gary Servin 0:04ac6be8229a 212 inbuffer[offset+length_st_outcomes_to-1]=0;
Gary Servin 0:04ac6be8229a 213 this->st_outcomes_to = (char *)(inbuffer + offset-1);
Gary Servin 0:04ac6be8229a 214 offset += length_st_outcomes_to;
Gary Servin 0:04ac6be8229a 215 memcpy( &(this->outcomes_to[i]), &(this->st_outcomes_to), sizeof(char*));
Gary Servin 0:04ac6be8229a 216 }
Gary Servin 0:04ac6be8229a 217 uint32_t container_outcomes_lengthT = ((uint32_t) (*(inbuffer + offset)));
Gary Servin 0:04ac6be8229a 218 container_outcomes_lengthT |= ((uint32_t) (*(inbuffer + offset + 1))) << (8 * 1);
Gary Servin 0:04ac6be8229a 219 container_outcomes_lengthT |= ((uint32_t) (*(inbuffer + offset + 2))) << (8 * 2);
Gary Servin 0:04ac6be8229a 220 container_outcomes_lengthT |= ((uint32_t) (*(inbuffer + offset + 3))) << (8 * 3);
Gary Servin 0:04ac6be8229a 221 offset += sizeof(this->container_outcomes_length);
Gary Servin 0:04ac6be8229a 222 if(container_outcomes_lengthT > container_outcomes_length)
Gary Servin 0:04ac6be8229a 223 this->container_outcomes = (char**)realloc(this->container_outcomes, container_outcomes_lengthT * sizeof(char*));
Gary Servin 0:04ac6be8229a 224 container_outcomes_length = container_outcomes_lengthT;
Gary Servin 0:04ac6be8229a 225 for( uint32_t i = 0; i < container_outcomes_length; i++){
Gary Servin 0:04ac6be8229a 226 uint32_t length_st_container_outcomes;
Gary Servin 0:04ac6be8229a 227 arrToVar(length_st_container_outcomes, (inbuffer + offset));
Gary Servin 0:04ac6be8229a 228 offset += 4;
Gary Servin 0:04ac6be8229a 229 for(unsigned int k= offset; k< offset+length_st_container_outcomes; ++k){
Gary Servin 0:04ac6be8229a 230 inbuffer[k-1]=inbuffer[k];
Gary Servin 0:04ac6be8229a 231 }
Gary Servin 0:04ac6be8229a 232 inbuffer[offset+length_st_container_outcomes-1]=0;
Gary Servin 0:04ac6be8229a 233 this->st_container_outcomes = (char *)(inbuffer + offset-1);
Gary Servin 0:04ac6be8229a 234 offset += length_st_container_outcomes;
Gary Servin 0:04ac6be8229a 235 memcpy( &(this->container_outcomes[i]), &(this->st_container_outcomes), sizeof(char*));
Gary Servin 0:04ac6be8229a 236 }
Gary Servin 0:04ac6be8229a 237 return offset;
Gary Servin 0:04ac6be8229a 238 }
Gary Servin 0:04ac6be8229a 239
Gary Servin 0:04ac6be8229a 240 const char * getType(){ return "smach_msgs/SmachContainerStructure"; };
Gary Servin 0:04ac6be8229a 241 const char * getMD5(){ return "3d3d1e0d0f99779ee9e58101a5dcf7ea"; };
Gary Servin 0:04ac6be8229a 242
Gary Servin 0:04ac6be8229a 243 };
Gary Servin 0:04ac6be8229a 244
Gary Servin 0:04ac6be8229a 245 }
Gary Servin 0:04ac6be8229a 246 #endif