27 #include <ArmarXCore/interface/core/BasicVectorTypes.h>
28 #include <VirtualRobot/Visualization/TriMeshUtils.h>
31 #include <VirtualRobot/Visualization/CoinVisualization/CoinVisualizationFactory.h>
32 #include <VirtualRobot/Visualization/VisualizationFactory.h>
36 VoxelGridCSpace::VoxelGridCSpace(visionx::VoxelGridProviderInterfacePrx voxelGridProvider, memoryx::CommonStorageInterfacePrx cs,
bool loadVisualizationModel,
float stationaryObjectMargin)
37 :
SimoxCSpace(cs, loadVisualizationModel, stationaryObjectMargin)
39 this->voxelGridProvider = voxelGridProvider;
52 gridSize, gridSize, gridSize,
53 VirtualRobot::VisualizationFactory::Color::Blue()
55 gridMesh->mergeVertices(10);
56 gridMesh->fattenShrink(stationaryObjectMargin);
58 auto visu = VirtualRobot::CoinVisualizationFactory().createTriMeshModelVisualization(gridMesh,
id);
60 VirtualRobot::CollisionModelPtr(
new VirtualRobot::CollisionModel(visu,
"PointCloudMeshGridCollisionModel",
agentSceneObj->getCollisionChecker())),
61 VirtualRobot::SceneObject::Physics(),
const_cast<VirtualRobot::CDManager*
>(&
cd)->getCollisionChecker()));
75 if (gridPositions.empty())
77 gridPositions = voxelGridProvider->getFilledGridPositions();
78 ARMARX_INFO <<
"Got grid with size: " << gridPositions.size();
79 gridSize = voxelGridProvider->getGridSize();
83 ARMARX_INFO <<
"Adding scene object with grid element count: " << gridPositions.size();
89 return obj->getName();
103 cloned->gridPositions = gridPositions;
104 cloned->gridSize = gridSize;
105 cloned->stationaryObjectMargin = stationaryObjectMargin;
106 for (
const auto& obj : stationaryObjects)
108 cloned->addStationaryObject(obj);
110 cloned->agentInfo = agentInfo;