29 #include <Eigen/Geometry>
31 #include <VirtualRobot/CollisionDetection/CollisionModel.h>
32 #include <VirtualRobot/ManipulationObject.h>
33 #include <VirtualRobot/Primitive.h>
34 #include <VirtualRobot/SceneObjectSet.h>
35 #include <VirtualRobot/VirtualRobot.h>
36 #include <VirtualRobot/Visualization/CoinVisualization/CoinVisualizationFactory.h>
37 #include <VirtualRobot/Visualization/VisualizationNode.h>
51 const std::vector<std::string>& datasetDisableList)
55 const auto dataset = objectPose.objectID.dataset();
57 return std::find(datasetDisableList.begin(), datasetDisableList.end(), dataset) !=
58 datasetDisableList.end();
61 objects.erase(std::remove_if(objects.begin(), objects.end(), isInDisableList),
70 {
return not objectPose.isStatic; };
72 objects.erase(std::remove_if(objects.begin(), objects.end(), isDynamic), objects.end());
84 const auto objInfo = finder.
findObject(objectPose.objectID);
86 const bool hasArticulatedModel = objInfo->getArticulatedModel().has_value();
87 return hasArticulatedModel;
90 objects.erase(std::remove_if(objects.begin(), objects.end(), isArticulated), objects.end());
102 const auto objInfo = finder.
findObject(objectPose.objectID);
104 const bool hasArticulatedModel = objInfo->getArticulatedModel().has_value();
105 return not hasArticulatedModel;
108 objects.erase(std::remove_if(objects.begin(), objects.end(), isNonArticulated),
113 std::optional<objpose::ObjectPose>
117 {
return objectPose.objectID == objectID; };
119 const auto it = std::find_if(objectPoses.begin(), objectPoses.end(), matchesId);
120 if (it != objectPoses.end())
128 VirtualRobot::ManipulationObjectPtr
134 VirtualRobot::SceneObjectSetPtr sceneObjects(
new VirtualRobot::SceneObjectSet);
145 VirtualRobot::SceneObjectSetPtr
151 VirtualRobot::SceneObjectSetPtr sceneObjects(
new VirtualRobot::SceneObjectSet);
152 for (
const auto& objectPose : objectPoses)
156 obstacle->setGlobalPose(objectPose.objectPoseGlobal);
157 sceneObjects->addSceneObject(obstacle);
170 VirtualRobot::SceneObjectSetPtr sceneObjects(
new VirtualRobot::SceneObjectSet);
179 VirtualRobot::SceneObjectSetPtr
184 const auto obstacles = ocHelper.
obstacles();
186 const float boxSize = occupancyGrid.
resolution;
187 const float resolution = occupancyGrid.
resolution;
189 VirtualRobot::SceneObjectSetPtr sceneObjects(
new VirtualRobot::SceneObjectSet);
192 <<
"Only occupancy grid in global frame supported.";
194 VirtualRobot::CoinVisualizationFactory factory;
196 const auto& world_T_map = occupancyGrid.
pose;
198 for (
int x = 0; x < obstacles.rows(); x++)
200 for (
int y = 0; y < obstacles.cols(); y++)
204 const Eigen::Vector3f pos{
205 static_cast<float>(x * resolution),
static_cast<float>(y * resolution), 0};
209 map_T_obj.translation() = pos;
211 Eigen::Affine3f world_T_obj = world_T_map * map_T_obj;
215 auto cube = factory.createBox(boxSize, boxSize, boxSize);
217 VirtualRobot::CollisionModelPtr collisionModel(
218 new VirtualRobot::CollisionModel(cube));
221 "box_" +
std::to_string(sceneObjects->getSize()), cube, collisionModel));
222 sceneObject->setGlobalPose(world_T_obj.matrix());
224 sceneObjects->addSceneObject(sceneObject);