Delta Battery, CAN_bus, DIO P2P, ROS
Dependencies: mbed mbed-rtos ros_lib_kinetic
Diff: tiny_msgs/tinyVector.h
- Revision:
- 12:ed085acbbde5
- Parent:
- 11:6d5307ceb569
diff -r 6d5307ceb569 -r ed085acbbde5 tiny_msgs/tinyVector.h --- a/tiny_msgs/tinyVector.h Tue Oct 02 00:57:35 2018 +0000 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,98 +0,0 @@ -#ifndef _ROS_tiny_msgs_tinyVector_h -#define _ROS_tiny_msgs_tinyVector_h - -#include <stdint.h> -#include <string.h> -#include <stdlib.h> -#include "ros/msg.h" - -namespace tiny_msgs -{ - - class tinyVector : public ros::Msg - { - public: - typedef int16_t _x_type; - _x_type x; - typedef int16_t _y_type; - _y_type y; - typedef int16_t _z_type; - _z_type z; - - tinyVector(): - x(0), - y(0), - z(0) - { - } - - virtual int serialize(unsigned char *outbuffer) const - { - int offset = 0; - union { - int16_t real; - uint16_t base; - } u_x; - u_x.real = this->x; - *(outbuffer + offset + 0) = (u_x.base >> (8 * 0)) & 0xFF; - *(outbuffer + offset + 1) = (u_x.base >> (8 * 1)) & 0xFF; - offset += sizeof(this->x); - union { - int16_t real; - uint16_t base; - } u_y; - u_y.real = this->y; - *(outbuffer + offset + 0) = (u_y.base >> (8 * 0)) & 0xFF; - *(outbuffer + offset + 1) = (u_y.base >> (8 * 1)) & 0xFF; - offset += sizeof(this->y); - union { - int16_t real; - uint16_t base; - } u_z; - u_z.real = this->z; - *(outbuffer + offset + 0) = (u_z.base >> (8 * 0)) & 0xFF; - *(outbuffer + offset + 1) = (u_z.base >> (8 * 1)) & 0xFF; - offset += sizeof(this->z); - return offset; - } - - virtual int deserialize(unsigned char *inbuffer) - { - int offset = 0; - union { - int16_t real; - uint16_t base; - } u_x; - u_x.base = 0; - u_x.base |= ((uint16_t) (*(inbuffer + offset + 0))) << (8 * 0); - u_x.base |= ((uint16_t) (*(inbuffer + offset + 1))) << (8 * 1); - this->x = u_x.real; - offset += sizeof(this->x); - union { - int16_t real; - uint16_t base; - } u_y; - u_y.base = 0; - u_y.base |= ((uint16_t) (*(inbuffer + offset + 0))) << (8 * 0); - u_y.base |= ((uint16_t) (*(inbuffer + offset + 1))) << (8 * 1); - this->y = u_y.real; - offset += sizeof(this->y); - union { - int16_t real; - uint16_t base; - } u_z; - u_z.base = 0; - u_z.base |= ((uint16_t) (*(inbuffer + offset + 0))) << (8 * 0); - u_z.base |= ((uint16_t) (*(inbuffer + offset + 1))) << (8 * 1); - this->z = u_z.real; - offset += sizeof(this->z); - return offset; - } - - const char * getType(){ return "tinyVector"; }; - const char * getMD5(){ return "85729383565f7e059d4a213b3db1317b"; }; - - }; - -} -#endif \ No newline at end of file