Important changes to repositories hosted on mbed.com
Mbed hosted mercurial repositories are deprecated and are due to be permanently deleted in July 2026.
To keep a copy of this software download the repository Zip archive or clone locally using Mercurial.
It is also possible to export all your personal repositories from the account settings page.
ros_lib/mavros_msgs/AttitudeTarget.h@0:8f3710bfd298, 2020-09-02 (annotated)
- Committer:
- irfantitok
- Date:
- Wed Sep 02 13:51:31 2020 +0000
- Revision:
- 0:8f3710bfd298
Resolved round not found
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
irfantitok | 0:8f3710bfd298 | 1 | #ifndef _ROS_mavros_msgs_AttitudeTarget_h |
irfantitok | 0:8f3710bfd298 | 2 | #define _ROS_mavros_msgs_AttitudeTarget_h |
irfantitok | 0:8f3710bfd298 | 3 | |
irfantitok | 0:8f3710bfd298 | 4 | #include <stdint.h> |
irfantitok | 0:8f3710bfd298 | 5 | #include <string.h> |
irfantitok | 0:8f3710bfd298 | 6 | #include <stdlib.h> |
irfantitok | 0:8f3710bfd298 | 7 | #include "ros/msg.h" |
irfantitok | 0:8f3710bfd298 | 8 | #include "std_msgs/Header.h" |
irfantitok | 0:8f3710bfd298 | 9 | #include "geometry_msgs/Quaternion.h" |
irfantitok | 0:8f3710bfd298 | 10 | #include "geometry_msgs/Vector3.h" |
irfantitok | 0:8f3710bfd298 | 11 | |
irfantitok | 0:8f3710bfd298 | 12 | namespace mavros_msgs |
irfantitok | 0:8f3710bfd298 | 13 | { |
irfantitok | 0:8f3710bfd298 | 14 | |
irfantitok | 0:8f3710bfd298 | 15 | class AttitudeTarget : public ros::Msg |
irfantitok | 0:8f3710bfd298 | 16 | { |
irfantitok | 0:8f3710bfd298 | 17 | public: |
irfantitok | 0:8f3710bfd298 | 18 | typedef std_msgs::Header _header_type; |
irfantitok | 0:8f3710bfd298 | 19 | _header_type header; |
irfantitok | 0:8f3710bfd298 | 20 | typedef uint8_t _type_mask_type; |
irfantitok | 0:8f3710bfd298 | 21 | _type_mask_type type_mask; |
irfantitok | 0:8f3710bfd298 | 22 | typedef geometry_msgs::Quaternion _orientation_type; |
irfantitok | 0:8f3710bfd298 | 23 | _orientation_type orientation; |
irfantitok | 0:8f3710bfd298 | 24 | typedef geometry_msgs::Vector3 _body_rate_type; |
irfantitok | 0:8f3710bfd298 | 25 | _body_rate_type body_rate; |
irfantitok | 0:8f3710bfd298 | 26 | typedef float _thrust_type; |
irfantitok | 0:8f3710bfd298 | 27 | _thrust_type thrust; |
irfantitok | 0:8f3710bfd298 | 28 | enum { IGNORE_ROLL_RATE = 1 }; |
irfantitok | 0:8f3710bfd298 | 29 | enum { IGNORE_PITCH_RATE = 2 }; |
irfantitok | 0:8f3710bfd298 | 30 | enum { IGNORE_YAW_RATE = 4 }; |
irfantitok | 0:8f3710bfd298 | 31 | enum { IGNORE_THRUST = 64 }; |
irfantitok | 0:8f3710bfd298 | 32 | enum { IGNORE_ATTITUDE = 128 }; |
irfantitok | 0:8f3710bfd298 | 33 | |
irfantitok | 0:8f3710bfd298 | 34 | AttitudeTarget(): |
irfantitok | 0:8f3710bfd298 | 35 | header(), |
irfantitok | 0:8f3710bfd298 | 36 | type_mask(0), |
irfantitok | 0:8f3710bfd298 | 37 | orientation(), |
irfantitok | 0:8f3710bfd298 | 38 | body_rate(), |
irfantitok | 0:8f3710bfd298 | 39 | thrust(0) |
irfantitok | 0:8f3710bfd298 | 40 | { |
irfantitok | 0:8f3710bfd298 | 41 | } |
irfantitok | 0:8f3710bfd298 | 42 | |
irfantitok | 0:8f3710bfd298 | 43 | virtual int serialize(unsigned char *outbuffer) const |
irfantitok | 0:8f3710bfd298 | 44 | { |
irfantitok | 0:8f3710bfd298 | 45 | int offset = 0; |
irfantitok | 0:8f3710bfd298 | 46 | offset += this->header.serialize(outbuffer + offset); |
irfantitok | 0:8f3710bfd298 | 47 | *(outbuffer + offset + 0) = (this->type_mask >> (8 * 0)) & 0xFF; |
irfantitok | 0:8f3710bfd298 | 48 | offset += sizeof(this->type_mask); |
irfantitok | 0:8f3710bfd298 | 49 | offset += this->orientation.serialize(outbuffer + offset); |
irfantitok | 0:8f3710bfd298 | 50 | offset += this->body_rate.serialize(outbuffer + offset); |
irfantitok | 0:8f3710bfd298 | 51 | union { |
irfantitok | 0:8f3710bfd298 | 52 | float real; |
irfantitok | 0:8f3710bfd298 | 53 | uint32_t base; |
irfantitok | 0:8f3710bfd298 | 54 | } u_thrust; |
irfantitok | 0:8f3710bfd298 | 55 | u_thrust.real = this->thrust; |
irfantitok | 0:8f3710bfd298 | 56 | *(outbuffer + offset + 0) = (u_thrust.base >> (8 * 0)) & 0xFF; |
irfantitok | 0:8f3710bfd298 | 57 | *(outbuffer + offset + 1) = (u_thrust.base >> (8 * 1)) & 0xFF; |
irfantitok | 0:8f3710bfd298 | 58 | *(outbuffer + offset + 2) = (u_thrust.base >> (8 * 2)) & 0xFF; |
irfantitok | 0:8f3710bfd298 | 59 | *(outbuffer + offset + 3) = (u_thrust.base >> (8 * 3)) & 0xFF; |
irfantitok | 0:8f3710bfd298 | 60 | offset += sizeof(this->thrust); |
irfantitok | 0:8f3710bfd298 | 61 | return offset; |
irfantitok | 0:8f3710bfd298 | 62 | } |
irfantitok | 0:8f3710bfd298 | 63 | |
irfantitok | 0:8f3710bfd298 | 64 | virtual int deserialize(unsigned char *inbuffer) |
irfantitok | 0:8f3710bfd298 | 65 | { |
irfantitok | 0:8f3710bfd298 | 66 | int offset = 0; |
irfantitok | 0:8f3710bfd298 | 67 | offset += this->header.deserialize(inbuffer + offset); |
irfantitok | 0:8f3710bfd298 | 68 | this->type_mask = ((uint8_t) (*(inbuffer + offset))); |
irfantitok | 0:8f3710bfd298 | 69 | offset += sizeof(this->type_mask); |
irfantitok | 0:8f3710bfd298 | 70 | offset += this->orientation.deserialize(inbuffer + offset); |
irfantitok | 0:8f3710bfd298 | 71 | offset += this->body_rate.deserialize(inbuffer + offset); |
irfantitok | 0:8f3710bfd298 | 72 | union { |
irfantitok | 0:8f3710bfd298 | 73 | float real; |
irfantitok | 0:8f3710bfd298 | 74 | uint32_t base; |
irfantitok | 0:8f3710bfd298 | 75 | } u_thrust; |
irfantitok | 0:8f3710bfd298 | 76 | u_thrust.base = 0; |
irfantitok | 0:8f3710bfd298 | 77 | u_thrust.base |= ((uint32_t) (*(inbuffer + offset + 0))) << (8 * 0); |
irfantitok | 0:8f3710bfd298 | 78 | u_thrust.base |= ((uint32_t) (*(inbuffer + offset + 1))) << (8 * 1); |
irfantitok | 0:8f3710bfd298 | 79 | u_thrust.base |= ((uint32_t) (*(inbuffer + offset + 2))) << (8 * 2); |
irfantitok | 0:8f3710bfd298 | 80 | u_thrust.base |= ((uint32_t) (*(inbuffer + offset + 3))) << (8 * 3); |
irfantitok | 0:8f3710bfd298 | 81 | this->thrust = u_thrust.real; |
irfantitok | 0:8f3710bfd298 | 82 | offset += sizeof(this->thrust); |
irfantitok | 0:8f3710bfd298 | 83 | return offset; |
irfantitok | 0:8f3710bfd298 | 84 | } |
irfantitok | 0:8f3710bfd298 | 85 | |
irfantitok | 0:8f3710bfd298 | 86 | const char * getType(){ return "mavros_msgs/AttitudeTarget"; }; |
irfantitok | 0:8f3710bfd298 | 87 | const char * getMD5(){ return "456f3af666b22ccd0222ea053a86b548"; }; |
irfantitok | 0:8f3710bfd298 | 88 | |
irfantitok | 0:8f3710bfd298 | 89 | }; |
irfantitok | 0:8f3710bfd298 | 90 | |
irfantitok | 0:8f3710bfd298 | 91 | } |
irfantitok | 0:8f3710bfd298 | 92 | #endif |