Skip to content

Commit

Permalink
configureLocalWorldCosts works
Browse files Browse the repository at this point in the history
  • Loading branch information
guillermogilg99 committed Oct 10, 2024
1 parent 56ec0c2 commit 1f453c0
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 5 deletions.
8 changes: 4 additions & 4 deletions include/Grid3D/local_grid3d.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -183,7 +183,7 @@ class Local_Grid3d

bool isIntoMap(float x, float y, float z)
{
return (x >= 0.0 && y >= 0.0 && z >= 0.0 && x < m_maxX && y < m_maxY && z < m_maxZ);
return (x >= 0.0 && y >= 0.0 && z >= 0.0 && x <= (2*m_maxX) && y <= (2*m_maxY) && z <= (2*m_maxZ));
}
// int getCellCost(const float &_x, const float &_y, const float &_z){
// JAC Precision
Expand Down Expand Up @@ -436,9 +436,9 @@ class Local_Grid3d
// Get map parameters: They have to take from local_world_size_x, local_world_size_y , local_world_size_z of the launch
double maxX, maxY, maxZ, res;

maxX = 1.0; // distancia a cada lado del dron (en x)
maxY = 1.0; // distancia a cada lado del dron (en y)
maxZ = 1.0; // distancia a cada lado del dron (en z)
maxX = 4.0; // distancia a cada lado del dron (en x)
maxY = 4.0; // distancia a cada lado del dron (en y)
maxZ = 2.0; // distancia a cada lado del dron (en z)
res = 0.2;


Expand Down
19 changes: 18 additions & 1 deletion src/utils/ros/ROSInterfaces.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -132,7 +132,24 @@ namespace Planners
{
// Computar el grid local
_grid.computeLocalGrid(loaded_sdf, drone_x, drone_y, drone_z);
printf("-- Exiting computeLocalWorldCosts --\n");

auto world_size = _algorithm.getWorldSize();
std::cout << "World size: " << world_size << std::endl;
auto resolution = _algorithm.getWorldResolution();

for (int i = 0; i < world_size.x; i++)
{
for (int j = 0; j < world_size.y; j++)
{
for (int k = 0; k < world_size.z; k++)
{
float cost = _grid.getCellCost(i * resolution, j * resolution, k * resolution);
_algorithm.configureCellCost({i, j, k}, cost);
}
}
}


return true;
}

Expand Down

0 comments on commit 1f453c0

Please sign in to comment.