Fawkes API  Fawkes Development Version
 All Classes Namespaces Functions Variables Typedefs Enumerations Enumerator Friends Groups Pages
Laser720Interface.h
1 
2 /***************************************************************************
3  * Laser720Interface.h - Fawkes BlackBoard Interface - Laser720Interface
4  *
5  * Templated created: Thu Oct 12 10:49:19 2006
6  * Copyright 2008 Tim Niemueller
7  *
8  ****************************************************************************/
9 
10 /* This program is free software; you can redistribute it and/or modify
11  * it under the terms of the GNU General Public License as published by
12  * the Free Software Foundation; either version 2 of the License, or
13  * (at your option) any later version. A runtime exception applies to
14  * this software (see LICENSE.GPL_WRE file mentioned below for details).
15  *
16  * This program is distributed in the hope that it will be useful,
17  * but WITHOUT ANY WARRANTY; without even the implied warranty of
18  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
19  * GNU Library General Public License for more details.
20  *
21  * Read the full text in the LICENSE.GPL_WRE file in the doc directory.
22  */
23 
24 #ifndef __INTERFACES_LASER720INTERFACE_H_
25 #define __INTERFACES_LASER720INTERFACE_H_
26 
27 #include <interface/interface.h>
28 #include <interface/message.h>
29 #include <interface/field_iterator.h>
30 
31 namespace fawkes {
32 
34 {
35  /// @cond INTERNALS
36  INTERFACE_MGMT_FRIENDS(Laser720Interface)
37  /// @endcond
38  public:
39  /* constants */
40 
41  private:
42 #pragma pack(push,4)
43  /** Internal data storage, do NOT modify! */
44  typedef struct {
45  int64_t timestamp_sec; /**< Interface Unix timestamp, seconds */
46  int64_t timestamp_usec; /**< Interface Unix timestamp, micro-seconds */
47  char frame[32]; /**<
48  Coordinate frame in which the data is presented.
49  */
50  float distances[720]; /**<
51  The distances in meter of the beams.
52  */
53  bool clockwise_angle; /**<
54  True if the angle grows clockwise.
55  */
56  } Laser720Interface_data_t;
57 #pragma pack(pop)
58 
59  Laser720Interface_data_t *data;
60 
61  public:
62  /* messages */
63  virtual bool message_valid(const Message *message) const;
64  private:
67 
68  public:
69  /* Methods */
70  char * frame() const;
71  void set_frame(const char * new_frame);
72  size_t maxlenof_frame() const;
73  float * distances() const;
74  float distances(unsigned int index) const;
75  void set_distances(unsigned int index, const float new_distances);
76  void set_distances(const float * new_distances);
77  size_t maxlenof_distances() const;
78  bool is_clockwise_angle() const;
79  void set_clockwise_angle(const bool new_clockwise_angle);
80  size_t maxlenof_clockwise_angle() const;
81  virtual Message * create_message(const char *type) const;
82 
83  virtual void copy_values(const Interface *other);
84  virtual const char * enum_tostring(const char *enumtype, int val) const;
85 
86 };
87 
88 } // end namespace fawkes
89 
90 #endif