capstone_finish
Dependencies: BufferedSerial motor_sn7544
sensor_msgs/MagneticField.h@10:ca4e4062701a, 2019-11-26 (annotated)
- Committer:
- Jeonghoon
- Date:
- Tue Nov 26 15:30:27 2019 +0000
- Revision:
- 10:ca4e4062701a
- Parent:
- 3:2a3664dc6634
capstone finish
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
Jeonghoon | 3:2a3664dc6634 | 1 | #ifndef _ROS_sensor_msgs_MagneticField_h |
Jeonghoon | 3:2a3664dc6634 | 2 | #define _ROS_sensor_msgs_MagneticField_h |
Jeonghoon | 3:2a3664dc6634 | 3 | |
Jeonghoon | 3:2a3664dc6634 | 4 | #include <stdint.h> |
Jeonghoon | 3:2a3664dc6634 | 5 | #include <string.h> |
Jeonghoon | 3:2a3664dc6634 | 6 | #include <stdlib.h> |
Jeonghoon | 3:2a3664dc6634 | 7 | #include "ros/msg.h" |
Jeonghoon | 3:2a3664dc6634 | 8 | #include "std_msgs/Header.h" |
Jeonghoon | 3:2a3664dc6634 | 9 | #include "geometry_msgs/Vector3.h" |
Jeonghoon | 3:2a3664dc6634 | 10 | |
Jeonghoon | 3:2a3664dc6634 | 11 | namespace sensor_msgs |
Jeonghoon | 3:2a3664dc6634 | 12 | { |
Jeonghoon | 3:2a3664dc6634 | 13 | |
Jeonghoon | 3:2a3664dc6634 | 14 | class MagneticField : public ros::Msg |
Jeonghoon | 3:2a3664dc6634 | 15 | { |
Jeonghoon | 3:2a3664dc6634 | 16 | public: |
Jeonghoon | 3:2a3664dc6634 | 17 | typedef std_msgs::Header _header_type; |
Jeonghoon | 3:2a3664dc6634 | 18 | _header_type header; |
Jeonghoon | 3:2a3664dc6634 | 19 | typedef geometry_msgs::Vector3 _magnetic_field_type; |
Jeonghoon | 3:2a3664dc6634 | 20 | _magnetic_field_type magnetic_field; |
Jeonghoon | 3:2a3664dc6634 | 21 | double magnetic_field_covariance[9]; |
Jeonghoon | 3:2a3664dc6634 | 22 | |
Jeonghoon | 3:2a3664dc6634 | 23 | MagneticField(): |
Jeonghoon | 3:2a3664dc6634 | 24 | header(), |
Jeonghoon | 3:2a3664dc6634 | 25 | magnetic_field(), |
Jeonghoon | 3:2a3664dc6634 | 26 | magnetic_field_covariance() |
Jeonghoon | 3:2a3664dc6634 | 27 | { |
Jeonghoon | 3:2a3664dc6634 | 28 | } |
Jeonghoon | 3:2a3664dc6634 | 29 | |
Jeonghoon | 3:2a3664dc6634 | 30 | virtual int serialize(unsigned char *outbuffer) const |
Jeonghoon | 3:2a3664dc6634 | 31 | { |
Jeonghoon | 3:2a3664dc6634 | 32 | int offset = 0; |
Jeonghoon | 3:2a3664dc6634 | 33 | offset += this->header.serialize(outbuffer + offset); |
Jeonghoon | 3:2a3664dc6634 | 34 | offset += this->magnetic_field.serialize(outbuffer + offset); |
Jeonghoon | 3:2a3664dc6634 | 35 | for( uint32_t i = 0; i < 9; i++){ |
Jeonghoon | 3:2a3664dc6634 | 36 | union { |
Jeonghoon | 3:2a3664dc6634 | 37 | double real; |
Jeonghoon | 3:2a3664dc6634 | 38 | uint64_t base; |
Jeonghoon | 3:2a3664dc6634 | 39 | } u_magnetic_field_covariancei; |
Jeonghoon | 3:2a3664dc6634 | 40 | u_magnetic_field_covariancei.real = this->magnetic_field_covariance[i]; |
Jeonghoon | 3:2a3664dc6634 | 41 | *(outbuffer + offset + 0) = (u_magnetic_field_covariancei.base >> (8 * 0)) & 0xFF; |
Jeonghoon | 3:2a3664dc6634 | 42 | *(outbuffer + offset + 1) = (u_magnetic_field_covariancei.base >> (8 * 1)) & 0xFF; |
Jeonghoon | 3:2a3664dc6634 | 43 | *(outbuffer + offset + 2) = (u_magnetic_field_covariancei.base >> (8 * 2)) & 0xFF; |
Jeonghoon | 3:2a3664dc6634 | 44 | *(outbuffer + offset + 3) = (u_magnetic_field_covariancei.base >> (8 * 3)) & 0xFF; |
Jeonghoon | 3:2a3664dc6634 | 45 | *(outbuffer + offset + 4) = (u_magnetic_field_covariancei.base >> (8 * 4)) & 0xFF; |
Jeonghoon | 3:2a3664dc6634 | 46 | *(outbuffer + offset + 5) = (u_magnetic_field_covariancei.base >> (8 * 5)) & 0xFF; |
Jeonghoon | 3:2a3664dc6634 | 47 | *(outbuffer + offset + 6) = (u_magnetic_field_covariancei.base >> (8 * 6)) & 0xFF; |
Jeonghoon | 3:2a3664dc6634 | 48 | *(outbuffer + offset + 7) = (u_magnetic_field_covariancei.base >> (8 * 7)) & 0xFF; |
Jeonghoon | 3:2a3664dc6634 | 49 | offset += sizeof(this->magnetic_field_covariance[i]); |
Jeonghoon | 3:2a3664dc6634 | 50 | } |
Jeonghoon | 3:2a3664dc6634 | 51 | return offset; |
Jeonghoon | 3:2a3664dc6634 | 52 | } |
Jeonghoon | 3:2a3664dc6634 | 53 | |
Jeonghoon | 3:2a3664dc6634 | 54 | virtual int deserialize(unsigned char *inbuffer) |
Jeonghoon | 3:2a3664dc6634 | 55 | { |
Jeonghoon | 3:2a3664dc6634 | 56 | int offset = 0; |
Jeonghoon | 3:2a3664dc6634 | 57 | offset += this->header.deserialize(inbuffer + offset); |
Jeonghoon | 3:2a3664dc6634 | 58 | offset += this->magnetic_field.deserialize(inbuffer + offset); |
Jeonghoon | 3:2a3664dc6634 | 59 | for( uint32_t i = 0; i < 9; i++){ |
Jeonghoon | 3:2a3664dc6634 | 60 | union { |
Jeonghoon | 3:2a3664dc6634 | 61 | double real; |
Jeonghoon | 3:2a3664dc6634 | 62 | uint64_t base; |
Jeonghoon | 3:2a3664dc6634 | 63 | } u_magnetic_field_covariancei; |
Jeonghoon | 3:2a3664dc6634 | 64 | u_magnetic_field_covariancei.base = 0; |
Jeonghoon | 3:2a3664dc6634 | 65 | u_magnetic_field_covariancei.base |= ((uint64_t) (*(inbuffer + offset + 0))) << (8 * 0); |
Jeonghoon | 3:2a3664dc6634 | 66 | u_magnetic_field_covariancei.base |= ((uint64_t) (*(inbuffer + offset + 1))) << (8 * 1); |
Jeonghoon | 3:2a3664dc6634 | 67 | u_magnetic_field_covariancei.base |= ((uint64_t) (*(inbuffer + offset + 2))) << (8 * 2); |
Jeonghoon | 3:2a3664dc6634 | 68 | u_magnetic_field_covariancei.base |= ((uint64_t) (*(inbuffer + offset + 3))) << (8 * 3); |
Jeonghoon | 3:2a3664dc6634 | 69 | u_magnetic_field_covariancei.base |= ((uint64_t) (*(inbuffer + offset + 4))) << (8 * 4); |
Jeonghoon | 3:2a3664dc6634 | 70 | u_magnetic_field_covariancei.base |= ((uint64_t) (*(inbuffer + offset + 5))) << (8 * 5); |
Jeonghoon | 3:2a3664dc6634 | 71 | u_magnetic_field_covariancei.base |= ((uint64_t) (*(inbuffer + offset + 6))) << (8 * 6); |
Jeonghoon | 3:2a3664dc6634 | 72 | u_magnetic_field_covariancei.base |= ((uint64_t) (*(inbuffer + offset + 7))) << (8 * 7); |
Jeonghoon | 3:2a3664dc6634 | 73 | this->magnetic_field_covariance[i] = u_magnetic_field_covariancei.real; |
Jeonghoon | 3:2a3664dc6634 | 74 | offset += sizeof(this->magnetic_field_covariance[i]); |
Jeonghoon | 3:2a3664dc6634 | 75 | } |
Jeonghoon | 3:2a3664dc6634 | 76 | return offset; |
Jeonghoon | 3:2a3664dc6634 | 77 | } |
Jeonghoon | 3:2a3664dc6634 | 78 | |
Jeonghoon | 3:2a3664dc6634 | 79 | const char * getType(){ return "sensor_msgs/MagneticField"; }; |
Jeonghoon | 3:2a3664dc6634 | 80 | const char * getMD5(){ return "2f3b0b43eed0c9501de0fa3ff89a45aa"; }; |
Jeonghoon | 3:2a3664dc6634 | 81 | |
Jeonghoon | 3:2a3664dc6634 | 82 | }; |
Jeonghoon | 3:2a3664dc6634 | 83 | |
Jeonghoon | 3:2a3664dc6634 | 84 | } |
Jeonghoon | 3:2a3664dc6634 | 85 | #endif |