![](/media/cache/img/default_profile.jpg.50x50_q85.jpg)
start to work from here...
Dependencies: MPU6050-DMP mbed ros_lib_kinetic
Fork of AGV_0411 by
Diff: tiny_msgs/tinyVector.h
- Revision:
- 2:648583d6e41a
diff -r 41ec5f98abab -r 648583d6e41a tiny_msgs/tinyVector.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/tiny_msgs/tinyVector.h Thu Apr 12 01:15:57 2018 +0000 @@ -0,0 +1,98 @@ +#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