Skip to content
Snippets Groups Projects
Commit 84e57545 authored by Rainer Kartmann's avatar Rainer Kartmann
Browse files

Update objects in ArVizExample, make style more consistent

parent a873ac99
No related branches found
No related tags found
No related merge requests found
......@@ -128,7 +128,6 @@ namespace armarx
Eigen::Vector3f direction = dirRot * Eigen::Vector3f::UnitX();
arrow.direction(direction);
Eigen::Vector3f pos = Eigen::Vector3f::Zero();
pos.z() = +300.0f;
pos.x() = -500.0f;
......@@ -334,23 +333,31 @@ namespace armarx
pos.x() = 100.0f * std::sin(timeInSeconds);
pos.y() = 1000.0f;
viz::Object sponge = viz::Object("sponge")
.position(pos)
.file("ArmarXObjects", "ArmarXObjects/SecondHands/Screwbox_big/Screwbox_big.xml");
viz::Object sponge =
viz::Object("screwbox")
.position(pos)
.file("PriorKnowledgeData",
"PriorKnowledgeData/objects/Maintenance/bauhaus-screwbox-large/bauhaus-screwbox-large.xml");
layer.add(sponge);
layer.add(viz::Pose("screwbox pose").position(pos));
}
{
Eigen::Vector3f pos = Eigen::Vector3f::Zero();
pos.x() = 300.0f + 100.0f * std::sin(timeInSeconds);
pos.y() = 1000.0f;
viz::Object spraybottle = viz::Object("spraybottle")
.position(pos)
.file("ArmarXObjects", "ArmarXObjects/SecondHands/Spraybottle/Spraybottle.xml");
Eigen::AngleAxisf orientation(M_PI_2, Eigen::Vector3f::UnitX());
viz::Object spraybottle =
viz::Object("spraybottle")
.position(pos)
.orientation(Eigen::Quaternionf(orientation))
.file("PriorKnowledgeData",
"PriorKnowledgeData/objects/Maintenance/spraybottle/spraybottle.wrl");
layer.add(spraybottle);
layer.add(viz::Pose("spraybottle pose").pose(pos, orientation.toRotationMatrix()));
}
}
......@@ -362,11 +369,18 @@ namespace armarx
const Eigen::Vector3f at = {-400, 0, 100};
const Eigen::Vector3f dir = {-150, 0, 0};
layer.add(viz::Box("box_always").position(at).size(100).color(simox::Color::azure()));
layer.add(viz::Text("text_seconds").position(at + Eigen::Vector3f(0, 0, 100))
layer.add(viz::Box("box_always")
.position(at).size(100)
.color(simox::Color::azure())
);
layer.add(viz::Text("text_seconds")
.position(at + Eigen::Vector3f(0, 0, 100))
.orientation(Eigen::AngleAxisf(float(M_PI), Eigen::Vector3f::UnitZ())
* Eigen::Quaternionf::FromTwoVectors(Eigen::Vector3f::UnitZ(), - Eigen::Vector3f::UnitY()))
.text(std::to_string(time % 3)).scale(5).color(simox::Color::black()));
.text(std::to_string(time % 3))
.scale(5)
.color(simox::Color::black())
);
switch (time % 3)
{
......@@ -405,9 +419,11 @@ namespace armarx
{
std::stringstream ss;
ss << "box_" << x << "_" << y << "_" << z;
layer.add(viz::Box(ss.str()).position(at + dist * Eigen::Vector3f(x, y, z))
layer.add(viz::Box(ss.str())
.position(at + dist * Eigen::Vector3f(x, y, z))
.orientation(Eigen::AngleAxisf(angle, Eigen::Vector3f::UnitZ()).toRotationMatrix())
.size(size).color(simox::Color(cf * x, cf * y, cf * z)));
.size(size)
.color(simox::Color(cf * x, cf * y, cf * z)));
}
}
}
......@@ -430,8 +446,10 @@ namespace armarx
const simox::color::ColorMap& cmap = pair.second;
Eigen::Vector3f shift(0, 0, - 1.5f * index * size.y());
viz::Mesh mesh = viz::Mesh(name + "_mesh").position(at + shift).orientation(ori)
.grid2D(size, num, [&cmap](size_t, size_t, const E::Vector3f & p)
viz::Mesh mesh = viz::Mesh(name + "_mesh")
.position(at + shift)
.orientation(ori)
.grid2D(size, num, [&cmap](size_t, size_t, const E::Vector3f & p)
{
return viz::Color(cmap((p.x() + 100.f) / 200.f));
});
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment