Code for autonomous ground vehicle, Data Bus, 3rd place winner in 2012 Sparkfun AVC.

Dependencies:   Watchdog mbed Schedule SimpleFilter LSM303DLM PinDetect DebounceIn Servo

Embed: (wiki syntax)

« Back to documentation index

Show/hide line numbers mavlink_msg_waypoint_reached.h Source File

mavlink_msg_waypoint_reached.h

00001 // MESSAGE WAYPOINT_REACHED PACKING
00002 
00003 #define MAVLINK_MSG_ID_WAYPOINT_REACHED 46
00004 
00005 typedef struct __mavlink_waypoint_reached_t 
00006 {
00007     uint16_t seq; ///< Sequence
00008 
00009 } mavlink_waypoint_reached_t;
00010 
00011 
00012 
00013 /**
00014  * @brief Pack a waypoint_reached message
00015  * @param system_id ID of this system
00016  * @param component_id ID of this component (e.g. 200 for IMU)
00017  * @param msg The MAVLink message to compress the data into
00018  *
00019  * @param seq Sequence
00020  * @return length of the message in bytes (excluding serial stream start sign)
00021  */
00022 static inline uint16_t mavlink_msg_waypoint_reached_pack(uint8_t system_id, uint8_t component_id, mavlink_message_t* msg, uint16_t seq)
00023 {
00024     uint16_t i = 0;
00025     msg->msgid = MAVLINK_MSG_ID_WAYPOINT_REACHED;
00026 
00027     i += put_uint16_t_by_index(seq, i, msg->payload); // Sequence
00028 
00029     return mavlink_finalize_message(msg, system_id, component_id, i);
00030 }
00031 
00032 /**
00033  * @brief Pack a waypoint_reached message
00034  * @param system_id ID of this system
00035  * @param component_id ID of this component (e.g. 200 for IMU)
00036  * @param chan The MAVLink channel this message was sent over
00037  * @param msg The MAVLink message to compress the data into
00038  * @param seq Sequence
00039  * @return length of the message in bytes (excluding serial stream start sign)
00040  */
00041 static inline uint16_t mavlink_msg_waypoint_reached_pack_chan(uint8_t system_id, uint8_t component_id, uint8_t chan, mavlink_message_t* msg, uint16_t seq)
00042 {
00043     uint16_t i = 0;
00044     msg->msgid = MAVLINK_MSG_ID_WAYPOINT_REACHED;
00045 
00046     i += put_uint16_t_by_index(seq, i, msg->payload); // Sequence
00047 
00048     return mavlink_finalize_message_chan(msg, system_id, component_id, chan, i);
00049 }
00050 
00051 /**
00052  * @brief Encode a waypoint_reached struct into a message
00053  *
00054  * @param system_id ID of this system
00055  * @param component_id ID of this component (e.g. 200 for IMU)
00056  * @param msg The MAVLink message to compress the data into
00057  * @param waypoint_reached C-struct to read the message contents from
00058  */
00059 static inline uint16_t mavlink_msg_waypoint_reached_encode(uint8_t system_id, uint8_t component_id, mavlink_message_t* msg, const mavlink_waypoint_reached_t* waypoint_reached)
00060 {
00061     return mavlink_msg_waypoint_reached_pack(system_id, component_id, msg, waypoint_reached->seq);
00062 }
00063 
00064 /**
00065  * @brief Send a waypoint_reached message
00066  * @param chan MAVLink channel to send the message
00067  *
00068  * @param seq Sequence
00069  */
00070 #ifdef MAVLINK_USE_CONVENIENCE_FUNCTIONS
00071 
00072 static inline void mavlink_msg_waypoint_reached_send(mavlink_channel_t chan, uint16_t seq)
00073 {
00074     mavlink_message_t msg;
00075     mavlink_msg_waypoint_reached_pack_chan(mavlink_system.sysid, mavlink_system.compid, chan, &msg, seq);
00076     mavlink_send_uart(chan, &msg);
00077 }
00078 
00079 #endif
00080 // MESSAGE WAYPOINT_REACHED UNPACKING
00081 
00082 /**
00083  * @brief Get field seq from waypoint_reached message
00084  *
00085  * @return Sequence
00086  */
00087 static inline uint16_t mavlink_msg_waypoint_reached_get_seq(const mavlink_message_t* msg)
00088 {
00089     generic_16bit r;
00090     r.b[1] = (msg->payload)[0];
00091     r.b[0] = (msg->payload)[1];
00092     return (uint16_t)r.s;
00093 }
00094 
00095 /**
00096  * @brief Decode a waypoint_reached message into a struct
00097  *
00098  * @param msg The message to decode
00099  * @param waypoint_reached C-struct to decode the message contents into
00100  */
00101 static inline void mavlink_msg_waypoint_reached_decode(const mavlink_message_t* msg, mavlink_waypoint_reached_t* waypoint_reached)
00102 {
00103     waypoint_reached->seq = mavlink_msg_waypoint_reached_get_seq(msg);
00104 }