rosserial library for mbed Inspired by nucho's rosserial library This library is still under development

Dependencies:   MODSERIAL mbed

Dependents:   mbed_roshydro_test

Library still under development!

Committer:
akashvibhute
Date:
Sun Feb 15 10:53:43 2015 +0000
Revision:
0:30537dec6e0b
First commit; Library still need to be debugged, compilation issues with new mbed and modserial updates.

Who changed what in which revision?

UserRevisionLine numberNew contents of line
akashvibhute 0:30537dec6e0b 1 #ifndef _ROS_industrial_msgs_RobotStatus_h
akashvibhute 0:30537dec6e0b 2 #define _ROS_industrial_msgs_RobotStatus_h
akashvibhute 0:30537dec6e0b 3
akashvibhute 0:30537dec6e0b 4 #include <stdint.h>
akashvibhute 0:30537dec6e0b 5 #include <string.h>
akashvibhute 0:30537dec6e0b 6 #include <stdlib.h>
akashvibhute 0:30537dec6e0b 7 #include "ros/msg.h"
akashvibhute 0:30537dec6e0b 8 #include "std_msgs/Header.h"
akashvibhute 0:30537dec6e0b 9 #include "industrial_msgs/RobotMode.h"
akashvibhute 0:30537dec6e0b 10 #include "industrial_msgs/TriState.h"
akashvibhute 0:30537dec6e0b 11
akashvibhute 0:30537dec6e0b 12 namespace industrial_msgs
akashvibhute 0:30537dec6e0b 13 {
akashvibhute 0:30537dec6e0b 14
akashvibhute 0:30537dec6e0b 15 class RobotStatus : public ros::Msg
akashvibhute 0:30537dec6e0b 16 {
akashvibhute 0:30537dec6e0b 17 public:
akashvibhute 0:30537dec6e0b 18 std_msgs::Header header;
akashvibhute 0:30537dec6e0b 19 industrial_msgs::RobotMode mode;
akashvibhute 0:30537dec6e0b 20 industrial_msgs::TriState e_stopped;
akashvibhute 0:30537dec6e0b 21 industrial_msgs::TriState drives_powered;
akashvibhute 0:30537dec6e0b 22 industrial_msgs::TriState motion_possible;
akashvibhute 0:30537dec6e0b 23 industrial_msgs::TriState in_motion;
akashvibhute 0:30537dec6e0b 24 industrial_msgs::TriState in_error;
akashvibhute 0:30537dec6e0b 25 int32_t error_code;
akashvibhute 0:30537dec6e0b 26
akashvibhute 0:30537dec6e0b 27 RobotStatus():
akashvibhute 0:30537dec6e0b 28 header(),
akashvibhute 0:30537dec6e0b 29 mode(),
akashvibhute 0:30537dec6e0b 30 e_stopped(),
akashvibhute 0:30537dec6e0b 31 drives_powered(),
akashvibhute 0:30537dec6e0b 32 motion_possible(),
akashvibhute 0:30537dec6e0b 33 in_motion(),
akashvibhute 0:30537dec6e0b 34 in_error(),
akashvibhute 0:30537dec6e0b 35 error_code(0)
akashvibhute 0:30537dec6e0b 36 {
akashvibhute 0:30537dec6e0b 37 }
akashvibhute 0:30537dec6e0b 38
akashvibhute 0:30537dec6e0b 39 virtual int serialize(unsigned char *outbuffer) const
akashvibhute 0:30537dec6e0b 40 {
akashvibhute 0:30537dec6e0b 41 int offset = 0;
akashvibhute 0:30537dec6e0b 42 offset += this->header.serialize(outbuffer + offset);
akashvibhute 0:30537dec6e0b 43 offset += this->mode.serialize(outbuffer + offset);
akashvibhute 0:30537dec6e0b 44 offset += this->e_stopped.serialize(outbuffer + offset);
akashvibhute 0:30537dec6e0b 45 offset += this->drives_powered.serialize(outbuffer + offset);
akashvibhute 0:30537dec6e0b 46 offset += this->motion_possible.serialize(outbuffer + offset);
akashvibhute 0:30537dec6e0b 47 offset += this->in_motion.serialize(outbuffer + offset);
akashvibhute 0:30537dec6e0b 48 offset += this->in_error.serialize(outbuffer + offset);
akashvibhute 0:30537dec6e0b 49 union {
akashvibhute 0:30537dec6e0b 50 int32_t real;
akashvibhute 0:30537dec6e0b 51 uint32_t base;
akashvibhute 0:30537dec6e0b 52 } u_error_code;
akashvibhute 0:30537dec6e0b 53 u_error_code.real = this->error_code;
akashvibhute 0:30537dec6e0b 54 *(outbuffer + offset + 0) = (u_error_code.base >> (8 * 0)) & 0xFF;
akashvibhute 0:30537dec6e0b 55 *(outbuffer + offset + 1) = (u_error_code.base >> (8 * 1)) & 0xFF;
akashvibhute 0:30537dec6e0b 56 *(outbuffer + offset + 2) = (u_error_code.base >> (8 * 2)) & 0xFF;
akashvibhute 0:30537dec6e0b 57 *(outbuffer + offset + 3) = (u_error_code.base >> (8 * 3)) & 0xFF;
akashvibhute 0:30537dec6e0b 58 offset += sizeof(this->error_code);
akashvibhute 0:30537dec6e0b 59 return offset;
akashvibhute 0:30537dec6e0b 60 }
akashvibhute 0:30537dec6e0b 61
akashvibhute 0:30537dec6e0b 62 virtual int deserialize(unsigned char *inbuffer)
akashvibhute 0:30537dec6e0b 63 {
akashvibhute 0:30537dec6e0b 64 int offset = 0;
akashvibhute 0:30537dec6e0b 65 offset += this->header.deserialize(inbuffer + offset);
akashvibhute 0:30537dec6e0b 66 offset += this->mode.deserialize(inbuffer + offset);
akashvibhute 0:30537dec6e0b 67 offset += this->e_stopped.deserialize(inbuffer + offset);
akashvibhute 0:30537dec6e0b 68 offset += this->drives_powered.deserialize(inbuffer + offset);
akashvibhute 0:30537dec6e0b 69 offset += this->motion_possible.deserialize(inbuffer + offset);
akashvibhute 0:30537dec6e0b 70 offset += this->in_motion.deserialize(inbuffer + offset);
akashvibhute 0:30537dec6e0b 71 offset += this->in_error.deserialize(inbuffer + offset);
akashvibhute 0:30537dec6e0b 72 union {
akashvibhute 0:30537dec6e0b 73 int32_t real;
akashvibhute 0:30537dec6e0b 74 uint32_t base;
akashvibhute 0:30537dec6e0b 75 } u_error_code;
akashvibhute 0:30537dec6e0b 76 u_error_code.base = 0;
akashvibhute 0:30537dec6e0b 77 u_error_code.base |= ((uint32_t) (*(inbuffer + offset + 0))) << (8 * 0);
akashvibhute 0:30537dec6e0b 78 u_error_code.base |= ((uint32_t) (*(inbuffer + offset + 1))) << (8 * 1);
akashvibhute 0:30537dec6e0b 79 u_error_code.base |= ((uint32_t) (*(inbuffer + offset + 2))) << (8 * 2);
akashvibhute 0:30537dec6e0b 80 u_error_code.base |= ((uint32_t) (*(inbuffer + offset + 3))) << (8 * 3);
akashvibhute 0:30537dec6e0b 81 this->error_code = u_error_code.real;
akashvibhute 0:30537dec6e0b 82 offset += sizeof(this->error_code);
akashvibhute 0:30537dec6e0b 83 return offset;
akashvibhute 0:30537dec6e0b 84 }
akashvibhute 0:30537dec6e0b 85
akashvibhute 0:30537dec6e0b 86 const char * getType(){ return "industrial_msgs/RobotStatus"; };
akashvibhute 0:30537dec6e0b 87 const char * getMD5(){ return "b733cb45a38101840b75c4c0d6093d19"; };
akashvibhute 0:30537dec6e0b 88
akashvibhute 0:30537dec6e0b 89 };
akashvibhute 0:30537dec6e0b 90
akashvibhute 0:30537dec6e0b 91 }
akashvibhute 0:30537dec6e0b 92 #endif