Laser720Interface.h

00001 
00002 /***************************************************************************
00003  *  Laser720Interface.h - Fawkes BlackBoard Interface - Laser720Interface
00004  *
00005  *  Templated created:   Thu Oct 12 10:49:19 2006
00006  *  Copyright  2008  Tim Niemueller
00007  *
00008  ****************************************************************************/
00009 
00010 /*  This program is free software; you can redistribute it and/or modify
00011  *  it under the terms of the GNU General Public License as published by
00012  *  the Free Software Foundation; either version 2 of the License, or
00013  *  (at your option) any later version. A runtime exception applies to
00014  *  this software (see LICENSE.GPL_WRE file mentioned below for details).
00015  *
00016  *  This program is distributed in the hope that it will be useful,
00017  *  but WITHOUT ANY WARRANTY; without even the implied warranty of
00018  *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00019  *  GNU Library General Public License for more details.
00020  *
00021  *  Read the full text in the LICENSE.GPL_WRE file in the doc directory.
00022  */
00023 
00024 #ifndef __INTERFACES_LASER720INTERFACE_H_
00025 #define __INTERFACES_LASER720INTERFACE_H_
00026 
00027 #include <interface/interface.h>
00028 #include <interface/message.h>
00029 #include <interface/field_iterator.h>
00030 
00031 namespace fawkes {
00032 
00033 class Laser720Interface : public Interface
00034 {
00035  /// @cond INTERNALS
00036  INTERFACE_MGMT_FRIENDS(Laser720Interface)
00037  /// @endcond
00038  public:
00039   /* constants */
00040 
00041  private:
00042 #pragma pack(push,4)
00043   /** Internal data storage, do NOT modify! */
00044   typedef struct {
00045     int64_t timestamp_sec;  /**< Interface Unix timestamp, seconds */
00046     int64_t timestamp_usec; /**< Interface Unix timestamp, micro-seconds */
00047     float distances[720]; /**< 
00048       The distances in meter of the beams.
00049      */
00050     bool clockwise_angle; /**< 
00051       True if the angle grows clockwise.
00052      */
00053   } Laser720Interface_data_t;
00054 #pragma pack(pop)
00055 
00056   Laser720Interface_data_t *data;
00057 
00058  public:
00059   /* messages */
00060   virtual bool message_valid(const Message *message) const;
00061  private:
00062   Laser720Interface();
00063   ~Laser720Interface();
00064 
00065  public:
00066   /* Methods */
00067   float * distances() const;
00068   float distances(unsigned int index) const;
00069   void set_distances(unsigned int index, const float new_distances);
00070   void set_distances(const float * new_distances);
00071   size_t maxlenof_distances() const;
00072   bool is_clockwise_angle() const;
00073   void set_clockwise_angle(const bool new_clockwise_angle);
00074   size_t maxlenof_clockwise_angle() const;
00075   virtual Message * create_message(const char *type) const;
00076 
00077   virtual void copy_values(const Interface *other);
00078   virtual const char * enum_tostring(const char *enumtype, int val) const;
00079 
00080 };
00081 
00082 } // end namespace fawkes
00083 
00084 #endif