Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Erro: Position is out of range #7

Open
nanbwrn opened this issue Dec 12, 2023 · 4 comments
Open

Erro: Position is out of range #7

nanbwrn opened this issue Dec 12, 2023 · 4 comments

Comments

@nanbwrn
Copy link

nanbwrn commented Dec 12, 2023

When I was simulating in Gazebo, the robot suddenly fell after covering some distance, and the following error message appeared in the terminal. Could you please advise on how to fix it?

GridMap: atPosition(...): Position is out of range.

The following is a simulation video:

动画3

@YifuYuan
Copy link

Hi @nanbwrn,
I'm not exactly sure but I guess you can bring up Rviz and see what the elevation mapping and plane segmentation actually look like. For me, it looks like the elevation mapping is not moving with the robot but stays at the origin instead.

@hgaren
Copy link

hgaren commented Dec 12, 2023

"GridMap: atPosition(...): Position is out of range" The reason of this error is attempting to obtain a position outside the grid map size in the grid map search. Perhaps you could consider implementing the following changes in PerceptiveLeggedReferenceManager.cpp:

 // Base Orientation
    scalar_t step = 0.3;
    grid_map::Vector3 normalVector;
    bool not_in_map = false;

    if(grid_map::checkIfPositionWithinMap( pos + grid_map::Position(-step, 0),map.getLength(),map.getPosition()) )
      not_in_map = true;
    else if(grid_map::checkIfPositionWithinMap( pos + grid_map::Position(step, 0),map.getLength(),map.getPosition()) )
      not_in_map = true;
    else if(grid_map::checkIfPositionWithinMap( pos +grid_map::Position(0, -step),map.getLength(),map.getPosition()) )
      not_in_map = true;
    else if(grid_map::checkIfPositionWithinMap( pos + grid_map::Position(0, -step),map.getLength(),map.getPosition()) )
      not_in_map = true;

    if(not_in_map){
      normalVector(0) = 0.0;
      normalVector(1) = 0.0;
      normalVector(2) = 1;

    }else{
      normalVector(0) = (map.atPosition("smooth_planar", pos + grid_map::Position(-step, 0)) -
                        map.atPosition("smooth_planar", pos + grid_map::Position(step, 0))) /
                        (2 * step);
      normalVector(1) = (map.atPosition("smooth_planar", pos + grid_map::Position(0, -step)) -
                        map.atPosition("smooth_planar", pos + grid_map::Position(0, step))) /
                        (2 * step);
      normalVector(2) = 1;
    }

@nanbwrn
Copy link
Author

nanbwrn commented Dec 12, 2023

hi,@YifuYuan ,@hgaren

Thank you so much for your timely reply!

After making modifications according to your method, the robot still falls during simulation, and the same error as before appears in the terminal.
When I launch RViz, the polygons around the robot do not move along with the robot.

动画4

@tony-hj
Copy link

tony-hj commented Mar 15, 2024

Hi @nanbwrn
I have face the same error like you.Have you slove this problem?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants