Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
R
RobotAPI
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Container Registry
Model registry
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Software
ArmarX
RobotAPI
Commits
d90c4488
Commit
d90c4488
authored
5 years ago
by
Rainer Kartmann
Browse files
Options
Downloads
Patches
Plain Diff
Add DebugDrawerTopicTest
parent
02a9bbd3
No related branches found
No related tags found
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
source/RobotAPI/libraries/core/test/CMakeLists.txt
+2
-0
2 additions, 0 deletions
source/RobotAPI/libraries/core/test/CMakeLists.txt
source/RobotAPI/libraries/core/test/DebugDrawerTopicTest.cpp
+143
-0
143 additions, 0 deletions
source/RobotAPI/libraries/core/test/DebugDrawerTopicTest.cpp
with
145 additions
and
0 deletions
source/RobotAPI/libraries/core/test/CMakeLists.txt
+
2
−
0
View file @
d90c4488
...
...
@@ -9,3 +9,5 @@ armarx_add_test(CartesianVelocityControllerTest CartesianVelocityControllerTest.
armarx_add_test
(
CartesianVelocityRampTest CartesianVelocityRampTest.cpp
"
${
LIBS
}
"
)
armarx_add_test
(
CartesianVelocityControllerWithRampTest CartesianVelocityControllerWithRampTest.cpp
"
${
LIBS
}
"
)
armarx_add_test
(
DebugDrawerTopicTest DebugDrawerTopicTest.cpp
"
${
LIBS
}
"
)
This diff is collapsed.
Click to expand it.
source/RobotAPI/libraries/core/test/DebugDrawerTopicTest.cpp
0 → 100644
+
143
−
0
View file @
d90c4488
/*
* This file is part of ArmarX.
*
* Copyright (C) 2011-2017, High Performance Humanoid Technologies (H2T), Karlsruhe Institute of Technology (KIT), all rights reserved.
*
* ArmarX is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License version 2 as
* published by the Free Software Foundation.
*
* ArmarX is distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*
* @package ArmarX
* @author Mirko Waechter( mirko.waechter at kit dot edu)
* @date 2018
* @copyright http://www.gnu.org/licenses/gpl-2.0.txt
* GNU General Public License
*/
#define BOOST_TEST_MODULE RobotAPI::DebugDrawerTopicTest::Test
#define ARMARX_BOOST_TEST
#include
<RobotAPI/Test.h>
#include
<ArmarXCore/core/test/IceTestHelper.h>
#include
<RobotAPI/libraries/core/visualization/DebugDrawerTopic.h>
using
namespace
armarx
;
// PCL-like dummy types.
struct
PointXYZ
{
float
x
,
y
,
z
;
};
struct
PointXYZRGBA
:
public
PointXYZ
{
uint8_t
r
,
g
,
b
,
a
;
};
struct
PointXYZRGBL
:
public
PointXYZRGBA
{
uint32_t
label
;
};
template
<
class
PointT
>
struct
PointCloud
{
private:
/// The point container type.
using
VectorT
=
std
::
vector
<
PointT
>
;
public:
PointCloud
()
{}
PointCloud
(
const
VectorT
&
points
)
:
points
(
points
)
{}
// Container methods.
std
::
size_t
size
()
const
{
return
points
.
size
();
}
PointT
&
operator
[](
std
::
size_t
i
)
{
return
points
[
i
];
}
const
PointT
&
operator
[](
std
::
size_t
i
)
const
{
return
points
[
i
];
}
// Iterators.
typename
VectorT
::
iterator
begin
()
{
return
points
.
begin
();
}
typename
VectorT
::
const_iterator
begin
()
const
{
return
points
.
begin
();
}
typename
VectorT
::
iterator
end
()
{
return
points
.
end
();
}
typename
VectorT
::
const_iterator
end
()
const
{
return
points
.
end
();
}
/// The points.
VectorT
points
;
};
/* These test do not actually check any behaviour,
* but check whether this code compiles.
*/
template
<
class
PointT
>
struct
Fixture
{
Fixture
()
{
}
const
DebugDrawerTopic
::
VisuID
id
{
"name"
,
"layer"
};
const
int
pointSize
=
10
;
DebugDrawerTopic
drawer
;
PointCloud
<
PointT
>
pointCloudMutable
;
const
PointCloud
<
PointT
>&
pointCloud
=
pointCloudMutable
;
};
BOOST_FIXTURE_TEST_CASE
(
test_drawPointCloud_PointXYZ
,
Fixture
<
PointXYZ
>
)
{
pointCloudMutable
.
points
=
{
{
1
,
2
,
3
},
{
2
,
3
,
4
},
{
3
,
4
,
5
}
};
drawer
.
drawPointCloud
(
id
,
pointCloud
);
drawer
.
drawPointCloud
(
id
,
pointCloud
.
points
,
DrawColor
{
0
,
0.5
,
1
,
1
});
drawer
.
drawPointCloud
(
id
,
pointCloud
,
[](
const
PointXYZ
&
)
{
return
DrawColor
{
0
,
0.5
,
1
,
1
};
},
pointSize
);
}
BOOST_FIXTURE_TEST_CASE
(
test_drawPointCloud_PointXYZRGBA
,
Fixture
<
PointXYZRGBA
>
)
{
drawer
.
drawPointCloud
(
id
,
pointCloud
);
drawer
.
drawPointCloud
(
id
,
pointCloud
.
points
,
DrawColor
{
0
,
0.5
,
1
,
1
});
drawer
.
drawPointCloud
(
id
,
pointCloud
,
[](
const
PointXYZRGBA
&
)
{
return
DrawColor
{
0
,
0.5
,
1
,
1
};
},
pointSize
);
drawer
.
drawPointCloudRGBA
(
id
,
pointCloud
,
pointSize
);
}
BOOST_FIXTURE_TEST_CASE
(
test_drawPointCloud_PointXYZRGBL
,
Fixture
<
PointXYZRGBL
>
)
{
drawer
.
drawPointCloud
(
id
,
pointCloud
);
drawer
.
drawPointCloud
(
id
,
pointCloud
.
points
,
DrawColor
{
0
,
0.5
,
1
,
1
});
drawer
.
drawPointCloud
(
id
,
pointCloud
,
[](
const
PointXYZRGBL
&
)
{
return
DrawColor
{
0
,
0.5
,
1
,
1
};
},
pointSize
);
drawer
.
drawPointCloudRGBA
(
id
,
pointCloud
,
pointSize
);
}
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment