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

Embed: (wiki syntax)

« Back to documentation index

Show/hide line numbers Circle.h Source File

Circle.h

00001 #ifndef _ROS_opencv_apps_Circle_h
00002 #define _ROS_opencv_apps_Circle_h
00003 
00004 #include <stdint.h>
00005 #include <string.h>
00006 #include <stdlib.h>
00007 #include "ros/msg.h"
00008 #include "opencv_apps/Point2D.h"
00009 
00010 namespace opencv_apps
00011 {
00012 
00013   class Circle : public ros::Msg
00014   {
00015     public:
00016       opencv_apps::Point2D center;
00017       double radius;
00018 
00019     Circle():
00020       center(),
00021       radius(0)
00022     {
00023     }
00024 
00025     virtual int serialize(unsigned char *outbuffer) const
00026     {
00027       int offset = 0;
00028       offset += this->center.serialize(outbuffer + offset);
00029       union {
00030         double real;
00031         uint64_t base;
00032       } u_radius;
00033       u_radius.real = this->radius;
00034       *(outbuffer + offset + 0) = (u_radius.base >> (8 * 0)) & 0xFF;
00035       *(outbuffer + offset + 1) = (u_radius.base >> (8 * 1)) & 0xFF;
00036       *(outbuffer + offset + 2) = (u_radius.base >> (8 * 2)) & 0xFF;
00037       *(outbuffer + offset + 3) = (u_radius.base >> (8 * 3)) & 0xFF;
00038       *(outbuffer + offset + 4) = (u_radius.base >> (8 * 4)) & 0xFF;
00039       *(outbuffer + offset + 5) = (u_radius.base >> (8 * 5)) & 0xFF;
00040       *(outbuffer + offset + 6) = (u_radius.base >> (8 * 6)) & 0xFF;
00041       *(outbuffer + offset + 7) = (u_radius.base >> (8 * 7)) & 0xFF;
00042       offset += sizeof(this->radius);
00043       return offset;
00044     }
00045 
00046     virtual int deserialize(unsigned char *inbuffer)
00047     {
00048       int offset = 0;
00049       offset += this->center.deserialize(inbuffer + offset);
00050       union {
00051         double real;
00052         uint64_t base;
00053       } u_radius;
00054       u_radius.base = 0;
00055       u_radius.base |= ((uint64_t) (*(inbuffer + offset + 0))) << (8 * 0);
00056       u_radius.base |= ((uint64_t) (*(inbuffer + offset + 1))) << (8 * 1);
00057       u_radius.base |= ((uint64_t) (*(inbuffer + offset + 2))) << (8 * 2);
00058       u_radius.base |= ((uint64_t) (*(inbuffer + offset + 3))) << (8 * 3);
00059       u_radius.base |= ((uint64_t) (*(inbuffer + offset + 4))) << (8 * 4);
00060       u_radius.base |= ((uint64_t) (*(inbuffer + offset + 5))) << (8 * 5);
00061       u_radius.base |= ((uint64_t) (*(inbuffer + offset + 6))) << (8 * 6);
00062       u_radius.base |= ((uint64_t) (*(inbuffer + offset + 7))) << (8 * 7);
00063       this->radius = u_radius.real;
00064       offset += sizeof(this->radius);
00065      return offset;
00066     }
00067 
00068     const char * getType(){ return "opencv_apps/Circle"; };
00069     const char * getMD5(){ return "4f6847051b4fe493b5af8caad66201d5"; };
00070 
00071   };
00072 
00073 }
00074 #endif