g2o
Toggle main menu visibility
Loading...
Searching...
No Matches
g2o
examples
interactive_slam
slam_parser
parser
commands.h
Go to the documentation of this file.
1
// g2o - General Graph Optimization
2
// Copyright (C) 2011 R. Kuemmerle, G. Grisetti, W. Burgard
3
// All rights reserved.
4
//
5
// Redistribution and use in source and binary forms, with or without
6
// modification, are permitted provided that the following conditions are
7
// met:
8
//
9
// * Redistributions of source code must retain the above copyright notice,
10
// this list of conditions and the following disclaimer.
11
// * Redistributions in binary form must reproduce the above copyright
12
// notice, this list of conditions and the following disclaimer in the
13
// documentation and/or other materials provided with the distribution.
14
//
15
// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS
16
// IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
17
// TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A
18
// PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
19
// HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
20
// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED
21
// TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
22
// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
23
// LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
24
// NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
25
// SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
26
27
#ifndef COMMANDS_H
28
#define COMMANDS_H
29
30
#include <string>
31
#include <vector>
32
33
namespace
SlamParser
{
34
35
enum
CommandType
{
36
CT_ADD_NODE
,
37
CT_ADD_EDGE
,
38
CT_SOLVE_STATE
,
39
CT_QUERY_STATE
,
40
CT_FIX
,
41
};
42
43
class
CommandNode
{
44
public
:
45
CommandNode
(
CommandType
commandType
,
const
std::string&
tag
)
46
:
_commandType
(
commandType
),
_tag
(
tag
) {}
47
virtual
~CommandNode
() {}
48
CommandType
commandType
()
const
{
return
_commandType
; }
49
const
std::string&
tag
()
const
{
return
_tag
; }
50
51
protected
:
52
CommandType
_commandType
;
53
std::string
_tag
;
54
};
55
56
class
AddNode
:
public
CommandNode
{
57
public
:
58
AddNode
(
const
std::string&
tag
,
int
id
,
int
dimension
,
59
const
std::vector<double>&
values
= std::vector<double>())
60
:
CommandNode
(
CT_ADD_NODE
,
tag
),
61
_id
(
id
),
62
_dimension
(
dimension
),
63
_values
(
values
) {}
64
65
int
id
()
const
{
return
_id
; }
66
int
dimension
()
const
{
return
_dimension
; }
67
const
std::vector<double>&
values
() {
return
_values
; }
68
69
protected
:
70
int
_id
;
71
int
_dimension
;
72
std::vector<double>
_values
;
73
};
74
75
class
AddEdge
:
public
CommandNode
{
76
public
:
77
AddEdge
(
const
std::string&
tag
,
int
id
,
int
dimension
,
int
id1
,
int
id2
,
78
const
std::vector<double>&
values
,
79
const
std::vector<double>
information
)
80
:
CommandNode
(
CT_ADD_EDGE
,
tag
),
81
_id
(
id
),
82
_dimension
(
dimension
),
83
_id1
(
id1
),
84
_id2
(
id2
),
85
_values
(
values
),
86
_information
(
information
) {}
87
88
int
id
()
const
{
return
_id
; }
89
int
dimension
()
const
{
return
_dimension
; }
90
int
id1
()
const
{
return
_id1
; }
91
int
id2
()
const
{
return
_id2
; }
92
const
std::vector<double>&
values
() {
return
_values
; }
93
const
std::vector<double>&
information
() {
return
_information
; }
94
95
protected
:
96
int
_id
;
97
int
_dimension
;
98
int
_id1
;
99
int
_id2
;
100
std::vector<double>
_values
;
101
std::vector<double>
_information
;
102
};
103
104
class
SolveSate
:
public
CommandNode
{
105
public
:
106
SolveSate
(
const
std::string&
tag
) :
CommandNode
(
CT_SOLVE_STATE
,
tag
) {}
107
};
108
109
class
QueryState
:
public
CommandNode
{
110
public
:
111
explicit
QueryState
(
const
std::string&
tag
,
112
const
std::vector<int>&
ids
= std::vector<int>())
113
:
CommandNode
(
CT_QUERY_STATE
,
tag
),
_ids
(
ids
) {}
114
const
std::vector<int>&
ids
() {
return
_ids
; }
115
116
protected
:
117
std::vector<int>
_ids
;
118
};
119
120
class
FixNode
:
public
CommandNode
{
121
public
:
122
explicit
FixNode
(
const
std::string&
tag
,
const
std::vector<int>&
ids
)
123
:
CommandNode
(
CT_FIX
,
tag
),
_ids
(
ids
) {}
124
const
std::vector<int>&
ids
() {
return
_ids
; }
125
126
protected
:
127
std::vector<int>
_ids
;
128
};
129
130
}
// namespace SlamParser
131
132
#endif
SlamParser::AddEdge::AddEdge
AddEdge(const std::string &tag, int id, int dimension, int id1, int id2, const std::vector< double > &values, const std::vector< double > information)
Definition
commands.h:77
SlamParser::AddEdge::id
int id() const
Definition
commands.h:88
SlamParser::AddEdge::_id2
int _id2
Definition
commands.h:99
SlamParser::AddEdge::id2
int id2() const
Definition
commands.h:91
SlamParser::AddEdge::_id1
int _id1
Definition
commands.h:98
SlamParser::AddEdge::_information
std::vector< double > _information
Definition
commands.h:101
SlamParser::AddEdge::dimension
int dimension() const
Definition
commands.h:89
SlamParser::AddEdge::id1
int id1() const
Definition
commands.h:90
SlamParser::AddEdge::_id
int _id
Definition
commands.h:96
SlamParser::AddEdge::_values
std::vector< double > _values
Definition
commands.h:100
SlamParser::AddEdge::values
const std::vector< double > & values()
Definition
commands.h:92
SlamParser::AddEdge::_dimension
int _dimension
Definition
commands.h:97
SlamParser::AddEdge::information
const std::vector< double > & information()
Definition
commands.h:93
SlamParser::AddNode::_dimension
int _dimension
Definition
commands.h:71
SlamParser::AddNode::values
const std::vector< double > & values()
Definition
commands.h:67
SlamParser::AddNode::AddNode
AddNode(const std::string &tag, int id, int dimension, const std::vector< double > &values=std::vector< double >())
Definition
commands.h:58
SlamParser::AddNode::dimension
int dimension() const
Definition
commands.h:66
SlamParser::AddNode::_values
std::vector< double > _values
Definition
commands.h:72
SlamParser::AddNode::_id
int _id
Definition
commands.h:70
SlamParser::AddNode::id
int id() const
Definition
commands.h:65
SlamParser::CommandNode::_tag
std::string _tag
Definition
commands.h:53
SlamParser::CommandNode::CommandNode
CommandNode(CommandType commandType, const std::string &tag)
Definition
commands.h:45
SlamParser::CommandNode::~CommandNode
virtual ~CommandNode()
Definition
commands.h:47
SlamParser::CommandNode::_commandType
CommandType _commandType
Definition
commands.h:52
SlamParser::CommandNode::tag
const std::string & tag() const
Definition
commands.h:49
SlamParser::CommandNode::commandType
CommandType commandType() const
Definition
commands.h:48
SlamParser::FixNode::ids
const std::vector< int > & ids()
Definition
commands.h:124
SlamParser::FixNode::_ids
std::vector< int > _ids
Definition
commands.h:127
SlamParser::FixNode::FixNode
FixNode(const std::string &tag, const std::vector< int > &ids)
Definition
commands.h:122
SlamParser::QueryState::ids
const std::vector< int > & ids()
Definition
commands.h:114
SlamParser::QueryState::_ids
std::vector< int > _ids
Definition
commands.h:117
SlamParser::QueryState::QueryState
QueryState(const std::string &tag, const std::vector< int > &ids=std::vector< int >())
Definition
commands.h:111
SlamParser::SolveSate::SolveSate
SolveSate(const std::string &tag)
Definition
commands.h:106
SlamParser
Definition
abstract_slam_interface.h:33
SlamParser::CommandType
CommandType
Definition
commands.h:35
SlamParser::CT_ADD_EDGE
@ CT_ADD_EDGE
Definition
commands.h:37
SlamParser::CT_ADD_NODE
@ CT_ADD_NODE
Definition
commands.h:36
SlamParser::CT_QUERY_STATE
@ CT_QUERY_STATE
Definition
commands.h:39
SlamParser::CT_SOLVE_STATE
@ CT_SOLVE_STATE
Definition
commands.h:38
SlamParser::CT_FIX
@ CT_FIX
Definition
commands.h:40
Generated on
for g2o by
1.17.0