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 {
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  char end_point_frame_1[32]; /**<
76  Coordinate frame ID representing first endpoint's identity
77  */
78  char end_point_frame_2[32]; /**<
79  Coordinate frame ID representing second endpoint's identity
80  */
81  } LaserLineInterface_data_t;
82 
83  LaserLineInterface_data_t *data;
84 
85  public:
86  /* messages */
87  virtual bool message_valid(const Message *message) const;
88  private:
91 
92  public:
93  /* Methods */
94  char * frame_id() const;
95  void set_frame_id(const char * new_frame_id);
96  size_t maxlenof_frame_id() const;
97  int32_t visibility_history() const;
98  void set_visibility_history(const int32_t new_visibility_history);
99  size_t maxlenof_visibility_history() const;
100  float * point_on_line() const;
101  float point_on_line(unsigned int index) const;
102  void set_point_on_line(unsigned int index, const float new_point_on_line);
103  void set_point_on_line(const float * new_point_on_line);
104  size_t maxlenof_point_on_line() const;
105  float * line_direction() const;
106  float line_direction(unsigned int index) const;
107  void set_line_direction(unsigned int index, const float new_line_direction);
108  void set_line_direction(const float * new_line_direction);
109  size_t maxlenof_line_direction() const;
110  float bearing() const;
111  void set_bearing(const float new_bearing);
112  size_t maxlenof_bearing() const;
113  float * end_point_1() const;
114  float end_point_1(unsigned int index) const;
115  void set_end_point_1(unsigned int index, const float new_end_point_1);
116  void set_end_point_1(const float * new_end_point_1);
117  size_t maxlenof_end_point_1() const;
118  float * end_point_2() const;
119  float end_point_2(unsigned int index) const;
120  void set_end_point_2(unsigned int index, const float new_end_point_2);
121  void set_end_point_2(const float * new_end_point_2);
122  size_t maxlenof_end_point_2() const;
123  float length() const;
124  void set_length(const float new_length);
125  size_t maxlenof_length() const;
126  char * end_point_frame_1() const;
127  void set_end_point_frame_1(const char * new_end_point_frame_1);
128  size_t maxlenof_end_point_frame_1() const;
129  char * end_point_frame_2() const;
130  void set_end_point_frame_2(const char * new_end_point_frame_2);
131  size_t maxlenof_end_point_frame_2() const;
132  virtual Message * create_message(const char *type) const;
133 
134  virtual void copy_values(const Interface *other);
135  virtual const char * enum_tostring(const char *enumtype, int val) const;
136 
137 };
138 
139 } // end namespace fawkes
140 
141 #endif
fawkes::LaserLineInterface::maxlenof_point_on_line
size_t maxlenof_point_on_line() const
Get maximum length of point_on_line value.
Definition: LaserLineInterface.cpp:181
fawkes::LaserLineInterface::set_point_on_line
void set_point_on_line(unsigned int index, const float new_point_on_line)
Set point_on_line value at given index.
Definition: LaserLineInterface.cpp:206
fawkes::LaserLineInterface::set_end_point_1
void set_end_point_1(unsigned int index, const float new_end_point_1)
Set end_point_1 value at given index.
Definition: LaserLineInterface.cpp:372
fawkes::LaserLineInterface::set_length
void set_length(const float new_length)
Set length value.
Definition: LaserLineInterface.cpp:468
fawkes::LaserLineInterface::set_frame_id
void set_frame_id(const char *new_frame_id)
Set frame_id value.
Definition: LaserLineInterface.cpp:100
fawkes::Message
Base class for all messages passed through interfaces in Fawkes BlackBoard.
Definition: message.h:45
fawkes::LaserLineInterface::point_on_line
float * point_on_line() const
Get point_on_line value.
Definition: LaserLineInterface.cpp:154
fawkes::LaserLineInterface::length
float length() const
Get length value.
Definition: LaserLineInterface.cpp:448
fawkes::LaserLineInterface::frame_id
char * frame_id() const
Get frame_id value.
Definition: LaserLineInterface.cpp:78
fawkes::LaserLineInterface::set_bearing
void set_bearing(const float new_bearing)
Set bearing value.
Definition: LaserLineInterface.cpp:304
fawkes::LaserLineInterface::end_point_2
float * end_point_2() const
Get end_point_2 value.
Definition: LaserLineInterface.cpp:384
fawkes::LaserLineInterface::maxlenof_end_point_1
size_t maxlenof_end_point_1() const
Get maximum length of end_point_1 value.
Definition: LaserLineInterface.cpp:345
fawkes::LaserLineInterface::maxlenof_line_direction
size_t maxlenof_line_direction() const
Get maximum length of line_direction value.
Definition: LaserLineInterface.cpp:244
fawkes::Interface::type
const char * type() const
Get type of interface.
Definition: interface.cpp:643
fawkes::LaserLineInterface::maxlenof_visibility_history
size_t maxlenof_visibility_history() const
Get maximum length of visibility_history value.
Definition: LaserLineInterface.cpp:126
fawkes::LaserLineInterface::message_valid
virtual bool message_valid(const Message *message) const
Check if message is valid and can be enqueued.
Definition: LaserLineInterface.cpp:576
fawkes::LaserLineInterface::maxlenof_frame_id
size_t maxlenof_frame_id() const
Get maximum length of frame_id value.
Definition: LaserLineInterface.cpp:88
fawkes::LaserLineInterface::maxlenof_end_point_2
size_t maxlenof_end_point_2() const
Get maximum length of end_point_2 value.
Definition: LaserLineInterface.cpp:412
fawkes::LaserLineInterface::maxlenof_length
size_t maxlenof_length() const
Get maximum length of length value.
Definition: LaserLineInterface.cpp:458
fawkes::LaserLineInterface::maxlenof_end_point_frame_1
size_t maxlenof_end_point_frame_1() const
Get maximum length of end_point_frame_1 value.
Definition: LaserLineInterface.cpp:490
fawkes::LaserLineInterface::end_point_frame_2
char * end_point_frame_2() const
Get end_point_frame_2 value.
Definition: LaserLineInterface.cpp:514
fawkes
Fawkes library namespace.
fawkes::LaserLineInterface::enum_tostring
virtual const char * enum_tostring(const char *enumtype, int val) const
Convert arbitrary enum value to string.
Definition: LaserLineInterface.cpp:565
fawkes::LaserLineInterface::maxlenof_bearing
size_t maxlenof_bearing() const
Get maximum length of bearing value.
Definition: LaserLineInterface.cpp:291
fawkes::Interface
Base class for all Fawkes BlackBoard interfaces.
Definition: interface.h:79
fawkes::LaserLineInterface::visibility_history
int32_t visibility_history() const
Get visibility_history value.
Definition: LaserLineInterface.cpp:116
fawkes::LaserLineInterface::set_visibility_history
void set_visibility_history(const int32_t new_visibility_history)
Set visibility_history value.
Definition: LaserLineInterface.cpp:142
fawkes::LaserLineInterface::set_end_point_frame_1
void set_end_point_frame_1(const char *new_end_point_frame_1)
Set end_point_frame_1 value.
Definition: LaserLineInterface.cpp:502
fawkes::LaserLineInterface::line_direction
float * line_direction() const
Get line_direction value.
Definition: LaserLineInterface.cpp:217
fawkes::LaserLineInterface::bearing
float bearing() const
Get bearing value.
Definition: LaserLineInterface.cpp:281
fawkes::LaserLineInterface::maxlenof_end_point_frame_2
size_t maxlenof_end_point_frame_2() const
Get maximum length of end_point_frame_2 value.
Definition: LaserLineInterface.cpp:524
fawkes::LaserLineInterface::create_message
virtual Message * create_message(const char *type) const
Create message based on type name.
Definition: LaserLineInterface.cpp:543
fawkes::LaserLineInterface::end_point_1
float * end_point_1() const
Get end_point_1 value.
Definition: LaserLineInterface.cpp:317
fawkes::LaserLineInterface
LaserLineInterface Fawkes BlackBoard Interface.
Definition: LaserLineInterface.h:34
fawkes::LaserLineInterface::set_end_point_2
void set_end_point_2(unsigned int index, const float new_end_point_2)
Set end_point_2 value at given index.
Definition: LaserLineInterface.cpp:439
fawkes::LaserLineInterface::set_line_direction
void set_line_direction(unsigned int index, const float new_line_direction)
Set line_direction value at given index.
Definition: LaserLineInterface.cpp:269
fawkes::LaserLineInterface::end_point_frame_1
char * end_point_frame_1() const
Get end_point_frame_1 value.
Definition: LaserLineInterface.cpp:480
fawkes::LaserLineInterface::set_end_point_frame_2
void set_end_point_frame_2(const char *new_end_point_frame_2)
Set end_point_frame_2 value.
Definition: LaserLineInterface.cpp:536
fawkes::LaserLineInterface::copy_values
virtual void copy_values(const Interface *other)
Copy values from other interface.
Definition: LaserLineInterface.cpp:554