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

Dependencies:   BufferedSerial

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();
    }
}
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?

UserRevisionLine numberNew contents of line
garyservin 0:fd24f7ca9688 1 #ifndef _ROS_gazebo_msgs_ODEJointProperties_h
garyservin 0:fd24f7ca9688 2 #define _ROS_gazebo_msgs_ODEJointProperties_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
garyservin 0:fd24f7ca9688 9 namespace gazebo_msgs
garyservin 0:fd24f7ca9688 10 {
garyservin 0:fd24f7ca9688 11
garyservin 0:fd24f7ca9688 12 class ODEJointProperties : public ros::Msg
garyservin 0:fd24f7ca9688 13 {
garyservin 0:fd24f7ca9688 14 public:
garyservin 0:fd24f7ca9688 15 uint8_t damping_length;
garyservin 0:fd24f7ca9688 16 double st_damping;
garyservin 0:fd24f7ca9688 17 double * damping;
garyservin 0:fd24f7ca9688 18 uint8_t hiStop_length;
garyservin 0:fd24f7ca9688 19 double st_hiStop;
garyservin 0:fd24f7ca9688 20 double * hiStop;
garyservin 0:fd24f7ca9688 21 uint8_t loStop_length;
garyservin 0:fd24f7ca9688 22 double st_loStop;
garyservin 0:fd24f7ca9688 23 double * loStop;
garyservin 0:fd24f7ca9688 24 uint8_t erp_length;
garyservin 0:fd24f7ca9688 25 double st_erp;
garyservin 0:fd24f7ca9688 26 double * erp;
garyservin 0:fd24f7ca9688 27 uint8_t cfm_length;
garyservin 0:fd24f7ca9688 28 double st_cfm;
garyservin 0:fd24f7ca9688 29 double * cfm;
garyservin 0:fd24f7ca9688 30 uint8_t stop_erp_length;
garyservin 0:fd24f7ca9688 31 double st_stop_erp;
garyservin 0:fd24f7ca9688 32 double * stop_erp;
garyservin 0:fd24f7ca9688 33 uint8_t stop_cfm_length;
garyservin 0:fd24f7ca9688 34 double st_stop_cfm;
garyservin 0:fd24f7ca9688 35 double * stop_cfm;
garyservin 0:fd24f7ca9688 36 uint8_t fudge_factor_length;
garyservin 0:fd24f7ca9688 37 double st_fudge_factor;
garyservin 0:fd24f7ca9688 38 double * fudge_factor;
garyservin 0:fd24f7ca9688 39 uint8_t fmax_length;
garyservin 0:fd24f7ca9688 40 double st_fmax;
garyservin 0:fd24f7ca9688 41 double * fmax;
garyservin 0:fd24f7ca9688 42 uint8_t vel_length;
garyservin 0:fd24f7ca9688 43 double st_vel;
garyservin 0:fd24f7ca9688 44 double * vel;
garyservin 0:fd24f7ca9688 45
garyservin 0:fd24f7ca9688 46 ODEJointProperties():
garyservin 0:fd24f7ca9688 47 damping_length(0), damping(NULL),
garyservin 0:fd24f7ca9688 48 hiStop_length(0), hiStop(NULL),
garyservin 0:fd24f7ca9688 49 loStop_length(0), loStop(NULL),
garyservin 0:fd24f7ca9688 50 erp_length(0), erp(NULL),
garyservin 0:fd24f7ca9688 51 cfm_length(0), cfm(NULL),
garyservin 0:fd24f7ca9688 52 stop_erp_length(0), stop_erp(NULL),
garyservin 0:fd24f7ca9688 53 stop_cfm_length(0), stop_cfm(NULL),
garyservin 0:fd24f7ca9688 54 fudge_factor_length(0), fudge_factor(NULL),
garyservin 0:fd24f7ca9688 55 fmax_length(0), fmax(NULL),
garyservin 0:fd24f7ca9688 56 vel_length(0), vel(NULL)
garyservin 0:fd24f7ca9688 57 {
garyservin 0:fd24f7ca9688 58 }
garyservin 0:fd24f7ca9688 59
garyservin 0:fd24f7ca9688 60 virtual int serialize(unsigned char *outbuffer) const
garyservin 0:fd24f7ca9688 61 {
garyservin 0:fd24f7ca9688 62 int offset = 0;
garyservin 0:fd24f7ca9688 63 *(outbuffer + offset++) = damping_length;
garyservin 0:fd24f7ca9688 64 *(outbuffer + offset++) = 0;
garyservin 0:fd24f7ca9688 65 *(outbuffer + offset++) = 0;
garyservin 0:fd24f7ca9688 66 *(outbuffer + offset++) = 0;
garyservin 0:fd24f7ca9688 67 for( uint8_t i = 0; i < damping_length; i++){
garyservin 0:fd24f7ca9688 68 union {
garyservin 0:fd24f7ca9688 69 double real;
garyservin 0:fd24f7ca9688 70 uint64_t base;
garyservin 0:fd24f7ca9688 71 } u_dampingi;
garyservin 0:fd24f7ca9688 72 u_dampingi.real = this->damping[i];
garyservin 0:fd24f7ca9688 73 *(outbuffer + offset + 0) = (u_dampingi.base >> (8 * 0)) & 0xFF;
garyservin 0:fd24f7ca9688 74 *(outbuffer + offset + 1) = (u_dampingi.base >> (8 * 1)) & 0xFF;
garyservin 0:fd24f7ca9688 75 *(outbuffer + offset + 2) = (u_dampingi.base >> (8 * 2)) & 0xFF;
garyservin 0:fd24f7ca9688 76 *(outbuffer + offset + 3) = (u_dampingi.base >> (8 * 3)) & 0xFF;
garyservin 0:fd24f7ca9688 77 *(outbuffer + offset + 4) = (u_dampingi.base >> (8 * 4)) & 0xFF;
garyservin 0:fd24f7ca9688 78 *(outbuffer + offset + 5) = (u_dampingi.base >> (8 * 5)) & 0xFF;
garyservin 0:fd24f7ca9688 79 *(outbuffer + offset + 6) = (u_dampingi.base >> (8 * 6)) & 0xFF;
garyservin 0:fd24f7ca9688 80 *(outbuffer + offset + 7) = (u_dampingi.base >> (8 * 7)) & 0xFF;
garyservin 0:fd24f7ca9688 81 offset += sizeof(this->damping[i]);
garyservin 0:fd24f7ca9688 82 }
garyservin 0:fd24f7ca9688 83 *(outbuffer + offset++) = hiStop_length;
garyservin 0:fd24f7ca9688 84 *(outbuffer + offset++) = 0;
garyservin 0:fd24f7ca9688 85 *(outbuffer + offset++) = 0;
garyservin 0:fd24f7ca9688 86 *(outbuffer + offset++) = 0;
garyservin 0:fd24f7ca9688 87 for( uint8_t i = 0; i < hiStop_length; i++){
garyservin 0:fd24f7ca9688 88 union {
garyservin 0:fd24f7ca9688 89 double real;
garyservin 0:fd24f7ca9688 90 uint64_t base;
garyservin 0:fd24f7ca9688 91 } u_hiStopi;
garyservin 0:fd24f7ca9688 92 u_hiStopi.real = this->hiStop[i];
garyservin 0:fd24f7ca9688 93 *(outbuffer + offset + 0) = (u_hiStopi.base >> (8 * 0)) & 0xFF;
garyservin 0:fd24f7ca9688 94 *(outbuffer + offset + 1) = (u_hiStopi.base >> (8 * 1)) & 0xFF;
garyservin 0:fd24f7ca9688 95 *(outbuffer + offset + 2) = (u_hiStopi.base >> (8 * 2)) & 0xFF;
garyservin 0:fd24f7ca9688 96 *(outbuffer + offset + 3) = (u_hiStopi.base >> (8 * 3)) & 0xFF;
garyservin 0:fd24f7ca9688 97 *(outbuffer + offset + 4) = (u_hiStopi.base >> (8 * 4)) & 0xFF;
garyservin 0:fd24f7ca9688 98 *(outbuffer + offset + 5) = (u_hiStopi.base >> (8 * 5)) & 0xFF;
garyservin 0:fd24f7ca9688 99 *(outbuffer + offset + 6) = (u_hiStopi.base >> (8 * 6)) & 0xFF;
garyservin 0:fd24f7ca9688 100 *(outbuffer + offset + 7) = (u_hiStopi.base >> (8 * 7)) & 0xFF;
garyservin 0:fd24f7ca9688 101 offset += sizeof(this->hiStop[i]);
garyservin 0:fd24f7ca9688 102 }
garyservin 0:fd24f7ca9688 103 *(outbuffer + offset++) = loStop_length;
garyservin 0:fd24f7ca9688 104 *(outbuffer + offset++) = 0;
garyservin 0:fd24f7ca9688 105 *(outbuffer + offset++) = 0;
garyservin 0:fd24f7ca9688 106 *(outbuffer + offset++) = 0;
garyservin 0:fd24f7ca9688 107 for( uint8_t i = 0; i < loStop_length; i++){
garyservin 0:fd24f7ca9688 108 union {
garyservin 0:fd24f7ca9688 109 double real;
garyservin 0:fd24f7ca9688 110 uint64_t base;
garyservin 0:fd24f7ca9688 111 } u_loStopi;
garyservin 0:fd24f7ca9688 112 u_loStopi.real = this->loStop[i];
garyservin 0:fd24f7ca9688 113 *(outbuffer + offset + 0) = (u_loStopi.base >> (8 * 0)) & 0xFF;
garyservin 0:fd24f7ca9688 114 *(outbuffer + offset + 1) = (u_loStopi.base >> (8 * 1)) & 0xFF;
garyservin 0:fd24f7ca9688 115 *(outbuffer + offset + 2) = (u_loStopi.base >> (8 * 2)) & 0xFF;
garyservin 0:fd24f7ca9688 116 *(outbuffer + offset + 3) = (u_loStopi.base >> (8 * 3)) & 0xFF;
garyservin 0:fd24f7ca9688 117 *(outbuffer + offset + 4) = (u_loStopi.base >> (8 * 4)) & 0xFF;
garyservin 0:fd24f7ca9688 118 *(outbuffer + offset + 5) = (u_loStopi.base >> (8 * 5)) & 0xFF;
garyservin 0:fd24f7ca9688 119 *(outbuffer + offset + 6) = (u_loStopi.base >> (8 * 6)) & 0xFF;
garyservin 0:fd24f7ca9688 120 *(outbuffer + offset + 7) = (u_loStopi.base >> (8 * 7)) & 0xFF;
garyservin 0:fd24f7ca9688 121 offset += sizeof(this->loStop[i]);
garyservin 0:fd24f7ca9688 122 }
garyservin 0:fd24f7ca9688 123 *(outbuffer + offset++) = erp_length;
garyservin 0:fd24f7ca9688 124 *(outbuffer + offset++) = 0;
garyservin 0:fd24f7ca9688 125 *(outbuffer + offset++) = 0;
garyservin 0:fd24f7ca9688 126 *(outbuffer + offset++) = 0;
garyservin 0:fd24f7ca9688 127 for( uint8_t i = 0; i < erp_length; i++){
garyservin 0:fd24f7ca9688 128 union {
garyservin 0:fd24f7ca9688 129 double real;
garyservin 0:fd24f7ca9688 130 uint64_t base;
garyservin 0:fd24f7ca9688 131 } u_erpi;
garyservin 0:fd24f7ca9688 132 u_erpi.real = this->erp[i];
garyservin 0:fd24f7ca9688 133 *(outbuffer + offset + 0) = (u_erpi.base >> (8 * 0)) & 0xFF;
garyservin 0:fd24f7ca9688 134 *(outbuffer + offset + 1) = (u_erpi.base >> (8 * 1)) & 0xFF;
garyservin 0:fd24f7ca9688 135 *(outbuffer + offset + 2) = (u_erpi.base >> (8 * 2)) & 0xFF;
garyservin 0:fd24f7ca9688 136 *(outbuffer + offset + 3) = (u_erpi.base >> (8 * 3)) & 0xFF;
garyservin 0:fd24f7ca9688 137 *(outbuffer + offset + 4) = (u_erpi.base >> (8 * 4)) & 0xFF;
garyservin 0:fd24f7ca9688 138 *(outbuffer + offset + 5) = (u_erpi.base >> (8 * 5)) & 0xFF;
garyservin 0:fd24f7ca9688 139 *(outbuffer + offset + 6) = (u_erpi.base >> (8 * 6)) & 0xFF;
garyservin 0:fd24f7ca9688 140 *(outbuffer + offset + 7) = (u_erpi.base >> (8 * 7)) & 0xFF;
garyservin 0:fd24f7ca9688 141 offset += sizeof(this->erp[i]);
garyservin 0:fd24f7ca9688 142 }
garyservin 0:fd24f7ca9688 143 *(outbuffer + offset++) = cfm_length;
garyservin 0:fd24f7ca9688 144 *(outbuffer + offset++) = 0;
garyservin 0:fd24f7ca9688 145 *(outbuffer + offset++) = 0;
garyservin 0:fd24f7ca9688 146 *(outbuffer + offset++) = 0;
garyservin 0:fd24f7ca9688 147 for( uint8_t i = 0; i < cfm_length; i++){
garyservin 0:fd24f7ca9688 148 union {
garyservin 0:fd24f7ca9688 149 double real;
garyservin 0:fd24f7ca9688 150 uint64_t base;
garyservin 0:fd24f7ca9688 151 } u_cfmi;
garyservin 0:fd24f7ca9688 152 u_cfmi.real = this->cfm[i];
garyservin 0:fd24f7ca9688 153 *(outbuffer + offset + 0) = (u_cfmi.base >> (8 * 0)) & 0xFF;
garyservin 0:fd24f7ca9688 154 *(outbuffer + offset + 1) = (u_cfmi.base >> (8 * 1)) & 0xFF;
garyservin 0:fd24f7ca9688 155 *(outbuffer + offset + 2) = (u_cfmi.base >> (8 * 2)) & 0xFF;
garyservin 0:fd24f7ca9688 156 *(outbuffer + offset + 3) = (u_cfmi.base >> (8 * 3)) & 0xFF;
garyservin 0:fd24f7ca9688 157 *(outbuffer + offset + 4) = (u_cfmi.base >> (8 * 4)) & 0xFF;
garyservin 0:fd24f7ca9688 158 *(outbuffer + offset + 5) = (u_cfmi.base >> (8 * 5)) & 0xFF;
garyservin 0:fd24f7ca9688 159 *(outbuffer + offset + 6) = (u_cfmi.base >> (8 * 6)) & 0xFF;
garyservin 0:fd24f7ca9688 160 *(outbuffer + offset + 7) = (u_cfmi.base >> (8 * 7)) & 0xFF;
garyservin 0:fd24f7ca9688 161 offset += sizeof(this->cfm[i]);
garyservin 0:fd24f7ca9688 162 }
garyservin 0:fd24f7ca9688 163 *(outbuffer + offset++) = stop_erp_length;
garyservin 0:fd24f7ca9688 164 *(outbuffer + offset++) = 0;
garyservin 0:fd24f7ca9688 165 *(outbuffer + offset++) = 0;
garyservin 0:fd24f7ca9688 166 *(outbuffer + offset++) = 0;
garyservin 0:fd24f7ca9688 167 for( uint8_t i = 0; i < stop_erp_length; i++){
garyservin 0:fd24f7ca9688 168 union {
garyservin 0:fd24f7ca9688 169 double real;
garyservin 0:fd24f7ca9688 170 uint64_t base;
garyservin 0:fd24f7ca9688 171 } u_stop_erpi;
garyservin 0:fd24f7ca9688 172 u_stop_erpi.real = this->stop_erp[i];
garyservin 0:fd24f7ca9688 173 *(outbuffer + offset + 0) = (u_stop_erpi.base >> (8 * 0)) & 0xFF;
garyservin 0:fd24f7ca9688 174 *(outbuffer + offset + 1) = (u_stop_erpi.base >> (8 * 1)) & 0xFF;
garyservin 0:fd24f7ca9688 175 *(outbuffer + offset + 2) = (u_stop_erpi.base >> (8 * 2)) & 0xFF;
garyservin 0:fd24f7ca9688 176 *(outbuffer + offset + 3) = (u_stop_erpi.base >> (8 * 3)) & 0xFF;
garyservin 0:fd24f7ca9688 177 *(outbuffer + offset + 4) = (u_stop_erpi.base >> (8 * 4)) & 0xFF;
garyservin 0:fd24f7ca9688 178 *(outbuffer + offset + 5) = (u_stop_erpi.base >> (8 * 5)) & 0xFF;
garyservin 0:fd24f7ca9688 179 *(outbuffer + offset + 6) = (u_stop_erpi.base >> (8 * 6)) & 0xFF;
garyservin 0:fd24f7ca9688 180 *(outbuffer + offset + 7) = (u_stop_erpi.base >> (8 * 7)) & 0xFF;
garyservin 0:fd24f7ca9688 181 offset += sizeof(this->stop_erp[i]);
garyservin 0:fd24f7ca9688 182 }
garyservin 0:fd24f7ca9688 183 *(outbuffer + offset++) = stop_cfm_length;
garyservin 0:fd24f7ca9688 184 *(outbuffer + offset++) = 0;
garyservin 0:fd24f7ca9688 185 *(outbuffer + offset++) = 0;
garyservin 0:fd24f7ca9688 186 *(outbuffer + offset++) = 0;
garyservin 0:fd24f7ca9688 187 for( uint8_t i = 0; i < stop_cfm_length; i++){
garyservin 0:fd24f7ca9688 188 union {
garyservin 0:fd24f7ca9688 189 double real;
garyservin 0:fd24f7ca9688 190 uint64_t base;
garyservin 0:fd24f7ca9688 191 } u_stop_cfmi;
garyservin 0:fd24f7ca9688 192 u_stop_cfmi.real = this->stop_cfm[i];
garyservin 0:fd24f7ca9688 193 *(outbuffer + offset + 0) = (u_stop_cfmi.base >> (8 * 0)) & 0xFF;
garyservin 0:fd24f7ca9688 194 *(outbuffer + offset + 1) = (u_stop_cfmi.base >> (8 * 1)) & 0xFF;
garyservin 0:fd24f7ca9688 195 *(outbuffer + offset + 2) = (u_stop_cfmi.base >> (8 * 2)) & 0xFF;
garyservin 0:fd24f7ca9688 196 *(outbuffer + offset + 3) = (u_stop_cfmi.base >> (8 * 3)) & 0xFF;
garyservin 0:fd24f7ca9688 197 *(outbuffer + offset + 4) = (u_stop_cfmi.base >> (8 * 4)) & 0xFF;
garyservin 0:fd24f7ca9688 198 *(outbuffer + offset + 5) = (u_stop_cfmi.base >> (8 * 5)) & 0xFF;
garyservin 0:fd24f7ca9688 199 *(outbuffer + offset + 6) = (u_stop_cfmi.base >> (8 * 6)) & 0xFF;
garyservin 0:fd24f7ca9688 200 *(outbuffer + offset + 7) = (u_stop_cfmi.base >> (8 * 7)) & 0xFF;
garyservin 0:fd24f7ca9688 201 offset += sizeof(this->stop_cfm[i]);
garyservin 0:fd24f7ca9688 202 }
garyservin 0:fd24f7ca9688 203 *(outbuffer + offset++) = fudge_factor_length;
garyservin 0:fd24f7ca9688 204 *(outbuffer + offset++) = 0;
garyservin 0:fd24f7ca9688 205 *(outbuffer + offset++) = 0;
garyservin 0:fd24f7ca9688 206 *(outbuffer + offset++) = 0;
garyservin 0:fd24f7ca9688 207 for( uint8_t i = 0; i < fudge_factor_length; i++){
garyservin 0:fd24f7ca9688 208 union {
garyservin 0:fd24f7ca9688 209 double real;
garyservin 0:fd24f7ca9688 210 uint64_t base;
garyservin 0:fd24f7ca9688 211 } u_fudge_factori;
garyservin 0:fd24f7ca9688 212 u_fudge_factori.real = this->fudge_factor[i];
garyservin 0:fd24f7ca9688 213 *(outbuffer + offset + 0) = (u_fudge_factori.base >> (8 * 0)) & 0xFF;
garyservin 0:fd24f7ca9688 214 *(outbuffer + offset + 1) = (u_fudge_factori.base >> (8 * 1)) & 0xFF;
garyservin 0:fd24f7ca9688 215 *(outbuffer + offset + 2) = (u_fudge_factori.base >> (8 * 2)) & 0xFF;
garyservin 0:fd24f7ca9688 216 *(outbuffer + offset + 3) = (u_fudge_factori.base >> (8 * 3)) & 0xFF;
garyservin 0:fd24f7ca9688 217 *(outbuffer + offset + 4) = (u_fudge_factori.base >> (8 * 4)) & 0xFF;
garyservin 0:fd24f7ca9688 218 *(outbuffer + offset + 5) = (u_fudge_factori.base >> (8 * 5)) & 0xFF;
garyservin 0:fd24f7ca9688 219 *(outbuffer + offset + 6) = (u_fudge_factori.base >> (8 * 6)) & 0xFF;
garyservin 0:fd24f7ca9688 220 *(outbuffer + offset + 7) = (u_fudge_factori.base >> (8 * 7)) & 0xFF;
garyservin 0:fd24f7ca9688 221 offset += sizeof(this->fudge_factor[i]);
garyservin 0:fd24f7ca9688 222 }
garyservin 0:fd24f7ca9688 223 *(outbuffer + offset++) = fmax_length;
garyservin 0:fd24f7ca9688 224 *(outbuffer + offset++) = 0;
garyservin 0:fd24f7ca9688 225 *(outbuffer + offset++) = 0;
garyservin 0:fd24f7ca9688 226 *(outbuffer + offset++) = 0;
garyservin 0:fd24f7ca9688 227 for( uint8_t i = 0; i < fmax_length; i++){
garyservin 0:fd24f7ca9688 228 union {
garyservin 0:fd24f7ca9688 229 double real;
garyservin 0:fd24f7ca9688 230 uint64_t base;
garyservin 0:fd24f7ca9688 231 } u_fmaxi;
garyservin 0:fd24f7ca9688 232 u_fmaxi.real = this->fmax[i];
garyservin 0:fd24f7ca9688 233 *(outbuffer + offset + 0) = (u_fmaxi.base >> (8 * 0)) & 0xFF;
garyservin 0:fd24f7ca9688 234 *(outbuffer + offset + 1) = (u_fmaxi.base >> (8 * 1)) & 0xFF;
garyservin 0:fd24f7ca9688 235 *(outbuffer + offset + 2) = (u_fmaxi.base >> (8 * 2)) & 0xFF;
garyservin 0:fd24f7ca9688 236 *(outbuffer + offset + 3) = (u_fmaxi.base >> (8 * 3)) & 0xFF;
garyservin 0:fd24f7ca9688 237 *(outbuffer + offset + 4) = (u_fmaxi.base >> (8 * 4)) & 0xFF;
garyservin 0:fd24f7ca9688 238 *(outbuffer + offset + 5) = (u_fmaxi.base >> (8 * 5)) & 0xFF;
garyservin 0:fd24f7ca9688 239 *(outbuffer + offset + 6) = (u_fmaxi.base >> (8 * 6)) & 0xFF;
garyservin 0:fd24f7ca9688 240 *(outbuffer + offset + 7) = (u_fmaxi.base >> (8 * 7)) & 0xFF;
garyservin 0:fd24f7ca9688 241 offset += sizeof(this->fmax[i]);
garyservin 0:fd24f7ca9688 242 }
garyservin 0:fd24f7ca9688 243 *(outbuffer + offset++) = vel_length;
garyservin 0:fd24f7ca9688 244 *(outbuffer + offset++) = 0;
garyservin 0:fd24f7ca9688 245 *(outbuffer + offset++) = 0;
garyservin 0:fd24f7ca9688 246 *(outbuffer + offset++) = 0;
garyservin 0:fd24f7ca9688 247 for( uint8_t i = 0; i < vel_length; i++){
garyservin 0:fd24f7ca9688 248 union {
garyservin 0:fd24f7ca9688 249 double real;
garyservin 0:fd24f7ca9688 250 uint64_t base;
garyservin 0:fd24f7ca9688 251 } u_veli;
garyservin 0:fd24f7ca9688 252 u_veli.real = this->vel[i];
garyservin 0:fd24f7ca9688 253 *(outbuffer + offset + 0) = (u_veli.base >> (8 * 0)) & 0xFF;
garyservin 0:fd24f7ca9688 254 *(outbuffer + offset + 1) = (u_veli.base >> (8 * 1)) & 0xFF;
garyservin 0:fd24f7ca9688 255 *(outbuffer + offset + 2) = (u_veli.base >> (8 * 2)) & 0xFF;
garyservin 0:fd24f7ca9688 256 *(outbuffer + offset + 3) = (u_veli.base >> (8 * 3)) & 0xFF;
garyservin 0:fd24f7ca9688 257 *(outbuffer + offset + 4) = (u_veli.base >> (8 * 4)) & 0xFF;
garyservin 0:fd24f7ca9688 258 *(outbuffer + offset + 5) = (u_veli.base >> (8 * 5)) & 0xFF;
garyservin 0:fd24f7ca9688 259 *(outbuffer + offset + 6) = (u_veli.base >> (8 * 6)) & 0xFF;
garyservin 0:fd24f7ca9688 260 *(outbuffer + offset + 7) = (u_veli.base >> (8 * 7)) & 0xFF;
garyservin 0:fd24f7ca9688 261 offset += sizeof(this->vel[i]);
garyservin 0:fd24f7ca9688 262 }
garyservin 0:fd24f7ca9688 263 return offset;
garyservin 0:fd24f7ca9688 264 }
garyservin 0:fd24f7ca9688 265
garyservin 0:fd24f7ca9688 266 virtual int deserialize(unsigned char *inbuffer)
garyservin 0:fd24f7ca9688 267 {
garyservin 0:fd24f7ca9688 268 int offset = 0;
garyservin 0:fd24f7ca9688 269 uint8_t damping_lengthT = *(inbuffer + offset++);
garyservin 0:fd24f7ca9688 270 if(damping_lengthT > damping_length)
garyservin 0:fd24f7ca9688 271 this->damping = (double*)realloc(this->damping, damping_lengthT * sizeof(double));
garyservin 0:fd24f7ca9688 272 offset += 3;
garyservin 0:fd24f7ca9688 273 damping_length = damping_lengthT;
garyservin 0:fd24f7ca9688 274 for( uint8_t i = 0; i < damping_length; i++){
garyservin 0:fd24f7ca9688 275 union {
garyservin 0:fd24f7ca9688 276 double real;
garyservin 0:fd24f7ca9688 277 uint64_t base;
garyservin 0:fd24f7ca9688 278 } u_st_damping;
garyservin 0:fd24f7ca9688 279 u_st_damping.base = 0;
garyservin 0:fd24f7ca9688 280 u_st_damping.base |= ((uint64_t) (*(inbuffer + offset + 0))) << (8 * 0);
garyservin 0:fd24f7ca9688 281 u_st_damping.base |= ((uint64_t) (*(inbuffer + offset + 1))) << (8 * 1);
garyservin 0:fd24f7ca9688 282 u_st_damping.base |= ((uint64_t) (*(inbuffer + offset + 2))) << (8 * 2);
garyservin 0:fd24f7ca9688 283 u_st_damping.base |= ((uint64_t) (*(inbuffer + offset + 3))) << (8 * 3);
garyservin 0:fd24f7ca9688 284 u_st_damping.base |= ((uint64_t) (*(inbuffer + offset + 4))) << (8 * 4);
garyservin 0:fd24f7ca9688 285 u_st_damping.base |= ((uint64_t) (*(inbuffer + offset + 5))) << (8 * 5);
garyservin 0:fd24f7ca9688 286 u_st_damping.base |= ((uint64_t) (*(inbuffer + offset + 6))) << (8 * 6);
garyservin 0:fd24f7ca9688 287 u_st_damping.base |= ((uint64_t) (*(inbuffer + offset + 7))) << (8 * 7);
garyservin 0:fd24f7ca9688 288 this->st_damping = u_st_damping.real;
garyservin 0:fd24f7ca9688 289 offset += sizeof(this->st_damping);
garyservin 0:fd24f7ca9688 290 memcpy( &(this->damping[i]), &(this->st_damping), sizeof(double));
garyservin 0:fd24f7ca9688 291 }
garyservin 0:fd24f7ca9688 292 uint8_t hiStop_lengthT = *(inbuffer + offset++);
garyservin 0:fd24f7ca9688 293 if(hiStop_lengthT > hiStop_length)
garyservin 0:fd24f7ca9688 294 this->hiStop = (double*)realloc(this->hiStop, hiStop_lengthT * sizeof(double));
garyservin 0:fd24f7ca9688 295 offset += 3;
garyservin 0:fd24f7ca9688 296 hiStop_length = hiStop_lengthT;
garyservin 0:fd24f7ca9688 297 for( uint8_t i = 0; i < hiStop_length; i++){
garyservin 0:fd24f7ca9688 298 union {
garyservin 0:fd24f7ca9688 299 double real;
garyservin 0:fd24f7ca9688 300 uint64_t base;
garyservin 0:fd24f7ca9688 301 } u_st_hiStop;
garyservin 0:fd24f7ca9688 302 u_st_hiStop.base = 0;
garyservin 0:fd24f7ca9688 303 u_st_hiStop.base |= ((uint64_t) (*(inbuffer + offset + 0))) << (8 * 0);
garyservin 0:fd24f7ca9688 304 u_st_hiStop.base |= ((uint64_t) (*(inbuffer + offset + 1))) << (8 * 1);
garyservin 0:fd24f7ca9688 305 u_st_hiStop.base |= ((uint64_t) (*(inbuffer + offset + 2))) << (8 * 2);
garyservin 0:fd24f7ca9688 306 u_st_hiStop.base |= ((uint64_t) (*(inbuffer + offset + 3))) << (8 * 3);
garyservin 0:fd24f7ca9688 307 u_st_hiStop.base |= ((uint64_t) (*(inbuffer + offset + 4))) << (8 * 4);
garyservin 0:fd24f7ca9688 308 u_st_hiStop.base |= ((uint64_t) (*(inbuffer + offset + 5))) << (8 * 5);
garyservin 0:fd24f7ca9688 309 u_st_hiStop.base |= ((uint64_t) (*(inbuffer + offset + 6))) << (8 * 6);
garyservin 0:fd24f7ca9688 310 u_st_hiStop.base |= ((uint64_t) (*(inbuffer + offset + 7))) << (8 * 7);
garyservin 0:fd24f7ca9688 311 this->st_hiStop = u_st_hiStop.real;
garyservin 0:fd24f7ca9688 312 offset += sizeof(this->st_hiStop);
garyservin 0:fd24f7ca9688 313 memcpy( &(this->hiStop[i]), &(this->st_hiStop), sizeof(double));
garyservin 0:fd24f7ca9688 314 }
garyservin 0:fd24f7ca9688 315 uint8_t loStop_lengthT = *(inbuffer + offset++);
garyservin 0:fd24f7ca9688 316 if(loStop_lengthT > loStop_length)
garyservin 0:fd24f7ca9688 317 this->loStop = (double*)realloc(this->loStop, loStop_lengthT * sizeof(double));
garyservin 0:fd24f7ca9688 318 offset += 3;
garyservin 0:fd24f7ca9688 319 loStop_length = loStop_lengthT;
garyservin 0:fd24f7ca9688 320 for( uint8_t i = 0; i < loStop_length; i++){
garyservin 0:fd24f7ca9688 321 union {
garyservin 0:fd24f7ca9688 322 double real;
garyservin 0:fd24f7ca9688 323 uint64_t base;
garyservin 0:fd24f7ca9688 324 } u_st_loStop;
garyservin 0:fd24f7ca9688 325 u_st_loStop.base = 0;
garyservin 0:fd24f7ca9688 326 u_st_loStop.base |= ((uint64_t) (*(inbuffer + offset + 0))) << (8 * 0);
garyservin 0:fd24f7ca9688 327 u_st_loStop.base |= ((uint64_t) (*(inbuffer + offset + 1))) << (8 * 1);
garyservin 0:fd24f7ca9688 328 u_st_loStop.base |= ((uint64_t) (*(inbuffer + offset + 2))) << (8 * 2);
garyservin 0:fd24f7ca9688 329 u_st_loStop.base |= ((uint64_t) (*(inbuffer + offset + 3))) << (8 * 3);
garyservin 0:fd24f7ca9688 330 u_st_loStop.base |= ((uint64_t) (*(inbuffer + offset + 4))) << (8 * 4);
garyservin 0:fd24f7ca9688 331 u_st_loStop.base |= ((uint64_t) (*(inbuffer + offset + 5))) << (8 * 5);
garyservin 0:fd24f7ca9688 332 u_st_loStop.base |= ((uint64_t) (*(inbuffer + offset + 6))) << (8 * 6);
garyservin 0:fd24f7ca9688 333 u_st_loStop.base |= ((uint64_t) (*(inbuffer + offset + 7))) << (8 * 7);
garyservin 0:fd24f7ca9688 334 this->st_loStop = u_st_loStop.real;
garyservin 0:fd24f7ca9688 335 offset += sizeof(this->st_loStop);
garyservin 0:fd24f7ca9688 336 memcpy( &(this->loStop[i]), &(this->st_loStop), sizeof(double));
garyservin 0:fd24f7ca9688 337 }
garyservin 0:fd24f7ca9688 338 uint8_t erp_lengthT = *(inbuffer + offset++);
garyservin 0:fd24f7ca9688 339 if(erp_lengthT > erp_length)
garyservin 0:fd24f7ca9688 340 this->erp = (double*)realloc(this->erp, erp_lengthT * sizeof(double));
garyservin 0:fd24f7ca9688 341 offset += 3;
garyservin 0:fd24f7ca9688 342 erp_length = erp_lengthT;
garyservin 0:fd24f7ca9688 343 for( uint8_t i = 0; i < erp_length; i++){
garyservin 0:fd24f7ca9688 344 union {
garyservin 0:fd24f7ca9688 345 double real;
garyservin 0:fd24f7ca9688 346 uint64_t base;
garyservin 0:fd24f7ca9688 347 } u_st_erp;
garyservin 0:fd24f7ca9688 348 u_st_erp.base = 0;
garyservin 0:fd24f7ca9688 349 u_st_erp.base |= ((uint64_t) (*(inbuffer + offset + 0))) << (8 * 0);
garyservin 0:fd24f7ca9688 350 u_st_erp.base |= ((uint64_t) (*(inbuffer + offset + 1))) << (8 * 1);
garyservin 0:fd24f7ca9688 351 u_st_erp.base |= ((uint64_t) (*(inbuffer + offset + 2))) << (8 * 2);
garyservin 0:fd24f7ca9688 352 u_st_erp.base |= ((uint64_t) (*(inbuffer + offset + 3))) << (8 * 3);
garyservin 0:fd24f7ca9688 353 u_st_erp.base |= ((uint64_t) (*(inbuffer + offset + 4))) << (8 * 4);
garyservin 0:fd24f7ca9688 354 u_st_erp.base |= ((uint64_t) (*(inbuffer + offset + 5))) << (8 * 5);
garyservin 0:fd24f7ca9688 355 u_st_erp.base |= ((uint64_t) (*(inbuffer + offset + 6))) << (8 * 6);
garyservin 0:fd24f7ca9688 356 u_st_erp.base |= ((uint64_t) (*(inbuffer + offset + 7))) << (8 * 7);
garyservin 0:fd24f7ca9688 357 this->st_erp = u_st_erp.real;
garyservin 0:fd24f7ca9688 358 offset += sizeof(this->st_erp);
garyservin 0:fd24f7ca9688 359 memcpy( &(this->erp[i]), &(this->st_erp), sizeof(double));
garyservin 0:fd24f7ca9688 360 }
garyservin 0:fd24f7ca9688 361 uint8_t cfm_lengthT = *(inbuffer + offset++);
garyservin 0:fd24f7ca9688 362 if(cfm_lengthT > cfm_length)
garyservin 0:fd24f7ca9688 363 this->cfm = (double*)realloc(this->cfm, cfm_lengthT * sizeof(double));
garyservin 0:fd24f7ca9688 364 offset += 3;
garyservin 0:fd24f7ca9688 365 cfm_length = cfm_lengthT;
garyservin 0:fd24f7ca9688 366 for( uint8_t i = 0; i < cfm_length; i++){
garyservin 0:fd24f7ca9688 367 union {
garyservin 0:fd24f7ca9688 368 double real;
garyservin 0:fd24f7ca9688 369 uint64_t base;
garyservin 0:fd24f7ca9688 370 } u_st_cfm;
garyservin 0:fd24f7ca9688 371 u_st_cfm.base = 0;
garyservin 0:fd24f7ca9688 372 u_st_cfm.base |= ((uint64_t) (*(inbuffer + offset + 0))) << (8 * 0);
garyservin 0:fd24f7ca9688 373 u_st_cfm.base |= ((uint64_t) (*(inbuffer + offset + 1))) << (8 * 1);
garyservin 0:fd24f7ca9688 374 u_st_cfm.base |= ((uint64_t) (*(inbuffer + offset + 2))) << (8 * 2);
garyservin 0:fd24f7ca9688 375 u_st_cfm.base |= ((uint64_t) (*(inbuffer + offset + 3))) << (8 * 3);
garyservin 0:fd24f7ca9688 376 u_st_cfm.base |= ((uint64_t) (*(inbuffer + offset + 4))) << (8 * 4);
garyservin 0:fd24f7ca9688 377 u_st_cfm.base |= ((uint64_t) (*(inbuffer + offset + 5))) << (8 * 5);
garyservin 0:fd24f7ca9688 378 u_st_cfm.base |= ((uint64_t) (*(inbuffer + offset + 6))) << (8 * 6);
garyservin 0:fd24f7ca9688 379 u_st_cfm.base |= ((uint64_t) (*(inbuffer + offset + 7))) << (8 * 7);
garyservin 0:fd24f7ca9688 380 this->st_cfm = u_st_cfm.real;
garyservin 0:fd24f7ca9688 381 offset += sizeof(this->st_cfm);
garyservin 0:fd24f7ca9688 382 memcpy( &(this->cfm[i]), &(this->st_cfm), sizeof(double));
garyservin 0:fd24f7ca9688 383 }
garyservin 0:fd24f7ca9688 384 uint8_t stop_erp_lengthT = *(inbuffer + offset++);
garyservin 0:fd24f7ca9688 385 if(stop_erp_lengthT > stop_erp_length)
garyservin 0:fd24f7ca9688 386 this->stop_erp = (double*)realloc(this->stop_erp, stop_erp_lengthT * sizeof(double));
garyservin 0:fd24f7ca9688 387 offset += 3;
garyservin 0:fd24f7ca9688 388 stop_erp_length = stop_erp_lengthT;
garyservin 0:fd24f7ca9688 389 for( uint8_t i = 0; i < stop_erp_length; i++){
garyservin 0:fd24f7ca9688 390 union {
garyservin 0:fd24f7ca9688 391 double real;
garyservin 0:fd24f7ca9688 392 uint64_t base;
garyservin 0:fd24f7ca9688 393 } u_st_stop_erp;
garyservin 0:fd24f7ca9688 394 u_st_stop_erp.base = 0;
garyservin 0:fd24f7ca9688 395 u_st_stop_erp.base |= ((uint64_t) (*(inbuffer + offset + 0))) << (8 * 0);
garyservin 0:fd24f7ca9688 396 u_st_stop_erp.base |= ((uint64_t) (*(inbuffer + offset + 1))) << (8 * 1);
garyservin 0:fd24f7ca9688 397 u_st_stop_erp.base |= ((uint64_t) (*(inbuffer + offset + 2))) << (8 * 2);
garyservin 0:fd24f7ca9688 398 u_st_stop_erp.base |= ((uint64_t) (*(inbuffer + offset + 3))) << (8 * 3);
garyservin 0:fd24f7ca9688 399 u_st_stop_erp.base |= ((uint64_t) (*(inbuffer + offset + 4))) << (8 * 4);
garyservin 0:fd24f7ca9688 400 u_st_stop_erp.base |= ((uint64_t) (*(inbuffer + offset + 5))) << (8 * 5);
garyservin 0:fd24f7ca9688 401 u_st_stop_erp.base |= ((uint64_t) (*(inbuffer + offset + 6))) << (8 * 6);
garyservin 0:fd24f7ca9688 402 u_st_stop_erp.base |= ((uint64_t) (*(inbuffer + offset + 7))) << (8 * 7);
garyservin 0:fd24f7ca9688 403 this->st_stop_erp = u_st_stop_erp.real;
garyservin 0:fd24f7ca9688 404 offset += sizeof(this->st_stop_erp);
garyservin 0:fd24f7ca9688 405 memcpy( &(this->stop_erp[i]), &(this->st_stop_erp), sizeof(double));
garyservin 0:fd24f7ca9688 406 }
garyservin 0:fd24f7ca9688 407 uint8_t stop_cfm_lengthT = *(inbuffer + offset++);
garyservin 0:fd24f7ca9688 408 if(stop_cfm_lengthT > stop_cfm_length)
garyservin 0:fd24f7ca9688 409 this->stop_cfm = (double*)realloc(this->stop_cfm, stop_cfm_lengthT * sizeof(double));
garyservin 0:fd24f7ca9688 410 offset += 3;
garyservin 0:fd24f7ca9688 411 stop_cfm_length = stop_cfm_lengthT;
garyservin 0:fd24f7ca9688 412 for( uint8_t i = 0; i < stop_cfm_length; i++){
garyservin 0:fd24f7ca9688 413 union {
garyservin 0:fd24f7ca9688 414 double real;
garyservin 0:fd24f7ca9688 415 uint64_t base;
garyservin 0:fd24f7ca9688 416 } u_st_stop_cfm;
garyservin 0:fd24f7ca9688 417 u_st_stop_cfm.base = 0;
garyservin 0:fd24f7ca9688 418 u_st_stop_cfm.base |= ((uint64_t) (*(inbuffer + offset + 0))) << (8 * 0);
garyservin 0:fd24f7ca9688 419 u_st_stop_cfm.base |= ((uint64_t) (*(inbuffer + offset + 1))) << (8 * 1);
garyservin 0:fd24f7ca9688 420 u_st_stop_cfm.base |= ((uint64_t) (*(inbuffer + offset + 2))) << (8 * 2);
garyservin 0:fd24f7ca9688 421 u_st_stop_cfm.base |= ((uint64_t) (*(inbuffer + offset + 3))) << (8 * 3);
garyservin 0:fd24f7ca9688 422 u_st_stop_cfm.base |= ((uint64_t) (*(inbuffer + offset + 4))) << (8 * 4);
garyservin 0:fd24f7ca9688 423 u_st_stop_cfm.base |= ((uint64_t) (*(inbuffer + offset + 5))) << (8 * 5);
garyservin 0:fd24f7ca9688 424 u_st_stop_cfm.base |= ((uint64_t) (*(inbuffer + offset + 6))) << (8 * 6);
garyservin 0:fd24f7ca9688 425 u_st_stop_cfm.base |= ((uint64_t) (*(inbuffer + offset + 7))) << (8 * 7);
garyservin 0:fd24f7ca9688 426 this->st_stop_cfm = u_st_stop_cfm.real;
garyservin 0:fd24f7ca9688 427 offset += sizeof(this->st_stop_cfm);
garyservin 0:fd24f7ca9688 428 memcpy( &(this->stop_cfm[i]), &(this->st_stop_cfm), sizeof(double));
garyservin 0:fd24f7ca9688 429 }
garyservin 0:fd24f7ca9688 430 uint8_t fudge_factor_lengthT = *(inbuffer + offset++);
garyservin 0:fd24f7ca9688 431 if(fudge_factor_lengthT > fudge_factor_length)
garyservin 0:fd24f7ca9688 432 this->fudge_factor = (double*)realloc(this->fudge_factor, fudge_factor_lengthT * sizeof(double));
garyservin 0:fd24f7ca9688 433 offset += 3;
garyservin 0:fd24f7ca9688 434 fudge_factor_length = fudge_factor_lengthT;
garyservin 0:fd24f7ca9688 435 for( uint8_t i = 0; i < fudge_factor_length; i++){
garyservin 0:fd24f7ca9688 436 union {
garyservin 0:fd24f7ca9688 437 double real;
garyservin 0:fd24f7ca9688 438 uint64_t base;
garyservin 0:fd24f7ca9688 439 } u_st_fudge_factor;
garyservin 0:fd24f7ca9688 440 u_st_fudge_factor.base = 0;
garyservin 0:fd24f7ca9688 441 u_st_fudge_factor.base |= ((uint64_t) (*(inbuffer + offset + 0))) << (8 * 0);
garyservin 0:fd24f7ca9688 442 u_st_fudge_factor.base |= ((uint64_t) (*(inbuffer + offset + 1))) << (8 * 1);
garyservin 0:fd24f7ca9688 443 u_st_fudge_factor.base |= ((uint64_t) (*(inbuffer + offset + 2))) << (8 * 2);
garyservin 0:fd24f7ca9688 444 u_st_fudge_factor.base |= ((uint64_t) (*(inbuffer + offset + 3))) << (8 * 3);
garyservin 0:fd24f7ca9688 445 u_st_fudge_factor.base |= ((uint64_t) (*(inbuffer + offset + 4))) << (8 * 4);
garyservin 0:fd24f7ca9688 446 u_st_fudge_factor.base |= ((uint64_t) (*(inbuffer + offset + 5))) << (8 * 5);
garyservin 0:fd24f7ca9688 447 u_st_fudge_factor.base |= ((uint64_t) (*(inbuffer + offset + 6))) << (8 * 6);
garyservin 0:fd24f7ca9688 448 u_st_fudge_factor.base |= ((uint64_t) (*(inbuffer + offset + 7))) << (8 * 7);
garyservin 0:fd24f7ca9688 449 this->st_fudge_factor = u_st_fudge_factor.real;
garyservin 0:fd24f7ca9688 450 offset += sizeof(this->st_fudge_factor);
garyservin 0:fd24f7ca9688 451 memcpy( &(this->fudge_factor[i]), &(this->st_fudge_factor), sizeof(double));
garyservin 0:fd24f7ca9688 452 }
garyservin 0:fd24f7ca9688 453 uint8_t fmax_lengthT = *(inbuffer + offset++);
garyservin 0:fd24f7ca9688 454 if(fmax_lengthT > fmax_length)
garyservin 0:fd24f7ca9688 455 this->fmax = (double*)realloc(this->fmax, fmax_lengthT * sizeof(double));
garyservin 0:fd24f7ca9688 456 offset += 3;
garyservin 0:fd24f7ca9688 457 fmax_length = fmax_lengthT;
garyservin 0:fd24f7ca9688 458 for( uint8_t i = 0; i < fmax_length; i++){
garyservin 0:fd24f7ca9688 459 union {
garyservin 0:fd24f7ca9688 460 double real;
garyservin 0:fd24f7ca9688 461 uint64_t base;
garyservin 0:fd24f7ca9688 462 } u_st_fmax;
garyservin 0:fd24f7ca9688 463 u_st_fmax.base = 0;
garyservin 0:fd24f7ca9688 464 u_st_fmax.base |= ((uint64_t) (*(inbuffer + offset + 0))) << (8 * 0);
garyservin 0:fd24f7ca9688 465 u_st_fmax.base |= ((uint64_t) (*(inbuffer + offset + 1))) << (8 * 1);
garyservin 0:fd24f7ca9688 466 u_st_fmax.base |= ((uint64_t) (*(inbuffer + offset + 2))) << (8 * 2);
garyservin 0:fd24f7ca9688 467 u_st_fmax.base |= ((uint64_t) (*(inbuffer + offset + 3))) << (8 * 3);
garyservin 0:fd24f7ca9688 468 u_st_fmax.base |= ((uint64_t) (*(inbuffer + offset + 4))) << (8 * 4);
garyservin 0:fd24f7ca9688 469 u_st_fmax.base |= ((uint64_t) (*(inbuffer + offset + 5))) << (8 * 5);
garyservin 0:fd24f7ca9688 470 u_st_fmax.base |= ((uint64_t) (*(inbuffer + offset + 6))) << (8 * 6);
garyservin 0:fd24f7ca9688 471 u_st_fmax.base |= ((uint64_t) (*(inbuffer + offset + 7))) << (8 * 7);
garyservin 0:fd24f7ca9688 472 this->st_fmax = u_st_fmax.real;
garyservin 0:fd24f7ca9688 473 offset += sizeof(this->st_fmax);
garyservin 0:fd24f7ca9688 474 memcpy( &(this->fmax[i]), &(this->st_fmax), sizeof(double));
garyservin 0:fd24f7ca9688 475 }
garyservin 0:fd24f7ca9688 476 uint8_t vel_lengthT = *(inbuffer + offset++);
garyservin 0:fd24f7ca9688 477 if(vel_lengthT > vel_length)
garyservin 0:fd24f7ca9688 478 this->vel = (double*)realloc(this->vel, vel_lengthT * sizeof(double));
garyservin 0:fd24f7ca9688 479 offset += 3;
garyservin 0:fd24f7ca9688 480 vel_length = vel_lengthT;
garyservin 0:fd24f7ca9688 481 for( uint8_t i = 0; i < vel_length; i++){
garyservin 0:fd24f7ca9688 482 union {
garyservin 0:fd24f7ca9688 483 double real;
garyservin 0:fd24f7ca9688 484 uint64_t base;
garyservin 0:fd24f7ca9688 485 } u_st_vel;
garyservin 0:fd24f7ca9688 486 u_st_vel.base = 0;
garyservin 0:fd24f7ca9688 487 u_st_vel.base |= ((uint64_t) (*(inbuffer + offset + 0))) << (8 * 0);
garyservin 0:fd24f7ca9688 488 u_st_vel.base |= ((uint64_t) (*(inbuffer + offset + 1))) << (8 * 1);
garyservin 0:fd24f7ca9688 489 u_st_vel.base |= ((uint64_t) (*(inbuffer + offset + 2))) << (8 * 2);
garyservin 0:fd24f7ca9688 490 u_st_vel.base |= ((uint64_t) (*(inbuffer + offset + 3))) << (8 * 3);
garyservin 0:fd24f7ca9688 491 u_st_vel.base |= ((uint64_t) (*(inbuffer + offset + 4))) << (8 * 4);
garyservin 0:fd24f7ca9688 492 u_st_vel.base |= ((uint64_t) (*(inbuffer + offset + 5))) << (8 * 5);
garyservin 0:fd24f7ca9688 493 u_st_vel.base |= ((uint64_t) (*(inbuffer + offset + 6))) << (8 * 6);
garyservin 0:fd24f7ca9688 494 u_st_vel.base |= ((uint64_t) (*(inbuffer + offset + 7))) << (8 * 7);
garyservin 0:fd24f7ca9688 495 this->st_vel = u_st_vel.real;
garyservin 0:fd24f7ca9688 496 offset += sizeof(this->st_vel);
garyservin 0:fd24f7ca9688 497 memcpy( &(this->vel[i]), &(this->st_vel), sizeof(double));
garyservin 0:fd24f7ca9688 498 }
garyservin 0:fd24f7ca9688 499 return offset;
garyservin 0:fd24f7ca9688 500 }
garyservin 0:fd24f7ca9688 501
garyservin 0:fd24f7ca9688 502 const char * getType(){ return "gazebo_msgs/ODEJointProperties"; };
garyservin 0:fd24f7ca9688 503 const char * getMD5(){ return "1b744c32a920af979f53afe2f9c3511f"; };
garyservin 0:fd24f7ca9688 504
garyservin 0:fd24f7ca9688 505 };
garyservin 0:fd24f7ca9688 506
garyservin 0:fd24f7ca9688 507 }
garyservin 0:fd24f7ca9688 508 #endif