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 {
45  SELMODE_MIN_ANGLE /**<
46  Choose the cluster with the minimum angle difference from 0 degrees.
47  */,
48  SELMODE_MIN_DIST /**<
49  Choose the cluster with the minimum distance in X direction of
50  the reference frame (typically forward).
51  */
53  const char * tostring_SelectionMode(SelectionMode value) const;
54 
55  private:
56  /** Internal data storage, do NOT modify! */
57  typedef struct {
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 {
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);
90 
91  explicit SetMaxXMessage(const SetMaxXMessage *m);
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 {
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 */
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;
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
fawkes::LaserClusterInterface::copy_values
virtual void copy_values(const Interface *other)
Copy values from other interface.
Definition: LaserClusterInterface.cpp:165
fawkes::LaserClusterInterface::SetMaxXMessage::SetMaxXMessage
SetMaxXMessage()
Constructor.
Definition: LaserClusterInterface.cpp:208
fawkes::LaserClusterInterface::SetMaxXMessage
SetMaxXMessage Fawkes BlackBoard Interface Message.
Definition: LaserClusterInterface.h:73
fawkes::LaserClusterInterface::SetMaxXMessage::set_max_x
void set_max_x(const float new_max_x)
Set max_x value.
Definition: LaserClusterInterface.cpp:266
fawkes::LaserClusterInterface::maxlenof_selection_mode
size_t maxlenof_selection_mode() const
Get maximum length of selection_mode value.
Definition: LaserClusterInterface.cpp:129
fawkes::Message
Base class for all messages passed through interfaces in Fawkes BlackBoard.
Definition: message.h:45
fawkes::LaserClusterInterface::SELMODE_MIN_DIST
@ SELMODE_MIN_DIST
Choose the cluster with the minimum distance in X direction of the reference frame (typically forward...
Definition: LaserClusterInterface.h:48
fawkes::LaserClusterInterface::SelectionMode
SelectionMode
Enumeration defining the possible cluster selection modes.
Definition: LaserClusterInterface.h:44
fawkes::LaserClusterInterface::SetSelectionModeMessage::SetSelectionModeMessage
SetSelectionModeMessage()
Constructor.
Definition: LaserClusterInterface.cpp:304
fawkes::Interface::type
const char * type() const
Get type of interface.
Definition: interface.cpp:643
fawkes::LaserClusterInterface::SetMaxXMessage::clone
virtual Message * clone() const
Clone this message.
Definition: LaserClusterInterface.cpp:277
fawkes::LaserClusterInterface::message_valid
virtual bool message_valid(const Message *message) const
Check if message is valid and can be enqueued.
Definition: LaserClusterInterface.cpp:384
fawkes::LaserClusterInterface::SetSelectionModeMessage
SetSelectionModeMessage Fawkes BlackBoard Interface Message.
Definition: LaserClusterInterface.h:100
fawkes::LaserClusterInterface::SetSelectionModeMessage::maxlenof_selection_mode
size_t maxlenof_selection_mode() const
Get maximum length of selection_mode value.
Definition: LaserClusterInterface.cpp:352
fawkes::LaserClusterInterface::create_message
virtual Message * create_message(const char *type) const
Create message based on type name.
Definition: LaserClusterInterface.cpp:148
fawkes::LaserClusterInterface::maxlenof_max_x
size_t maxlenof_max_x() const
Get maximum length of max_x value.
Definition: LaserClusterInterface.cpp:96
fawkes::LaserClusterInterface::set_selection_mode
void set_selection_mode(const SelectionMode new_selection_mode)
Set selection_mode value.
Definition: LaserClusterInterface.cpp:141
fawkes
Fawkes library namespace.
fawkes::LaserClusterInterface::SetSelectionModeMessage::set_selection_mode
void set_selection_mode(const SelectionMode new_selection_mode)
Set selection_mode value.
Definition: LaserClusterInterface.cpp:364
fawkes::LaserClusterInterface::SetMaxXMessage::max_x
float max_x() const
Get max_x value.
Definition: LaserClusterInterface.cpp:245
fawkes::LaserClusterInterface::SetMaxXMessage::~SetMaxXMessage
~SetMaxXMessage()
Destructor.
Definition: LaserClusterInterface.cpp:221
fawkes::LaserClusterInterface::tostring_SelectionMode
const char * tostring_SelectionMode(SelectionMode value) const
Convert SelectionMode constant to string.
Definition: LaserClusterInterface.cpp:71
fawkes::Interface
Base class for all Fawkes BlackBoard interfaces.
Definition: interface.h:79
fawkes::interface_enum_map_t
std::map< int, std::string > interface_enum_map_t
Map of enum integer to string values.
Definition: types.h:54
fawkes::LaserClusterInterface::selection_mode
SelectionMode selection_mode() const
Get selection_mode value.
Definition: LaserClusterInterface.cpp:119
fawkes::LaserClusterInterface::SetSelectionModeMessage::~SetSelectionModeMessage
~SetSelectionModeMessage()
Destructor.
Definition: LaserClusterInterface.cpp:317
fawkes::LaserClusterInterface::max_x
float max_x() const
Get max_x value.
Definition: LaserClusterInterface.cpp:86
fawkes::LaserClusterInterface::set_max_x
void set_max_x(const float new_max_x)
Set max_x value.
Definition: LaserClusterInterface.cpp:107
fawkes::LaserClusterInterface
LaserClusterInterface Fawkes BlackBoard Interface.
Definition: LaserClusterInterface.h:34
fawkes::LaserClusterInterface::SELMODE_MIN_ANGLE
@ SELMODE_MIN_ANGLE
Choose the cluster with the minimum angle difference from 0 degrees.
Definition: LaserClusterInterface.h:45
fawkes::LaserClusterInterface::SetSelectionModeMessage::selection_mode
SelectionMode selection_mode() const
Get selection_mode value.
Definition: LaserClusterInterface.cpp:342
fawkes::LaserClusterInterface::SetMaxXMessage::maxlenof_max_x
size_t maxlenof_max_x() const
Get maximum length of max_x value.
Definition: LaserClusterInterface.cpp:255
fawkes::LaserClusterInterface::enum_tostring
virtual const char * enum_tostring(const char *enumtype, int val) const
Convert arbitrary enum value to string.
Definition: LaserClusterInterface.cpp:176
fawkes::LaserClusterInterface::SetSelectionModeMessage::clone
virtual Message * clone() const
Clone this message.
Definition: LaserClusterInterface.cpp:375