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_SERVICE_GetModelProperties_h
Gary Servin 0:04ac6be8229a 2 #define _ROS_SERVICE_GetModelProperties_h
Gary Servin 0:04ac6be8229a 3 #include <stdint.h>
Gary Servin 0:04ac6be8229a 4 #include <string.h>
Gary Servin 0:04ac6be8229a 5 #include <stdlib.h>
Gary Servin 0:04ac6be8229a 6 #include "ros/msg.h"
Gary Servin 0:04ac6be8229a 7
Gary Servin 0:04ac6be8229a 8 namespace gazebo_msgs
Gary Servin 0:04ac6be8229a 9 {
Gary Servin 0:04ac6be8229a 10
Gary Servin 0:04ac6be8229a 11 static const char GETMODELPROPERTIES[] = "gazebo_msgs/GetModelProperties";
Gary Servin 0:04ac6be8229a 12
Gary Servin 0:04ac6be8229a 13 class GetModelPropertiesRequest : public ros::Msg
Gary Servin 0:04ac6be8229a 14 {
Gary Servin 0:04ac6be8229a 15 public:
Gary Servin 0:04ac6be8229a 16 typedef const char* _model_name_type;
Gary Servin 0:04ac6be8229a 17 _model_name_type model_name;
Gary Servin 0:04ac6be8229a 18
Gary Servin 0:04ac6be8229a 19 GetModelPropertiesRequest():
Gary Servin 0:04ac6be8229a 20 model_name("")
Gary Servin 0:04ac6be8229a 21 {
Gary Servin 0:04ac6be8229a 22 }
Gary Servin 0:04ac6be8229a 23
Gary Servin 0:04ac6be8229a 24 virtual int serialize(unsigned char *outbuffer) const
Gary Servin 0:04ac6be8229a 25 {
Gary Servin 0:04ac6be8229a 26 int offset = 0;
Gary Servin 0:04ac6be8229a 27 uint32_t length_model_name = strlen(this->model_name);
Gary Servin 0:04ac6be8229a 28 varToArr(outbuffer + offset, length_model_name);
Gary Servin 0:04ac6be8229a 29 offset += 4;
Gary Servin 0:04ac6be8229a 30 memcpy(outbuffer + offset, this->model_name, length_model_name);
Gary Servin 0:04ac6be8229a 31 offset += length_model_name;
Gary Servin 0:04ac6be8229a 32 return offset;
Gary Servin 0:04ac6be8229a 33 }
Gary Servin 0:04ac6be8229a 34
Gary Servin 0:04ac6be8229a 35 virtual int deserialize(unsigned char *inbuffer)
Gary Servin 0:04ac6be8229a 36 {
Gary Servin 0:04ac6be8229a 37 int offset = 0;
Gary Servin 0:04ac6be8229a 38 uint32_t length_model_name;
Gary Servin 0:04ac6be8229a 39 arrToVar(length_model_name, (inbuffer + offset));
Gary Servin 0:04ac6be8229a 40 offset += 4;
Gary Servin 0:04ac6be8229a 41 for(unsigned int k= offset; k< offset+length_model_name; ++k){
Gary Servin 0:04ac6be8229a 42 inbuffer[k-1]=inbuffer[k];
Gary Servin 0:04ac6be8229a 43 }
Gary Servin 0:04ac6be8229a 44 inbuffer[offset+length_model_name-1]=0;
Gary Servin 0:04ac6be8229a 45 this->model_name = (char *)(inbuffer + offset-1);
Gary Servin 0:04ac6be8229a 46 offset += length_model_name;
Gary Servin 0:04ac6be8229a 47 return offset;
Gary Servin 0:04ac6be8229a 48 }
Gary Servin 0:04ac6be8229a 49
Gary Servin 0:04ac6be8229a 50 const char * getType(){ return GETMODELPROPERTIES; };
Gary Servin 0:04ac6be8229a 51 const char * getMD5(){ return "ea31c8eab6fc401383cf528a7c0984ba"; };
Gary Servin 0:04ac6be8229a 52
Gary Servin 0:04ac6be8229a 53 };
Gary Servin 0:04ac6be8229a 54
Gary Servin 0:04ac6be8229a 55 class GetModelPropertiesResponse : public ros::Msg
Gary Servin 0:04ac6be8229a 56 {
Gary Servin 0:04ac6be8229a 57 public:
Gary Servin 0:04ac6be8229a 58 typedef const char* _parent_model_name_type;
Gary Servin 0:04ac6be8229a 59 _parent_model_name_type parent_model_name;
Gary Servin 0:04ac6be8229a 60 typedef const char* _canonical_body_name_type;
Gary Servin 0:04ac6be8229a 61 _canonical_body_name_type canonical_body_name;
Gary Servin 0:04ac6be8229a 62 uint32_t body_names_length;
Gary Servin 0:04ac6be8229a 63 typedef char* _body_names_type;
Gary Servin 0:04ac6be8229a 64 _body_names_type st_body_names;
Gary Servin 0:04ac6be8229a 65 _body_names_type * body_names;
Gary Servin 0:04ac6be8229a 66 uint32_t geom_names_length;
Gary Servin 0:04ac6be8229a 67 typedef char* _geom_names_type;
Gary Servin 0:04ac6be8229a 68 _geom_names_type st_geom_names;
Gary Servin 0:04ac6be8229a 69 _geom_names_type * geom_names;
Gary Servin 0:04ac6be8229a 70 uint32_t joint_names_length;
Gary Servin 0:04ac6be8229a 71 typedef char* _joint_names_type;
Gary Servin 0:04ac6be8229a 72 _joint_names_type st_joint_names;
Gary Servin 0:04ac6be8229a 73 _joint_names_type * joint_names;
Gary Servin 0:04ac6be8229a 74 uint32_t child_model_names_length;
Gary Servin 0:04ac6be8229a 75 typedef char* _child_model_names_type;
Gary Servin 0:04ac6be8229a 76 _child_model_names_type st_child_model_names;
Gary Servin 0:04ac6be8229a 77 _child_model_names_type * child_model_names;
Gary Servin 0:04ac6be8229a 78 typedef bool _is_static_type;
Gary Servin 0:04ac6be8229a 79 _is_static_type is_static;
Gary Servin 0:04ac6be8229a 80 typedef bool _success_type;
Gary Servin 0:04ac6be8229a 81 _success_type success;
Gary Servin 0:04ac6be8229a 82 typedef const char* _status_message_type;
Gary Servin 0:04ac6be8229a 83 _status_message_type status_message;
Gary Servin 0:04ac6be8229a 84
Gary Servin 0:04ac6be8229a 85 GetModelPropertiesResponse():
Gary Servin 0:04ac6be8229a 86 parent_model_name(""),
Gary Servin 0:04ac6be8229a 87 canonical_body_name(""),
Gary Servin 0:04ac6be8229a 88 body_names_length(0), body_names(NULL),
Gary Servin 0:04ac6be8229a 89 geom_names_length(0), geom_names(NULL),
Gary Servin 0:04ac6be8229a 90 joint_names_length(0), joint_names(NULL),
Gary Servin 0:04ac6be8229a 91 child_model_names_length(0), child_model_names(NULL),
Gary Servin 0:04ac6be8229a 92 is_static(0),
Gary Servin 0:04ac6be8229a 93 success(0),
Gary Servin 0:04ac6be8229a 94 status_message("")
Gary Servin 0:04ac6be8229a 95 {
Gary Servin 0:04ac6be8229a 96 }
Gary Servin 0:04ac6be8229a 97
Gary Servin 0:04ac6be8229a 98 virtual int serialize(unsigned char *outbuffer) const
Gary Servin 0:04ac6be8229a 99 {
Gary Servin 0:04ac6be8229a 100 int offset = 0;
Gary Servin 0:04ac6be8229a 101 uint32_t length_parent_model_name = strlen(this->parent_model_name);
Gary Servin 0:04ac6be8229a 102 varToArr(outbuffer + offset, length_parent_model_name);
Gary Servin 0:04ac6be8229a 103 offset += 4;
Gary Servin 0:04ac6be8229a 104 memcpy(outbuffer + offset, this->parent_model_name, length_parent_model_name);
Gary Servin 0:04ac6be8229a 105 offset += length_parent_model_name;
Gary Servin 0:04ac6be8229a 106 uint32_t length_canonical_body_name = strlen(this->canonical_body_name);
Gary Servin 0:04ac6be8229a 107 varToArr(outbuffer + offset, length_canonical_body_name);
Gary Servin 0:04ac6be8229a 108 offset += 4;
Gary Servin 0:04ac6be8229a 109 memcpy(outbuffer + offset, this->canonical_body_name, length_canonical_body_name);
Gary Servin 0:04ac6be8229a 110 offset += length_canonical_body_name;
Gary Servin 0:04ac6be8229a 111 *(outbuffer + offset + 0) = (this->body_names_length >> (8 * 0)) & 0xFF;
Gary Servin 0:04ac6be8229a 112 *(outbuffer + offset + 1) = (this->body_names_length >> (8 * 1)) & 0xFF;
Gary Servin 0:04ac6be8229a 113 *(outbuffer + offset + 2) = (this->body_names_length >> (8 * 2)) & 0xFF;
Gary Servin 0:04ac6be8229a 114 *(outbuffer + offset + 3) = (this->body_names_length >> (8 * 3)) & 0xFF;
Gary Servin 0:04ac6be8229a 115 offset += sizeof(this->body_names_length);
Gary Servin 0:04ac6be8229a 116 for( uint32_t i = 0; i < body_names_length; i++){
Gary Servin 0:04ac6be8229a 117 uint32_t length_body_namesi = strlen(this->body_names[i]);
Gary Servin 0:04ac6be8229a 118 varToArr(outbuffer + offset, length_body_namesi);
Gary Servin 0:04ac6be8229a 119 offset += 4;
Gary Servin 0:04ac6be8229a 120 memcpy(outbuffer + offset, this->body_names[i], length_body_namesi);
Gary Servin 0:04ac6be8229a 121 offset += length_body_namesi;
Gary Servin 0:04ac6be8229a 122 }
Gary Servin 0:04ac6be8229a 123 *(outbuffer + offset + 0) = (this->geom_names_length >> (8 * 0)) & 0xFF;
Gary Servin 0:04ac6be8229a 124 *(outbuffer + offset + 1) = (this->geom_names_length >> (8 * 1)) & 0xFF;
Gary Servin 0:04ac6be8229a 125 *(outbuffer + offset + 2) = (this->geom_names_length >> (8 * 2)) & 0xFF;
Gary Servin 0:04ac6be8229a 126 *(outbuffer + offset + 3) = (this->geom_names_length >> (8 * 3)) & 0xFF;
Gary Servin 0:04ac6be8229a 127 offset += sizeof(this->geom_names_length);
Gary Servin 0:04ac6be8229a 128 for( uint32_t i = 0; i < geom_names_length; i++){
Gary Servin 0:04ac6be8229a 129 uint32_t length_geom_namesi = strlen(this->geom_names[i]);
Gary Servin 0:04ac6be8229a 130 varToArr(outbuffer + offset, length_geom_namesi);
Gary Servin 0:04ac6be8229a 131 offset += 4;
Gary Servin 0:04ac6be8229a 132 memcpy(outbuffer + offset, this->geom_names[i], length_geom_namesi);
Gary Servin 0:04ac6be8229a 133 offset += length_geom_namesi;
Gary Servin 0:04ac6be8229a 134 }
Gary Servin 0:04ac6be8229a 135 *(outbuffer + offset + 0) = (this->joint_names_length >> (8 * 0)) & 0xFF;
Gary Servin 0:04ac6be8229a 136 *(outbuffer + offset + 1) = (this->joint_names_length >> (8 * 1)) & 0xFF;
Gary Servin 0:04ac6be8229a 137 *(outbuffer + offset + 2) = (this->joint_names_length >> (8 * 2)) & 0xFF;
Gary Servin 0:04ac6be8229a 138 *(outbuffer + offset + 3) = (this->joint_names_length >> (8 * 3)) & 0xFF;
Gary Servin 0:04ac6be8229a 139 offset += sizeof(this->joint_names_length);
Gary Servin 0:04ac6be8229a 140 for( uint32_t i = 0; i < joint_names_length; i++){
Gary Servin 0:04ac6be8229a 141 uint32_t length_joint_namesi = strlen(this->joint_names[i]);
Gary Servin 0:04ac6be8229a 142 varToArr(outbuffer + offset, length_joint_namesi);
Gary Servin 0:04ac6be8229a 143 offset += 4;
Gary Servin 0:04ac6be8229a 144 memcpy(outbuffer + offset, this->joint_names[i], length_joint_namesi);
Gary Servin 0:04ac6be8229a 145 offset += length_joint_namesi;
Gary Servin 0:04ac6be8229a 146 }
Gary Servin 0:04ac6be8229a 147 *(outbuffer + offset + 0) = (this->child_model_names_length >> (8 * 0)) & 0xFF;
Gary Servin 0:04ac6be8229a 148 *(outbuffer + offset + 1) = (this->child_model_names_length >> (8 * 1)) & 0xFF;
Gary Servin 0:04ac6be8229a 149 *(outbuffer + offset + 2) = (this->child_model_names_length >> (8 * 2)) & 0xFF;
Gary Servin 0:04ac6be8229a 150 *(outbuffer + offset + 3) = (this->child_model_names_length >> (8 * 3)) & 0xFF;
Gary Servin 0:04ac6be8229a 151 offset += sizeof(this->child_model_names_length);
Gary Servin 0:04ac6be8229a 152 for( uint32_t i = 0; i < child_model_names_length; i++){
Gary Servin 0:04ac6be8229a 153 uint32_t length_child_model_namesi = strlen(this->child_model_names[i]);
Gary Servin 0:04ac6be8229a 154 varToArr(outbuffer + offset, length_child_model_namesi);
Gary Servin 0:04ac6be8229a 155 offset += 4;
Gary Servin 0:04ac6be8229a 156 memcpy(outbuffer + offset, this->child_model_names[i], length_child_model_namesi);
Gary Servin 0:04ac6be8229a 157 offset += length_child_model_namesi;
Gary Servin 0:04ac6be8229a 158 }
Gary Servin 0:04ac6be8229a 159 union {
Gary Servin 0:04ac6be8229a 160 bool real;
Gary Servin 0:04ac6be8229a 161 uint8_t base;
Gary Servin 0:04ac6be8229a 162 } u_is_static;
Gary Servin 0:04ac6be8229a 163 u_is_static.real = this->is_static;
Gary Servin 0:04ac6be8229a 164 *(outbuffer + offset + 0) = (u_is_static.base >> (8 * 0)) & 0xFF;
Gary Servin 0:04ac6be8229a 165 offset += sizeof(this->is_static);
Gary Servin 0:04ac6be8229a 166 union {
Gary Servin 0:04ac6be8229a 167 bool real;
Gary Servin 0:04ac6be8229a 168 uint8_t base;
Gary Servin 0:04ac6be8229a 169 } u_success;
Gary Servin 0:04ac6be8229a 170 u_success.real = this->success;
Gary Servin 0:04ac6be8229a 171 *(outbuffer + offset + 0) = (u_success.base >> (8 * 0)) & 0xFF;
Gary Servin 0:04ac6be8229a 172 offset += sizeof(this->success);
Gary Servin 0:04ac6be8229a 173 uint32_t length_status_message = strlen(this->status_message);
Gary Servin 0:04ac6be8229a 174 varToArr(outbuffer + offset, length_status_message);
Gary Servin 0:04ac6be8229a 175 offset += 4;
Gary Servin 0:04ac6be8229a 176 memcpy(outbuffer + offset, this->status_message, length_status_message);
Gary Servin 0:04ac6be8229a 177 offset += length_status_message;
Gary Servin 0:04ac6be8229a 178 return offset;
Gary Servin 0:04ac6be8229a 179 }
Gary Servin 0:04ac6be8229a 180
Gary Servin 0:04ac6be8229a 181 virtual int deserialize(unsigned char *inbuffer)
Gary Servin 0:04ac6be8229a 182 {
Gary Servin 0:04ac6be8229a 183 int offset = 0;
Gary Servin 0:04ac6be8229a 184 uint32_t length_parent_model_name;
Gary Servin 0:04ac6be8229a 185 arrToVar(length_parent_model_name, (inbuffer + offset));
Gary Servin 0:04ac6be8229a 186 offset += 4;
Gary Servin 0:04ac6be8229a 187 for(unsigned int k= offset; k< offset+length_parent_model_name; ++k){
Gary Servin 0:04ac6be8229a 188 inbuffer[k-1]=inbuffer[k];
Gary Servin 0:04ac6be8229a 189 }
Gary Servin 0:04ac6be8229a 190 inbuffer[offset+length_parent_model_name-1]=0;
Gary Servin 0:04ac6be8229a 191 this->parent_model_name = (char *)(inbuffer + offset-1);
Gary Servin 0:04ac6be8229a 192 offset += length_parent_model_name;
Gary Servin 0:04ac6be8229a 193 uint32_t length_canonical_body_name;
Gary Servin 0:04ac6be8229a 194 arrToVar(length_canonical_body_name, (inbuffer + offset));
Gary Servin 0:04ac6be8229a 195 offset += 4;
Gary Servin 0:04ac6be8229a 196 for(unsigned int k= offset; k< offset+length_canonical_body_name; ++k){
Gary Servin 0:04ac6be8229a 197 inbuffer[k-1]=inbuffer[k];
Gary Servin 0:04ac6be8229a 198 }
Gary Servin 0:04ac6be8229a 199 inbuffer[offset+length_canonical_body_name-1]=0;
Gary Servin 0:04ac6be8229a 200 this->canonical_body_name = (char *)(inbuffer + offset-1);
Gary Servin 0:04ac6be8229a 201 offset += length_canonical_body_name;
Gary Servin 0:04ac6be8229a 202 uint32_t body_names_lengthT = ((uint32_t) (*(inbuffer + offset)));
Gary Servin 0:04ac6be8229a 203 body_names_lengthT |= ((uint32_t) (*(inbuffer + offset + 1))) << (8 * 1);
Gary Servin 0:04ac6be8229a 204 body_names_lengthT |= ((uint32_t) (*(inbuffer + offset + 2))) << (8 * 2);
Gary Servin 0:04ac6be8229a 205 body_names_lengthT |= ((uint32_t) (*(inbuffer + offset + 3))) << (8 * 3);
Gary Servin 0:04ac6be8229a 206 offset += sizeof(this->body_names_length);
Gary Servin 0:04ac6be8229a 207 if(body_names_lengthT > body_names_length)
Gary Servin 0:04ac6be8229a 208 this->body_names = (char**)realloc(this->body_names, body_names_lengthT * sizeof(char*));
Gary Servin 0:04ac6be8229a 209 body_names_length = body_names_lengthT;
Gary Servin 0:04ac6be8229a 210 for( uint32_t i = 0; i < body_names_length; i++){
Gary Servin 0:04ac6be8229a 211 uint32_t length_st_body_names;
Gary Servin 0:04ac6be8229a 212 arrToVar(length_st_body_names, (inbuffer + offset));
Gary Servin 0:04ac6be8229a 213 offset += 4;
Gary Servin 0:04ac6be8229a 214 for(unsigned int k= offset; k< offset+length_st_body_names; ++k){
Gary Servin 0:04ac6be8229a 215 inbuffer[k-1]=inbuffer[k];
Gary Servin 0:04ac6be8229a 216 }
Gary Servin 0:04ac6be8229a 217 inbuffer[offset+length_st_body_names-1]=0;
Gary Servin 0:04ac6be8229a 218 this->st_body_names = (char *)(inbuffer + offset-1);
Gary Servin 0:04ac6be8229a 219 offset += length_st_body_names;
Gary Servin 0:04ac6be8229a 220 memcpy( &(this->body_names[i]), &(this->st_body_names), sizeof(char*));
Gary Servin 0:04ac6be8229a 221 }
Gary Servin 0:04ac6be8229a 222 uint32_t geom_names_lengthT = ((uint32_t) (*(inbuffer + offset)));
Gary Servin 0:04ac6be8229a 223 geom_names_lengthT |= ((uint32_t) (*(inbuffer + offset + 1))) << (8 * 1);
Gary Servin 0:04ac6be8229a 224 geom_names_lengthT |= ((uint32_t) (*(inbuffer + offset + 2))) << (8 * 2);
Gary Servin 0:04ac6be8229a 225 geom_names_lengthT |= ((uint32_t) (*(inbuffer + offset + 3))) << (8 * 3);
Gary Servin 0:04ac6be8229a 226 offset += sizeof(this->geom_names_length);
Gary Servin 0:04ac6be8229a 227 if(geom_names_lengthT > geom_names_length)
Gary Servin 0:04ac6be8229a 228 this->geom_names = (char**)realloc(this->geom_names, geom_names_lengthT * sizeof(char*));
Gary Servin 0:04ac6be8229a 229 geom_names_length = geom_names_lengthT;
Gary Servin 0:04ac6be8229a 230 for( uint32_t i = 0; i < geom_names_length; i++){
Gary Servin 0:04ac6be8229a 231 uint32_t length_st_geom_names;
Gary Servin 0:04ac6be8229a 232 arrToVar(length_st_geom_names, (inbuffer + offset));
Gary Servin 0:04ac6be8229a 233 offset += 4;
Gary Servin 0:04ac6be8229a 234 for(unsigned int k= offset; k< offset+length_st_geom_names; ++k){
Gary Servin 0:04ac6be8229a 235 inbuffer[k-1]=inbuffer[k];
Gary Servin 0:04ac6be8229a 236 }
Gary Servin 0:04ac6be8229a 237 inbuffer[offset+length_st_geom_names-1]=0;
Gary Servin 0:04ac6be8229a 238 this->st_geom_names = (char *)(inbuffer + offset-1);
Gary Servin 0:04ac6be8229a 239 offset += length_st_geom_names;
Gary Servin 0:04ac6be8229a 240 memcpy( &(this->geom_names[i]), &(this->st_geom_names), sizeof(char*));
Gary Servin 0:04ac6be8229a 241 }
Gary Servin 0:04ac6be8229a 242 uint32_t joint_names_lengthT = ((uint32_t) (*(inbuffer + offset)));
Gary Servin 0:04ac6be8229a 243 joint_names_lengthT |= ((uint32_t) (*(inbuffer + offset + 1))) << (8 * 1);
Gary Servin 0:04ac6be8229a 244 joint_names_lengthT |= ((uint32_t) (*(inbuffer + offset + 2))) << (8 * 2);
Gary Servin 0:04ac6be8229a 245 joint_names_lengthT |= ((uint32_t) (*(inbuffer + offset + 3))) << (8 * 3);
Gary Servin 0:04ac6be8229a 246 offset += sizeof(this->joint_names_length);
Gary Servin 0:04ac6be8229a 247 if(joint_names_lengthT > joint_names_length)
Gary Servin 0:04ac6be8229a 248 this->joint_names = (char**)realloc(this->joint_names, joint_names_lengthT * sizeof(char*));
Gary Servin 0:04ac6be8229a 249 joint_names_length = joint_names_lengthT;
Gary Servin 0:04ac6be8229a 250 for( uint32_t i = 0; i < joint_names_length; i++){
Gary Servin 0:04ac6be8229a 251 uint32_t length_st_joint_names;
Gary Servin 0:04ac6be8229a 252 arrToVar(length_st_joint_names, (inbuffer + offset));
Gary Servin 0:04ac6be8229a 253 offset += 4;
Gary Servin 0:04ac6be8229a 254 for(unsigned int k= offset; k< offset+length_st_joint_names; ++k){
Gary Servin 0:04ac6be8229a 255 inbuffer[k-1]=inbuffer[k];
Gary Servin 0:04ac6be8229a 256 }
Gary Servin 0:04ac6be8229a 257 inbuffer[offset+length_st_joint_names-1]=0;
Gary Servin 0:04ac6be8229a 258 this->st_joint_names = (char *)(inbuffer + offset-1);
Gary Servin 0:04ac6be8229a 259 offset += length_st_joint_names;
Gary Servin 0:04ac6be8229a 260 memcpy( &(this->joint_names[i]), &(this->st_joint_names), sizeof(char*));
Gary Servin 0:04ac6be8229a 261 }
Gary Servin 0:04ac6be8229a 262 uint32_t child_model_names_lengthT = ((uint32_t) (*(inbuffer + offset)));
Gary Servin 0:04ac6be8229a 263 child_model_names_lengthT |= ((uint32_t) (*(inbuffer + offset + 1))) << (8 * 1);
Gary Servin 0:04ac6be8229a 264 child_model_names_lengthT |= ((uint32_t) (*(inbuffer + offset + 2))) << (8 * 2);
Gary Servin 0:04ac6be8229a 265 child_model_names_lengthT |= ((uint32_t) (*(inbuffer + offset + 3))) << (8 * 3);
Gary Servin 0:04ac6be8229a 266 offset += sizeof(this->child_model_names_length);
Gary Servin 0:04ac6be8229a 267 if(child_model_names_lengthT > child_model_names_length)
Gary Servin 0:04ac6be8229a 268 this->child_model_names = (char**)realloc(this->child_model_names, child_model_names_lengthT * sizeof(char*));
Gary Servin 0:04ac6be8229a 269 child_model_names_length = child_model_names_lengthT;
Gary Servin 0:04ac6be8229a 270 for( uint32_t i = 0; i < child_model_names_length; i++){
Gary Servin 0:04ac6be8229a 271 uint32_t length_st_child_model_names;
Gary Servin 0:04ac6be8229a 272 arrToVar(length_st_child_model_names, (inbuffer + offset));
Gary Servin 0:04ac6be8229a 273 offset += 4;
Gary Servin 0:04ac6be8229a 274 for(unsigned int k= offset; k< offset+length_st_child_model_names; ++k){
Gary Servin 0:04ac6be8229a 275 inbuffer[k-1]=inbuffer[k];
Gary Servin 0:04ac6be8229a 276 }
Gary Servin 0:04ac6be8229a 277 inbuffer[offset+length_st_child_model_names-1]=0;
Gary Servin 0:04ac6be8229a 278 this->st_child_model_names = (char *)(inbuffer + offset-1);
Gary Servin 0:04ac6be8229a 279 offset += length_st_child_model_names;
Gary Servin 0:04ac6be8229a 280 memcpy( &(this->child_model_names[i]), &(this->st_child_model_names), sizeof(char*));
Gary Servin 0:04ac6be8229a 281 }
Gary Servin 0:04ac6be8229a 282 union {
Gary Servin 0:04ac6be8229a 283 bool real;
Gary Servin 0:04ac6be8229a 284 uint8_t base;
Gary Servin 0:04ac6be8229a 285 } u_is_static;
Gary Servin 0:04ac6be8229a 286 u_is_static.base = 0;
Gary Servin 0:04ac6be8229a 287 u_is_static.base |= ((uint8_t) (*(inbuffer + offset + 0))) << (8 * 0);
Gary Servin 0:04ac6be8229a 288 this->is_static = u_is_static.real;
Gary Servin 0:04ac6be8229a 289 offset += sizeof(this->is_static);
Gary Servin 0:04ac6be8229a 290 union {
Gary Servin 0:04ac6be8229a 291 bool real;
Gary Servin 0:04ac6be8229a 292 uint8_t base;
Gary Servin 0:04ac6be8229a 293 } u_success;
Gary Servin 0:04ac6be8229a 294 u_success.base = 0;
Gary Servin 0:04ac6be8229a 295 u_success.base |= ((uint8_t) (*(inbuffer + offset + 0))) << (8 * 0);
Gary Servin 0:04ac6be8229a 296 this->success = u_success.real;
Gary Servin 0:04ac6be8229a 297 offset += sizeof(this->success);
Gary Servin 0:04ac6be8229a 298 uint32_t length_status_message;
Gary Servin 0:04ac6be8229a 299 arrToVar(length_status_message, (inbuffer + offset));
Gary Servin 0:04ac6be8229a 300 offset += 4;
Gary Servin 0:04ac6be8229a 301 for(unsigned int k= offset; k< offset+length_status_message; ++k){
Gary Servin 0:04ac6be8229a 302 inbuffer[k-1]=inbuffer[k];
Gary Servin 0:04ac6be8229a 303 }
Gary Servin 0:04ac6be8229a 304 inbuffer[offset+length_status_message-1]=0;
Gary Servin 0:04ac6be8229a 305 this->status_message = (char *)(inbuffer + offset-1);
Gary Servin 0:04ac6be8229a 306 offset += length_status_message;
Gary Servin 0:04ac6be8229a 307 return offset;
Gary Servin 0:04ac6be8229a 308 }
Gary Servin 0:04ac6be8229a 309
Gary Servin 0:04ac6be8229a 310 const char * getType(){ return GETMODELPROPERTIES; };
Gary Servin 0:04ac6be8229a 311 const char * getMD5(){ return "b7f370938ef77b464b95f1bab3ec5028"; };
Gary Servin 0:04ac6be8229a 312
Gary Servin 0:04ac6be8229a 313 };
Gary Servin 0:04ac6be8229a 314
Gary Servin 0:04ac6be8229a 315 class GetModelProperties {
Gary Servin 0:04ac6be8229a 316 public:
Gary Servin 0:04ac6be8229a 317 typedef GetModelPropertiesRequest Request;
Gary Servin 0:04ac6be8229a 318 typedef GetModelPropertiesResponse Response;
Gary Servin 0:04ac6be8229a 319 };
Gary Servin 0:04ac6be8229a 320
Gary Servin 0:04ac6be8229a 321 }
Gary Servin 0:04ac6be8229a 322 #endif