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
31namespace 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
Base class for all Fawkes BlackBoard interfaces.
Definition: interface.h:80
const char * type() const
Get type of interface.
Definition: interface.cpp:652
LaserLineInterface Fawkes BlackBoard Interface.
size_t maxlenof_bearing() const
Get maximum length of bearing value.
void set_end_point_1(unsigned int index, const float new_end_point_1)
Set end_point_1 value at given index.
void set_end_point_frame_1(const char *new_end_point_frame_1)
Set end_point_frame_1 value.
size_t maxlenof_point_on_line() const
Get maximum length of point_on_line value.
float * line_direction() const
Get line_direction value.
int32_t visibility_history() const
Get visibility_history value.
virtual void copy_values(const Interface *other)
Copy values from other interface.
float * point_on_line() const
Get point_on_line value.
virtual const char * enum_tostring(const char *enumtype, int val) const
Convert arbitrary enum value to string.
void set_line_direction(unsigned int index, const float new_line_direction)
Set line_direction value at given index.
void set_visibility_history(const int32_t new_visibility_history)
Set visibility_history value.
size_t maxlenof_line_direction() const
Get maximum length of line_direction value.
virtual Message * create_message(const char *type) const
Create message based on type name.
size_t maxlenof_visibility_history() const
Get maximum length of visibility_history 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.
float * end_point_1() const
Get end_point_1 value.
virtual bool message_valid(const Message *message) const
Check if message is valid and can be enqueued.
char * frame_id() const
Get frame_id value.
void set_length(const float new_length)
Set length value.
size_t maxlenof_end_point_frame_2() const
Get maximum length of end_point_frame_2 value.
size_t maxlenof_end_point_1() const
Get maximum length of end_point_1 value.
void set_frame_id(const char *new_frame_id)
Set frame_id value.
float length() const
Get length value.
void set_bearing(const float new_bearing)
Set bearing value.
char * end_point_frame_1() const
Get end_point_frame_1 value.
void set_end_point_frame_2(const char *new_end_point_frame_2)
Set end_point_frame_2 value.
size_t maxlenof_end_point_2() const
Get maximum length of end_point_2 value.
char * end_point_frame_2() const
Get end_point_frame_2 value.
size_t maxlenof_end_point_frame_1() const
Get maximum length of end_point_frame_1 value.
void set_end_point_2(unsigned int index, const float new_end_point_2)
Set end_point_2 value at given index.
float bearing() const
Get bearing value.
size_t maxlenof_length() const
Get maximum length of length value.
size_t maxlenof_frame_id() const
Get maximum length of frame_id value.
Base class for all messages passed through interfaces in Fawkes BlackBoard.
Definition: message.h:44
Fawkes library namespace.