Fawkes API  Fawkes Development Version
LaserClusterInterface.h
1 
2 /***************************************************************************
3  * LaserClusterInterface.h - Fawkes BlackBoard Interface - LaserClusterInterface
4  *
5  * Templated created: Thu Oct 12 10:49:19 2006
6  * Copyright 2013 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_LASERCLUSTERINTERFACE_H_
25 #define __INTERFACES_LASERCLUSTERINTERFACE_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(LaserClusterInterface)
37  /// @endcond
38  public:
39  /* constants */
40 
41  /**
42  Enumeration defining the possible cluster selection modes.
43  */
44  typedef enum {
46  Choose the cluster with the minimum angle difference from 0 degrees.
47  */,
49  Choose the cluster with the minimum distance in X direction of
50  the reference frame (typically forward).
51  */
52  } SelectionMode;
53  const char * tostring_SelectionMode(SelectionMode value) const;
54 
55  private:
56  /** Internal data storage, do NOT modify! */
57  typedef struct __attribute__((packed)) {
58  int64_t timestamp_sec; /**< Interface Unix timestamp, seconds */
59  int64_t timestamp_usec; /**< Interface Unix timestamp, micro-seconds */
60  float max_x; /**< Maximum distance in X coordinate
61  of sensor frame. */
62  int32_t selection_mode; /**<
63  Current cluster selection mode.
64  */
65  } LaserClusterInterface_data_t;
66 
67  LaserClusterInterface_data_t *data;
68 
69  interface_enum_map_t enum_map_SelectionMode;
70  public:
71  /* messages */
72  class SetMaxXMessage : public Message
73  {
74  private:
75  /** Internal data storage, do NOT modify! */
76  typedef struct __attribute__((packed)) {
77  int64_t timestamp_sec; /**< Interface Unix timestamp, seconds */
78  int64_t timestamp_usec; /**< Interface Unix timestamp, micro-seconds */
79  float max_x; /**< Maximum distance in X coordinate
80  of sensor frame. */
81  } SetMaxXMessage_data_t;
82 
83  SetMaxXMessage_data_t *data;
84 
85  interface_enum_map_t enum_map_SelectionMode;
86  public:
87  SetMaxXMessage(const float ini_max_x);
89  ~SetMaxXMessage();
90 
92  /* Methods */
93  float max_x() const;
94  void set_max_x(const float new_max_x);
95  size_t maxlenof_max_x() const;
96  virtual Message * clone() const;
97  };
98 
100  {
101  private:
102  /** Internal data storage, do NOT modify! */
103  typedef struct __attribute__((packed)) {
104  int64_t timestamp_sec; /**< Interface Unix timestamp, seconds */
105  int64_t timestamp_usec; /**< Interface Unix timestamp, micro-seconds */
106  int32_t selection_mode; /**<
107  Current cluster selection mode.
108  */
109  } SetSelectionModeMessage_data_t;
110 
111  SetSelectionModeMessage_data_t *data;
112 
113  interface_enum_map_t enum_map_SelectionMode;
114  public:
115  SetSelectionModeMessage(const SelectionMode ini_selection_mode);
118 
120  /* Methods */
121  SelectionMode selection_mode() const;
122  void set_selection_mode(const SelectionMode new_selection_mode);
123  size_t maxlenof_selection_mode() const;
124  virtual Message * clone() const;
125  };
126 
127  virtual bool message_valid(const Message *message) const;
128  private:
131 
132  public:
133  /* Methods */
134  float max_x() const;
135  void set_max_x(const float new_max_x);
136  size_t maxlenof_max_x() const;
137  SelectionMode selection_mode() const;
138  void set_selection_mode(const SelectionMode new_selection_mode);
139  size_t maxlenof_selection_mode() const;
140  virtual Message * create_message(const char *type) const;
141 
142  virtual void copy_values(const Interface *other);
143  virtual const char * enum_tostring(const char *enumtype, int val) const;
144 
145 };
146 
147 } // end namespace fawkes
148 
149 #endif
Base class for all messages passed through interfaces in Fawkes BlackBoard.
Definition: message.h:44
void set_selection_mode(const SelectionMode new_selection_mode)
Set selection_mode value.
const char * tostring_SelectionMode(SelectionMode value) const
Convert SelectionMode constant to string.
virtual Message * create_message(const char *type) const
Create message based on type name.
Choose the cluster with the minimum angle difference from 0 degrees.
LaserClusterInterface Fawkes BlackBoard Interface.
Fawkes library namespace.
SetSelectionModeMessage Fawkes BlackBoard Interface Message.
float max_x() const
Get max_x value.
SetMaxXMessage Fawkes BlackBoard Interface Message.
virtual bool message_valid(const Message *message) const
Check if message is valid and can be enqueued.
Base class for all Fawkes BlackBoard interfaces.
Definition: interface.h:79
Choose the cluster with the minimum distance in X direction of the reference frame (typically forward...
size_t maxlenof_max_x() const
Get maximum length of max_x value.
const char * type() const
Get type of interface.
Definition: interface.cpp:651
size_t maxlenof_selection_mode() const
Get maximum length of selection_mode value.
virtual void copy_values(const Interface *other)
Copy values from other interface.
void set_max_x(const float new_max_x)
Set max_x value.
SelectionMode selection_mode() const
Get selection_mode value.
std::map< int, std::string > interface_enum_map_t
Map of enum integer to string values.
Definition: types.h:53
virtual const char * enum_tostring(const char *enumtype, int val) const
Convert arbitrary enum value to string.
SelectionMode
Enumeration defining the possible cluster selection modes.