g2o
Loading...
Searching...
No Matches
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
33namespace SlamParser {
34
42
44 public:
47 virtual ~CommandNode() {}
49 const std::string& tag() const { return _tag; }
50
51 protected:
53 std::string _tag;
54};
55
56class AddNode : public CommandNode {
57 public:
58 AddNode(const std::string& tag, int id, int dimension,
59 const std::vector<double>& values = std::vector<double>())
61 _id(id),
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;
72 std::vector<double> _values;
73};
74
75class 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)
81 _id(id),
83 _id1(id1),
84 _id2(id2),
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;
98 int _id1;
99 int _id2;
100 std::vector<double> _values;
101 std::vector<double> _information;
102};
103
104class SolveSate : public CommandNode {
105 public:
106 SolveSate(const std::string& tag) : CommandNode(CT_SOLVE_STATE, tag) {}
107};
108
109class QueryState : public CommandNode {
110 public:
111 explicit QueryState(const std::string& tag,
112 const std::vector<int>& ids = std::vector<int>())
114 const std::vector<int>& ids() { return _ids; }
115
116 protected:
117 std::vector<int> _ids;
118};
119
120class 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
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
int id() const
Definition commands.h:88
int id2() const
Definition commands.h:91
std::vector< double > _information
Definition commands.h:101
int dimension() const
Definition commands.h:89
int id1() const
Definition commands.h:90
std::vector< double > _values
Definition commands.h:100
const std::vector< double > & values()
Definition commands.h:92
const std::vector< double > & information()
Definition commands.h:93
const std::vector< double > & values()
Definition commands.h:67
AddNode(const std::string &tag, int id, int dimension, const std::vector< double > &values=std::vector< double >())
Definition commands.h:58
int dimension() const
Definition commands.h:66
std::vector< double > _values
Definition commands.h:72
int id() const
Definition commands.h:65
CommandNode(CommandType commandType, const std::string &tag)
Definition commands.h:45
CommandType _commandType
Definition commands.h:52
const std::string & tag() const
Definition commands.h:49
CommandType commandType() const
Definition commands.h:48
const std::vector< int > & ids()
Definition commands.h:124
std::vector< int > _ids
Definition commands.h:127
FixNode(const std::string &tag, const std::vector< int > &ids)
Definition commands.h:122
const std::vector< int > & ids()
Definition commands.h:114
std::vector< int > _ids
Definition commands.h:117
QueryState(const std::string &tag, const std::vector< int > &ids=std::vector< int >())
Definition commands.h:111
SolveSate(const std::string &tag)
Definition commands.h:106
@ CT_ADD_EDGE
Definition commands.h:37
@ CT_ADD_NODE
Definition commands.h:36
@ CT_QUERY_STATE
Definition commands.h:39
@ CT_SOLVE_STATE
Definition commands.h:38