catchrobo2022 / Mbed 2 deprecated catchrobo2022_mbed

Dependencies:   mbed

Embed: (wiki syntax)

« Back to documentation index

Show/hide line numbers DisplayRobotState.h Source File

DisplayRobotState.h

00001 #ifndef _ROS_moveit_msgs_DisplayRobotState_h
00002 #define _ROS_moveit_msgs_DisplayRobotState_h
00003 
00004 #include <stdint.h>
00005 #include <string.h>
00006 #include <stdlib.h>
00007 #include "ros/msg.h"
00008 #include "moveit_msgs/RobotState.h"
00009 #include "moveit_msgs/ObjectColor.h"
00010 
00011 namespace moveit_msgs
00012 {
00013 
00014   class DisplayRobotState : public ros::Msg
00015   {
00016     public:
00017       typedef moveit_msgs::RobotState _state_type;
00018       _state_type state;
00019       uint32_t highlight_links_length;
00020       typedef moveit_msgs::ObjectColor _highlight_links_type;
00021       _highlight_links_type st_highlight_links;
00022       _highlight_links_type * highlight_links;
00023 
00024     DisplayRobotState():
00025       state(),
00026       highlight_links_length(0), highlight_links(NULL)
00027     {
00028     }
00029 
00030     virtual int serialize(unsigned char *outbuffer) const
00031     {
00032       int offset = 0;
00033       offset += this->state.serialize(outbuffer + offset);
00034       *(outbuffer + offset + 0) = (this->highlight_links_length >> (8 * 0)) & 0xFF;
00035       *(outbuffer + offset + 1) = (this->highlight_links_length >> (8 * 1)) & 0xFF;
00036       *(outbuffer + offset + 2) = (this->highlight_links_length >> (8 * 2)) & 0xFF;
00037       *(outbuffer + offset + 3) = (this->highlight_links_length >> (8 * 3)) & 0xFF;
00038       offset += sizeof(this->highlight_links_length);
00039       for( uint32_t i = 0; i < highlight_links_length; i++){
00040       offset += this->highlight_links[i].serialize(outbuffer + offset);
00041       }
00042       return offset;
00043     }
00044 
00045     virtual int deserialize(unsigned char *inbuffer)
00046     {
00047       int offset = 0;
00048       offset += this->state.deserialize(inbuffer + offset);
00049       uint32_t highlight_links_lengthT = ((uint32_t) (*(inbuffer + offset))); 
00050       highlight_links_lengthT |= ((uint32_t) (*(inbuffer + offset + 1))) << (8 * 1); 
00051       highlight_links_lengthT |= ((uint32_t) (*(inbuffer + offset + 2))) << (8 * 2); 
00052       highlight_links_lengthT |= ((uint32_t) (*(inbuffer + offset + 3))) << (8 * 3); 
00053       offset += sizeof(this->highlight_links_length);
00054       if(highlight_links_lengthT > highlight_links_length)
00055         this->highlight_links = (moveit_msgs::ObjectColor*)realloc(this->highlight_links, highlight_links_lengthT * sizeof(moveit_msgs::ObjectColor));
00056       highlight_links_length = highlight_links_lengthT;
00057       for( uint32_t i = 0; i < highlight_links_length; i++){
00058       offset += this->st_highlight_links.deserialize(inbuffer + offset);
00059         memcpy( &(this->highlight_links[i]), &(this->st_highlight_links), sizeof(moveit_msgs::ObjectColor));
00060       }
00061      return offset;
00062     }
00063 
00064     virtual const char * getType(){ return "moveit_msgs/DisplayRobotState"; };
00065     virtual const char * getMD5(){ return "6a3bab3a33a8c47aee24481a455a21aa"; };
00066 
00067   };
00068 
00069 }
00070 #endif