Fawkes API  Fawkes Development Version
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  /** Internal data storage, do NOT modify! */
43  typedef struct __attribute__((packed)) {
44  int64_t timestamp_sec; /**< Interface Unix timestamp, seconds */
45  int64_t timestamp_usec; /**< Interface Unix timestamp, micro-seconds */
46  char frame[32]; /**<
47  Coordinate frame in which the data is presented.
48  */
49  float distances[720]; /**<
50  The distances in meter of the beams.
51  */
52  bool clockwise_angle; /**<
53  True if the angle grows clockwise.
54  */
55  } Laser720Interface_data_t;
56 
57  Laser720Interface_data_t *data;
58 
59  public:
60  /* messages */
61  virtual bool message_valid(const Message *message) const;
62  private:
65 
66  public:
67  /* Methods */
68  char * frame() const;
69  void set_frame(const char * new_frame);
70  size_t maxlenof_frame() const;
71  float * distances() const;
72  float distances(unsigned int index) const;
73  void set_distances(unsigned int index, const float new_distances);
74  void set_distances(const float * new_distances);
75  size_t maxlenof_distances() const;
76  bool is_clockwise_angle() const;
77  void set_clockwise_angle(const bool new_clockwise_angle);
78  size_t maxlenof_clockwise_angle() const;
79  virtual Message * create_message(const char *type) const;
80 
81  virtual void copy_values(const Interface *other);
82  virtual const char * enum_tostring(const char *enumtype, int val) const;
83 
84 };
85 
86 } // end namespace fawkes
87 
88 #endif
size_t maxlenof_distances() const
Get maximum length of distances value.
size_t maxlenof_frame() const
Get maximum length of frame value.
Base class for all messages passed through interfaces in Fawkes BlackBoard.
Definition: message.h:44
virtual Message * create_message(const char *type) const
Create message based on type name.
void set_frame(const char *new_frame)
Set frame value.
Fawkes library namespace.
Base class for all Fawkes BlackBoard interfaces.
Definition: interface.h:79
virtual void copy_values(const Interface *other)
Copy values from other interface.
size_t maxlenof_clockwise_angle() const
Get maximum length of clockwise_angle value.
const char * type() const
Get type of interface.
Definition: interface.cpp:651
char * frame() const
Get frame value.
virtual bool message_valid(const Message *message) const
Check if message is valid and can be enqueued.
void set_distances(unsigned int index, const float new_distances)
Set distances value at given index.
float * distances() const
Get distances value.
void set_clockwise_angle(const bool new_clockwise_angle)
Set clockwise_angle value.
virtual const char * enum_tostring(const char *enumtype, int val) const
Convert arbitrary enum value to string.
Laser720Interface Fawkes BlackBoard Interface.
bool is_clockwise_angle() const
Get clockwise_angle value.