Fawkes API  Fawkes Development Version
LaserLineInterface.h
1 
2 /***************************************************************************
3  * LaserLineInterface.h - Fawkes BlackBoard Interface - LaserLineInterface
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_LASERLINEINTERFACE_H_
25 #define __INTERFACES_LASERLINEINTERFACE_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(LaserLineInterface)
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_id[32]; /**<
47  Coordinate frame ID of data.
48  */
49  int32_t visibility_history; /**<
50  The visibilitiy history indicates the number of consecutive positive or negative
51  sightings. If the history is negative, there have been as many negative sightings
52  (object not visible) as the absolute value of the history. A positive value denotes
53  as many positive sightings. 0 shall only be used during the initialization of the
54  interface or if the visibility history is not updated.
55  */
56  float point_on_line[3]; /**<
57  Vector to some point on the line
58  */
59  float line_direction[3]; /**<
60  Vector in the direction of the line.
61  */
62  float bearing; /**<
63  Direction towards the line, i.e. if the robot turns by this
64  angle the robot will stand parallel to the line.
65  */
66  float end_point_1[3]; /**<
67  3D coordinates in the reference frame of one endpoint of the
68  line. The end points are ordered arbitrarily.
69  */
70  float end_point_2[3]; /**<
71  3D coordinates in the reference frame of the second endpoint of
72  the line.
73  */
74  float length; /**< Length of the line. */
75  } LaserLineInterface_data_t;
76 
77  LaserLineInterface_data_t *data;
78 
79  public:
80  /* messages */
81  virtual bool message_valid(const Message *message) const;
82  private:
85 
86  public:
87  /* Methods */
88  char * frame_id() const;
89  void set_frame_id(const char * new_frame_id);
90  size_t maxlenof_frame_id() const;
91  int32_t visibility_history() const;
92  void set_visibility_history(const int32_t new_visibility_history);
93  size_t maxlenof_visibility_history() const;
94  float * point_on_line() const;
95  float point_on_line(unsigned int index) const;
96  void set_point_on_line(unsigned int index, const float new_point_on_line);
97  void set_point_on_line(const float * new_point_on_line);
98  size_t maxlenof_point_on_line() const;
99  float * line_direction() const;
100  float line_direction(unsigned int index) const;
101  void set_line_direction(unsigned int index, const float new_line_direction);
102  void set_line_direction(const float * new_line_direction);
103  size_t maxlenof_line_direction() const;
104  float bearing() const;
105  void set_bearing(const float new_bearing);
106  size_t maxlenof_bearing() const;
107  float * end_point_1() const;
108  float end_point_1(unsigned int index) const;
109  void set_end_point_1(unsigned int index, const float new_end_point_1);
110  void set_end_point_1(const float * new_end_point_1);
111  size_t maxlenof_end_point_1() const;
112  float * end_point_2() const;
113  float end_point_2(unsigned int index) const;
114  void set_end_point_2(unsigned int index, const float new_end_point_2);
115  void set_end_point_2(const float * new_end_point_2);
116  size_t maxlenof_end_point_2() const;
117  float length() const;
118  void set_length(const float new_length);
119  size_t maxlenof_length() const;
120  virtual Message * create_message(const char *type) const;
121 
122  virtual void copy_values(const Interface *other);
123  virtual const char * enum_tostring(const char *enumtype, int val) const;
124 
125 };
126 
127 } // end namespace fawkes
128 
129 #endif
void set_bearing(const float new_bearing)
Set bearing value.
Base class for all messages passed through interfaces in Fawkes BlackBoard.
Definition: message.h:44
void set_end_point_2(unsigned int index, const float new_end_point_2)
Set end_point_2 value at given index.
void set_visibility_history(const int32_t new_visibility_history)
Set visibility_history value.
virtual bool message_valid(const Message *message) const
Check if message is valid and can be enqueued.
Fawkes library namespace.
void set_end_point_1(unsigned int index, const float new_end_point_1)
Set end_point_1 value at given index.
size_t maxlenof_frame_id() const
Get maximum length of frame_id value.
size_t maxlenof_line_direction() const
Get maximum length of line_direction value.
void set_length(const float new_length)
Set length value.
void set_line_direction(unsigned int index, const float new_line_direction)
Set line_direction value at given index.
float * point_on_line() const
Get point_on_line value.
char * frame_id() const
Get frame_id value.
LaserLineInterface Fawkes BlackBoard Interface.
Base class for all Fawkes BlackBoard interfaces.
Definition: interface.h:79
size_t maxlenof_point_on_line() const
Get maximum length of point_on_line value.
float length() const
Get length value.
virtual void copy_values(const Interface *other)
Copy values from other interface.
float * line_direction() const
Get line_direction value.
void set_point_on_line(unsigned int index, const float new_point_on_line)
Set point_on_line value at given index.
float * end_point_2() const
Get end_point_2 value.
size_t maxlenof_end_point_1() const
Get maximum length of end_point_1 value.
const char * type() const
Get type of interface.
Definition: interface.cpp:651
float bearing() const
Get bearing value.
int32_t visibility_history() const
Get visibility_history value.
virtual Message * create_message(const char *type) const
Create message based on type name.
size_t maxlenof_length() const
Get maximum length of length value.
size_t maxlenof_end_point_2() const
Get maximum length of end_point_2 value.
size_t maxlenof_bearing() const
Get maximum length of bearing value.
virtual const char * enum_tostring(const char *enumtype, int val) const
Convert arbitrary enum value to string.
size_t maxlenof_visibility_history() const
Get maximum length of visibility_history value.
void set_frame_id(const char *new_frame_id)
Set frame_id value.
float * end_point_1() const
Get end_point_1 value.