Go to the documentation of this file.
19 int main(
int argc,
char** argv) {
22 std::cerr <<
"Error: you need to specify a test as argument" << std::endl;
25 std::string test_name (argv[1]);
29 if (test_name ==
"MathVector") {
33 for (
int i=0;i<3;i++) {
37 Vector3 subtraction = *twos - *ones;
38 Vector3 addition = *twos + *ones;
39 Vector3 multiplication = *twos * 2.;
41 for (
int i=0;i<3;i++) {
57 }
else if (test_name ==
"MathPose") {
59 Pose6D a (1.0f, 0.1f, 0.1f, 0.0f, 0.1f, (
float)
M_PI/4. );
62 Vector3 trans(1.0f, 0.1f, 0.1f);
85 }
else if (test_name ==
"InsertRay") {
105 point3d origin (0.01f, 0.01f, 0.02f);
106 point3d point_on_surface (2.01f,0.01f,0.01f);
108 for (
int i=0; i<360; i++) {
109 for (
int j=0; j<360; j++) {
125 }
else if (test_name ==
"InsertScan") {
128 point3d origin (0.01f, 0.01f, 0.02f);
129 point3d point_on_surface (2.01f, 0.01f, 0.01f);
131 for (
int i=0; i<360; i++) {
132 for (
int j=0; j<360; j++) {
133 point3d p = origin+point_on_surface;
135 point_on_surface.rotate_IP (0,0,
DEG2RAD(1.));
145 Pose6D node_pose (origin.
x(), origin.
y(), origin.
z(),0.0f,0.0f,0.0f);
146 graph->
addNode(measurement, node_pose);
151 }
else if (test_name ==
"ReadGraph") {
157 }
else if (test_name ==
"StampedTree") {
160 for (
int x=-20; x<20; x++)
161 for (
int y=-20; y<20; y++)
162 for (
int z=-20; z<20; z++) {
163 point3d p ((
float) x*0.05f+0.01f, (
float) y*0.05f+0.01f, (
float) z*0.05f+0.01f);
167 point3d query (0.1f, 0.1f, 0.1f);
172 std::cout <<
"After 1st update (cube): Tree time " <<tree_time <<
"; node(0.1, 0.1, 0.1) time " << result->
getTimestamp() << std::endl;
180 std::cout <<
"After 2nd update (single miss): Tree time " <<tree_time <<
"; node(0.1, 0.1, 0.1) time " << node_time << std::endl;
186 result = stamped_tree.
search (query);
188 std::cout <<
"After 3rd update (single hit at (0.1, 0.1, 0.3): Tree time " << stamped_tree.
getLastUpdateTime() <<
"; node(0.1, 0.1, 0.1) time " << result->
getTimestamp()
189 <<
"; node(0.1, 0.1, 0.3) time " << result2->
getTimestamp() << std::endl;
193 }
else if (test_name ==
"OcTreeKey") {
205 std::cerr <<
"Invalid test name specified: " << test_name << std::endl;
210 std::cerr <<
"Test successful.\n";
void setProbMiss(double prob)
sets the probability for a "miss" (will be converted to logodds) - sensor model
virtual bool insertRay(const point3d &origin, const point3d &end, double maxrange=-1.0, bool lazy_eval=false)
virtual NODE * updateNode(const OcTreeKey &key, float log_odds_update, bool lazy_eval=false)
virtual size_t size() const
void push_back(float x, float y, float z)
unsigned int getLastUpdateTime()
Vector3 & rotate_IP(double roll, double pitch, double yaw)
double probability(double logodds)
compute probability from logodds:
int main(int argc, char **argv)
#define EXPECT_TRUE(args)
This class represents a three-dimensional vector.
NODE * search(double x, double y, double z, unsigned int depth=0) const
#define EXPECT_FLOAT_EQ(a, b)
Vector3 transform(const Vector3 &v) const
Transformation of a vector.
void setProbHit(double prob)
sets the probability for a "hit" (will be converted to logodds) - sensor model
bool coordToKeyChecked(const point3d &coord, OcTreeKey &key) const
double keyToCoord(key_type key, unsigned depth) const
float logodds(double probability)
compute log-odds from probability:
ScanNode * addNode(Pointcloud *scan, pose6d pose)
std::ostream & writeBinary(std::ostream &s) const
unsigned int getTimestamp() const
This class represents a tree-dimensional pose of an object.
void integrateMissNoTime(OcTreeNodeStamped *node) const
octomath::Vector3 point3d
Use Vector3 (float precision) as a point3d in octomap.
This class represents a Quaternion.
Pose6D inv() const
Inversion.
virtual void insertPointCloud(const Pointcloud &scan, const octomap::point3d &sensor_origin, double maxrange=-1., bool lazy_eval=false, bool discretize=false)
bool writeBinary(const std::string &filename)
std::istream & readBinary(std::ifstream &s)
octomap
Author(s): Kai M. Wurm
, Armin Hornung
autogenerated on Tue Dec 12 2023 03:39:41