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:38:09 2019 -0300
Revision:
0:04ac6be8229a
Initial commit, generated based on a clean melodic-desktop-full

Who changed what in which revision?

UserRevisionLine numberNew contents of line
Gary Servin 0:04ac6be8229a 1 #ifndef _ROS_sensor_msgs_CameraInfo_h
Gary Servin 0:04ac6be8229a 2 #define _ROS_sensor_msgs_CameraInfo_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 "sensor_msgs/RegionOfInterest.h"
Gary Servin 0:04ac6be8229a 10
Gary Servin 0:04ac6be8229a 11 namespace sensor_msgs
Gary Servin 0:04ac6be8229a 12 {
Gary Servin 0:04ac6be8229a 13
Gary Servin 0:04ac6be8229a 14 class CameraInfo : public ros::Msg
Gary Servin 0:04ac6be8229a 15 {
Gary Servin 0:04ac6be8229a 16 public:
Gary Servin 0:04ac6be8229a 17 typedef std_msgs::Header _header_type;
Gary Servin 0:04ac6be8229a 18 _header_type header;
Gary Servin 0:04ac6be8229a 19 typedef uint32_t _height_type;
Gary Servin 0:04ac6be8229a 20 _height_type height;
Gary Servin 0:04ac6be8229a 21 typedef uint32_t _width_type;
Gary Servin 0:04ac6be8229a 22 _width_type width;
Gary Servin 0:04ac6be8229a 23 typedef const char* _distortion_model_type;
Gary Servin 0:04ac6be8229a 24 _distortion_model_type distortion_model;
Gary Servin 0:04ac6be8229a 25 uint32_t D_length;
Gary Servin 0:04ac6be8229a 26 typedef double _D_type;
Gary Servin 0:04ac6be8229a 27 _D_type st_D;
Gary Servin 0:04ac6be8229a 28 _D_type * D;
Gary Servin 0:04ac6be8229a 29 double K[9];
Gary Servin 0:04ac6be8229a 30 double R[9];
Gary Servin 0:04ac6be8229a 31 double P[12];
Gary Servin 0:04ac6be8229a 32 typedef uint32_t _binning_x_type;
Gary Servin 0:04ac6be8229a 33 _binning_x_type binning_x;
Gary Servin 0:04ac6be8229a 34 typedef uint32_t _binning_y_type;
Gary Servin 0:04ac6be8229a 35 _binning_y_type binning_y;
Gary Servin 0:04ac6be8229a 36 typedef sensor_msgs::RegionOfInterest _roi_type;
Gary Servin 0:04ac6be8229a 37 _roi_type roi;
Gary Servin 0:04ac6be8229a 38
Gary Servin 0:04ac6be8229a 39 CameraInfo():
Gary Servin 0:04ac6be8229a 40 header(),
Gary Servin 0:04ac6be8229a 41 height(0),
Gary Servin 0:04ac6be8229a 42 width(0),
Gary Servin 0:04ac6be8229a 43 distortion_model(""),
Gary Servin 0:04ac6be8229a 44 D_length(0), D(NULL),
Gary Servin 0:04ac6be8229a 45 K(),
Gary Servin 0:04ac6be8229a 46 R(),
Gary Servin 0:04ac6be8229a 47 P(),
Gary Servin 0:04ac6be8229a 48 binning_x(0),
Gary Servin 0:04ac6be8229a 49 binning_y(0),
Gary Servin 0:04ac6be8229a 50 roi()
Gary Servin 0:04ac6be8229a 51 {
Gary Servin 0:04ac6be8229a 52 }
Gary Servin 0:04ac6be8229a 53
Gary Servin 0:04ac6be8229a 54 virtual int serialize(unsigned char *outbuffer) const
Gary Servin 0:04ac6be8229a 55 {
Gary Servin 0:04ac6be8229a 56 int offset = 0;
Gary Servin 0:04ac6be8229a 57 offset += this->header.serialize(outbuffer + offset);
Gary Servin 0:04ac6be8229a 58 *(outbuffer + offset + 0) = (this->height >> (8 * 0)) & 0xFF;
Gary Servin 0:04ac6be8229a 59 *(outbuffer + offset + 1) = (this->height >> (8 * 1)) & 0xFF;
Gary Servin 0:04ac6be8229a 60 *(outbuffer + offset + 2) = (this->height >> (8 * 2)) & 0xFF;
Gary Servin 0:04ac6be8229a 61 *(outbuffer + offset + 3) = (this->height >> (8 * 3)) & 0xFF;
Gary Servin 0:04ac6be8229a 62 offset += sizeof(this->height);
Gary Servin 0:04ac6be8229a 63 *(outbuffer + offset + 0) = (this->width >> (8 * 0)) & 0xFF;
Gary Servin 0:04ac6be8229a 64 *(outbuffer + offset + 1) = (this->width >> (8 * 1)) & 0xFF;
Gary Servin 0:04ac6be8229a 65 *(outbuffer + offset + 2) = (this->width >> (8 * 2)) & 0xFF;
Gary Servin 0:04ac6be8229a 66 *(outbuffer + offset + 3) = (this->width >> (8 * 3)) & 0xFF;
Gary Servin 0:04ac6be8229a 67 offset += sizeof(this->width);
Gary Servin 0:04ac6be8229a 68 uint32_t length_distortion_model = strlen(this->distortion_model);
Gary Servin 0:04ac6be8229a 69 varToArr(outbuffer + offset, length_distortion_model);
Gary Servin 0:04ac6be8229a 70 offset += 4;
Gary Servin 0:04ac6be8229a 71 memcpy(outbuffer + offset, this->distortion_model, length_distortion_model);
Gary Servin 0:04ac6be8229a 72 offset += length_distortion_model;
Gary Servin 0:04ac6be8229a 73 *(outbuffer + offset + 0) = (this->D_length >> (8 * 0)) & 0xFF;
Gary Servin 0:04ac6be8229a 74 *(outbuffer + offset + 1) = (this->D_length >> (8 * 1)) & 0xFF;
Gary Servin 0:04ac6be8229a 75 *(outbuffer + offset + 2) = (this->D_length >> (8 * 2)) & 0xFF;
Gary Servin 0:04ac6be8229a 76 *(outbuffer + offset + 3) = (this->D_length >> (8 * 3)) & 0xFF;
Gary Servin 0:04ac6be8229a 77 offset += sizeof(this->D_length);
Gary Servin 0:04ac6be8229a 78 for( uint32_t i = 0; i < D_length; i++){
Gary Servin 0:04ac6be8229a 79 union {
Gary Servin 0:04ac6be8229a 80 double real;
Gary Servin 0:04ac6be8229a 81 uint64_t base;
Gary Servin 0:04ac6be8229a 82 } u_Di;
Gary Servin 0:04ac6be8229a 83 u_Di.real = this->D[i];
Gary Servin 0:04ac6be8229a 84 *(outbuffer + offset + 0) = (u_Di.base >> (8 * 0)) & 0xFF;
Gary Servin 0:04ac6be8229a 85 *(outbuffer + offset + 1) = (u_Di.base >> (8 * 1)) & 0xFF;
Gary Servin 0:04ac6be8229a 86 *(outbuffer + offset + 2) = (u_Di.base >> (8 * 2)) & 0xFF;
Gary Servin 0:04ac6be8229a 87 *(outbuffer + offset + 3) = (u_Di.base >> (8 * 3)) & 0xFF;
Gary Servin 0:04ac6be8229a 88 *(outbuffer + offset + 4) = (u_Di.base >> (8 * 4)) & 0xFF;
Gary Servin 0:04ac6be8229a 89 *(outbuffer + offset + 5) = (u_Di.base >> (8 * 5)) & 0xFF;
Gary Servin 0:04ac6be8229a 90 *(outbuffer + offset + 6) = (u_Di.base >> (8 * 6)) & 0xFF;
Gary Servin 0:04ac6be8229a 91 *(outbuffer + offset + 7) = (u_Di.base >> (8 * 7)) & 0xFF;
Gary Servin 0:04ac6be8229a 92 offset += sizeof(this->D[i]);
Gary Servin 0:04ac6be8229a 93 }
Gary Servin 0:04ac6be8229a 94 for( uint32_t i = 0; i < 9; i++){
Gary Servin 0:04ac6be8229a 95 union {
Gary Servin 0:04ac6be8229a 96 double real;
Gary Servin 0:04ac6be8229a 97 uint64_t base;
Gary Servin 0:04ac6be8229a 98 } u_Ki;
Gary Servin 0:04ac6be8229a 99 u_Ki.real = this->K[i];
Gary Servin 0:04ac6be8229a 100 *(outbuffer + offset + 0) = (u_Ki.base >> (8 * 0)) & 0xFF;
Gary Servin 0:04ac6be8229a 101 *(outbuffer + offset + 1) = (u_Ki.base >> (8 * 1)) & 0xFF;
Gary Servin 0:04ac6be8229a 102 *(outbuffer + offset + 2) = (u_Ki.base >> (8 * 2)) & 0xFF;
Gary Servin 0:04ac6be8229a 103 *(outbuffer + offset + 3) = (u_Ki.base >> (8 * 3)) & 0xFF;
Gary Servin 0:04ac6be8229a 104 *(outbuffer + offset + 4) = (u_Ki.base >> (8 * 4)) & 0xFF;
Gary Servin 0:04ac6be8229a 105 *(outbuffer + offset + 5) = (u_Ki.base >> (8 * 5)) & 0xFF;
Gary Servin 0:04ac6be8229a 106 *(outbuffer + offset + 6) = (u_Ki.base >> (8 * 6)) & 0xFF;
Gary Servin 0:04ac6be8229a 107 *(outbuffer + offset + 7) = (u_Ki.base >> (8 * 7)) & 0xFF;
Gary Servin 0:04ac6be8229a 108 offset += sizeof(this->K[i]);
Gary Servin 0:04ac6be8229a 109 }
Gary Servin 0:04ac6be8229a 110 for( uint32_t i = 0; i < 9; i++){
Gary Servin 0:04ac6be8229a 111 union {
Gary Servin 0:04ac6be8229a 112 double real;
Gary Servin 0:04ac6be8229a 113 uint64_t base;
Gary Servin 0:04ac6be8229a 114 } u_Ri;
Gary Servin 0:04ac6be8229a 115 u_Ri.real = this->R[i];
Gary Servin 0:04ac6be8229a 116 *(outbuffer + offset + 0) = (u_Ri.base >> (8 * 0)) & 0xFF;
Gary Servin 0:04ac6be8229a 117 *(outbuffer + offset + 1) = (u_Ri.base >> (8 * 1)) & 0xFF;
Gary Servin 0:04ac6be8229a 118 *(outbuffer + offset + 2) = (u_Ri.base >> (8 * 2)) & 0xFF;
Gary Servin 0:04ac6be8229a 119 *(outbuffer + offset + 3) = (u_Ri.base >> (8 * 3)) & 0xFF;
Gary Servin 0:04ac6be8229a 120 *(outbuffer + offset + 4) = (u_Ri.base >> (8 * 4)) & 0xFF;
Gary Servin 0:04ac6be8229a 121 *(outbuffer + offset + 5) = (u_Ri.base >> (8 * 5)) & 0xFF;
Gary Servin 0:04ac6be8229a 122 *(outbuffer + offset + 6) = (u_Ri.base >> (8 * 6)) & 0xFF;
Gary Servin 0:04ac6be8229a 123 *(outbuffer + offset + 7) = (u_Ri.base >> (8 * 7)) & 0xFF;
Gary Servin 0:04ac6be8229a 124 offset += sizeof(this->R[i]);
Gary Servin 0:04ac6be8229a 125 }
Gary Servin 0:04ac6be8229a 126 for( uint32_t i = 0; i < 12; i++){
Gary Servin 0:04ac6be8229a 127 union {
Gary Servin 0:04ac6be8229a 128 double real;
Gary Servin 0:04ac6be8229a 129 uint64_t base;
Gary Servin 0:04ac6be8229a 130 } u_Pi;
Gary Servin 0:04ac6be8229a 131 u_Pi.real = this->P[i];
Gary Servin 0:04ac6be8229a 132 *(outbuffer + offset + 0) = (u_Pi.base >> (8 * 0)) & 0xFF;
Gary Servin 0:04ac6be8229a 133 *(outbuffer + offset + 1) = (u_Pi.base >> (8 * 1)) & 0xFF;
Gary Servin 0:04ac6be8229a 134 *(outbuffer + offset + 2) = (u_Pi.base >> (8 * 2)) & 0xFF;
Gary Servin 0:04ac6be8229a 135 *(outbuffer + offset + 3) = (u_Pi.base >> (8 * 3)) & 0xFF;
Gary Servin 0:04ac6be8229a 136 *(outbuffer + offset + 4) = (u_Pi.base >> (8 * 4)) & 0xFF;
Gary Servin 0:04ac6be8229a 137 *(outbuffer + offset + 5) = (u_Pi.base >> (8 * 5)) & 0xFF;
Gary Servin 0:04ac6be8229a 138 *(outbuffer + offset + 6) = (u_Pi.base >> (8 * 6)) & 0xFF;
Gary Servin 0:04ac6be8229a 139 *(outbuffer + offset + 7) = (u_Pi.base >> (8 * 7)) & 0xFF;
Gary Servin 0:04ac6be8229a 140 offset += sizeof(this->P[i]);
Gary Servin 0:04ac6be8229a 141 }
Gary Servin 0:04ac6be8229a 142 *(outbuffer + offset + 0) = (this->binning_x >> (8 * 0)) & 0xFF;
Gary Servin 0:04ac6be8229a 143 *(outbuffer + offset + 1) = (this->binning_x >> (8 * 1)) & 0xFF;
Gary Servin 0:04ac6be8229a 144 *(outbuffer + offset + 2) = (this->binning_x >> (8 * 2)) & 0xFF;
Gary Servin 0:04ac6be8229a 145 *(outbuffer + offset + 3) = (this->binning_x >> (8 * 3)) & 0xFF;
Gary Servin 0:04ac6be8229a 146 offset += sizeof(this->binning_x);
Gary Servin 0:04ac6be8229a 147 *(outbuffer + offset + 0) = (this->binning_y >> (8 * 0)) & 0xFF;
Gary Servin 0:04ac6be8229a 148 *(outbuffer + offset + 1) = (this->binning_y >> (8 * 1)) & 0xFF;
Gary Servin 0:04ac6be8229a 149 *(outbuffer + offset + 2) = (this->binning_y >> (8 * 2)) & 0xFF;
Gary Servin 0:04ac6be8229a 150 *(outbuffer + offset + 3) = (this->binning_y >> (8 * 3)) & 0xFF;
Gary Servin 0:04ac6be8229a 151 offset += sizeof(this->binning_y);
Gary Servin 0:04ac6be8229a 152 offset += this->roi.serialize(outbuffer + offset);
Gary Servin 0:04ac6be8229a 153 return offset;
Gary Servin 0:04ac6be8229a 154 }
Gary Servin 0:04ac6be8229a 155
Gary Servin 0:04ac6be8229a 156 virtual int deserialize(unsigned char *inbuffer)
Gary Servin 0:04ac6be8229a 157 {
Gary Servin 0:04ac6be8229a 158 int offset = 0;
Gary Servin 0:04ac6be8229a 159 offset += this->header.deserialize(inbuffer + offset);
Gary Servin 0:04ac6be8229a 160 this->height = ((uint32_t) (*(inbuffer + offset)));
Gary Servin 0:04ac6be8229a 161 this->height |= ((uint32_t) (*(inbuffer + offset + 1))) << (8 * 1);
Gary Servin 0:04ac6be8229a 162 this->height |= ((uint32_t) (*(inbuffer + offset + 2))) << (8 * 2);
Gary Servin 0:04ac6be8229a 163 this->height |= ((uint32_t) (*(inbuffer + offset + 3))) << (8 * 3);
Gary Servin 0:04ac6be8229a 164 offset += sizeof(this->height);
Gary Servin 0:04ac6be8229a 165 this->width = ((uint32_t) (*(inbuffer + offset)));
Gary Servin 0:04ac6be8229a 166 this->width |= ((uint32_t) (*(inbuffer + offset + 1))) << (8 * 1);
Gary Servin 0:04ac6be8229a 167 this->width |= ((uint32_t) (*(inbuffer + offset + 2))) << (8 * 2);
Gary Servin 0:04ac6be8229a 168 this->width |= ((uint32_t) (*(inbuffer + offset + 3))) << (8 * 3);
Gary Servin 0:04ac6be8229a 169 offset += sizeof(this->width);
Gary Servin 0:04ac6be8229a 170 uint32_t length_distortion_model;
Gary Servin 0:04ac6be8229a 171 arrToVar(length_distortion_model, (inbuffer + offset));
Gary Servin 0:04ac6be8229a 172 offset += 4;
Gary Servin 0:04ac6be8229a 173 for(unsigned int k= offset; k< offset+length_distortion_model; ++k){
Gary Servin 0:04ac6be8229a 174 inbuffer[k-1]=inbuffer[k];
Gary Servin 0:04ac6be8229a 175 }
Gary Servin 0:04ac6be8229a 176 inbuffer[offset+length_distortion_model-1]=0;
Gary Servin 0:04ac6be8229a 177 this->distortion_model = (char *)(inbuffer + offset-1);
Gary Servin 0:04ac6be8229a 178 offset += length_distortion_model;
Gary Servin 0:04ac6be8229a 179 uint32_t D_lengthT = ((uint32_t) (*(inbuffer + offset)));
Gary Servin 0:04ac6be8229a 180 D_lengthT |= ((uint32_t) (*(inbuffer + offset + 1))) << (8 * 1);
Gary Servin 0:04ac6be8229a 181 D_lengthT |= ((uint32_t) (*(inbuffer + offset + 2))) << (8 * 2);
Gary Servin 0:04ac6be8229a 182 D_lengthT |= ((uint32_t) (*(inbuffer + offset + 3))) << (8 * 3);
Gary Servin 0:04ac6be8229a 183 offset += sizeof(this->D_length);
Gary Servin 0:04ac6be8229a 184 if(D_lengthT > D_length)
Gary Servin 0:04ac6be8229a 185 this->D = (double*)realloc(this->D, D_lengthT * sizeof(double));
Gary Servin 0:04ac6be8229a 186 D_length = D_lengthT;
Gary Servin 0:04ac6be8229a 187 for( uint32_t i = 0; i < D_length; i++){
Gary Servin 0:04ac6be8229a 188 union {
Gary Servin 0:04ac6be8229a 189 double real;
Gary Servin 0:04ac6be8229a 190 uint64_t base;
Gary Servin 0:04ac6be8229a 191 } u_st_D;
Gary Servin 0:04ac6be8229a 192 u_st_D.base = 0;
Gary Servin 0:04ac6be8229a 193 u_st_D.base |= ((uint64_t) (*(inbuffer + offset + 0))) << (8 * 0);
Gary Servin 0:04ac6be8229a 194 u_st_D.base |= ((uint64_t) (*(inbuffer + offset + 1))) << (8 * 1);
Gary Servin 0:04ac6be8229a 195 u_st_D.base |= ((uint64_t) (*(inbuffer + offset + 2))) << (8 * 2);
Gary Servin 0:04ac6be8229a 196 u_st_D.base |= ((uint64_t) (*(inbuffer + offset + 3))) << (8 * 3);
Gary Servin 0:04ac6be8229a 197 u_st_D.base |= ((uint64_t) (*(inbuffer + offset + 4))) << (8 * 4);
Gary Servin 0:04ac6be8229a 198 u_st_D.base |= ((uint64_t) (*(inbuffer + offset + 5))) << (8 * 5);
Gary Servin 0:04ac6be8229a 199 u_st_D.base |= ((uint64_t) (*(inbuffer + offset + 6))) << (8 * 6);
Gary Servin 0:04ac6be8229a 200 u_st_D.base |= ((uint64_t) (*(inbuffer + offset + 7))) << (8 * 7);
Gary Servin 0:04ac6be8229a 201 this->st_D = u_st_D.real;
Gary Servin 0:04ac6be8229a 202 offset += sizeof(this->st_D);
Gary Servin 0:04ac6be8229a 203 memcpy( &(this->D[i]), &(this->st_D), sizeof(double));
Gary Servin 0:04ac6be8229a 204 }
Gary Servin 0:04ac6be8229a 205 for( uint32_t i = 0; i < 9; i++){
Gary Servin 0:04ac6be8229a 206 union {
Gary Servin 0:04ac6be8229a 207 double real;
Gary Servin 0:04ac6be8229a 208 uint64_t base;
Gary Servin 0:04ac6be8229a 209 } u_Ki;
Gary Servin 0:04ac6be8229a 210 u_Ki.base = 0;
Gary Servin 0:04ac6be8229a 211 u_Ki.base |= ((uint64_t) (*(inbuffer + offset + 0))) << (8 * 0);
Gary Servin 0:04ac6be8229a 212 u_Ki.base |= ((uint64_t) (*(inbuffer + offset + 1))) << (8 * 1);
Gary Servin 0:04ac6be8229a 213 u_Ki.base |= ((uint64_t) (*(inbuffer + offset + 2))) << (8 * 2);
Gary Servin 0:04ac6be8229a 214 u_Ki.base |= ((uint64_t) (*(inbuffer + offset + 3))) << (8 * 3);
Gary Servin 0:04ac6be8229a 215 u_Ki.base |= ((uint64_t) (*(inbuffer + offset + 4))) << (8 * 4);
Gary Servin 0:04ac6be8229a 216 u_Ki.base |= ((uint64_t) (*(inbuffer + offset + 5))) << (8 * 5);
Gary Servin 0:04ac6be8229a 217 u_Ki.base |= ((uint64_t) (*(inbuffer + offset + 6))) << (8 * 6);
Gary Servin 0:04ac6be8229a 218 u_Ki.base |= ((uint64_t) (*(inbuffer + offset + 7))) << (8 * 7);
Gary Servin 0:04ac6be8229a 219 this->K[i] = u_Ki.real;
Gary Servin 0:04ac6be8229a 220 offset += sizeof(this->K[i]);
Gary Servin 0:04ac6be8229a 221 }
Gary Servin 0:04ac6be8229a 222 for( uint32_t i = 0; i < 9; i++){
Gary Servin 0:04ac6be8229a 223 union {
Gary Servin 0:04ac6be8229a 224 double real;
Gary Servin 0:04ac6be8229a 225 uint64_t base;
Gary Servin 0:04ac6be8229a 226 } u_Ri;
Gary Servin 0:04ac6be8229a 227 u_Ri.base = 0;
Gary Servin 0:04ac6be8229a 228 u_Ri.base |= ((uint64_t) (*(inbuffer + offset + 0))) << (8 * 0);
Gary Servin 0:04ac6be8229a 229 u_Ri.base |= ((uint64_t) (*(inbuffer + offset + 1))) << (8 * 1);
Gary Servin 0:04ac6be8229a 230 u_Ri.base |= ((uint64_t) (*(inbuffer + offset + 2))) << (8 * 2);
Gary Servin 0:04ac6be8229a 231 u_Ri.base |= ((uint64_t) (*(inbuffer + offset + 3))) << (8 * 3);
Gary Servin 0:04ac6be8229a 232 u_Ri.base |= ((uint64_t) (*(inbuffer + offset + 4))) << (8 * 4);
Gary Servin 0:04ac6be8229a 233 u_Ri.base |= ((uint64_t) (*(inbuffer + offset + 5))) << (8 * 5);
Gary Servin 0:04ac6be8229a 234 u_Ri.base |= ((uint64_t) (*(inbuffer + offset + 6))) << (8 * 6);
Gary Servin 0:04ac6be8229a 235 u_Ri.base |= ((uint64_t) (*(inbuffer + offset + 7))) << (8 * 7);
Gary Servin 0:04ac6be8229a 236 this->R[i] = u_Ri.real;
Gary Servin 0:04ac6be8229a 237 offset += sizeof(this->R[i]);
Gary Servin 0:04ac6be8229a 238 }
Gary Servin 0:04ac6be8229a 239 for( uint32_t i = 0; i < 12; i++){
Gary Servin 0:04ac6be8229a 240 union {
Gary Servin 0:04ac6be8229a 241 double real;
Gary Servin 0:04ac6be8229a 242 uint64_t base;
Gary Servin 0:04ac6be8229a 243 } u_Pi;
Gary Servin 0:04ac6be8229a 244 u_Pi.base = 0;
Gary Servin 0:04ac6be8229a 245 u_Pi.base |= ((uint64_t) (*(inbuffer + offset + 0))) << (8 * 0);
Gary Servin 0:04ac6be8229a 246 u_Pi.base |= ((uint64_t) (*(inbuffer + offset + 1))) << (8 * 1);
Gary Servin 0:04ac6be8229a 247 u_Pi.base |= ((uint64_t) (*(inbuffer + offset + 2))) << (8 * 2);
Gary Servin 0:04ac6be8229a 248 u_Pi.base |= ((uint64_t) (*(inbuffer + offset + 3))) << (8 * 3);
Gary Servin 0:04ac6be8229a 249 u_Pi.base |= ((uint64_t) (*(inbuffer + offset + 4))) << (8 * 4);
Gary Servin 0:04ac6be8229a 250 u_Pi.base |= ((uint64_t) (*(inbuffer + offset + 5))) << (8 * 5);
Gary Servin 0:04ac6be8229a 251 u_Pi.base |= ((uint64_t) (*(inbuffer + offset + 6))) << (8 * 6);
Gary Servin 0:04ac6be8229a 252 u_Pi.base |= ((uint64_t) (*(inbuffer + offset + 7))) << (8 * 7);
Gary Servin 0:04ac6be8229a 253 this->P[i] = u_Pi.real;
Gary Servin 0:04ac6be8229a 254 offset += sizeof(this->P[i]);
Gary Servin 0:04ac6be8229a 255 }
Gary Servin 0:04ac6be8229a 256 this->binning_x = ((uint32_t) (*(inbuffer + offset)));
Gary Servin 0:04ac6be8229a 257 this->binning_x |= ((uint32_t) (*(inbuffer + offset + 1))) << (8 * 1);
Gary Servin 0:04ac6be8229a 258 this->binning_x |= ((uint32_t) (*(inbuffer + offset + 2))) << (8 * 2);
Gary Servin 0:04ac6be8229a 259 this->binning_x |= ((uint32_t) (*(inbuffer + offset + 3))) << (8 * 3);
Gary Servin 0:04ac6be8229a 260 offset += sizeof(this->binning_x);
Gary Servin 0:04ac6be8229a 261 this->binning_y = ((uint32_t) (*(inbuffer + offset)));
Gary Servin 0:04ac6be8229a 262 this->binning_y |= ((uint32_t) (*(inbuffer + offset + 1))) << (8 * 1);
Gary Servin 0:04ac6be8229a 263 this->binning_y |= ((uint32_t) (*(inbuffer + offset + 2))) << (8 * 2);
Gary Servin 0:04ac6be8229a 264 this->binning_y |= ((uint32_t) (*(inbuffer + offset + 3))) << (8 * 3);
Gary Servin 0:04ac6be8229a 265 offset += sizeof(this->binning_y);
Gary Servin 0:04ac6be8229a 266 offset += this->roi.deserialize(inbuffer + offset);
Gary Servin 0:04ac6be8229a 267 return offset;
Gary Servin 0:04ac6be8229a 268 }
Gary Servin 0:04ac6be8229a 269
Gary Servin 0:04ac6be8229a 270 const char * getType(){ return "sensor_msgs/CameraInfo"; };
Gary Servin 0:04ac6be8229a 271 const char * getMD5(){ return "c9a58c1b0b154e0e6da7578cb991d214"; };
Gary Servin 0:04ac6be8229a 272
Gary Servin 0:04ac6be8229a 273 };
Gary Servin 0:04ac6be8229a 274
Gary Servin 0:04ac6be8229a 275 }
Gary Servin 0:04ac6be8229a 276 #endif