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

How is 3d point converted to 1D representation in buffer #14

Closed
shubham-shahh opened this issue Aug 26, 2022 · 2 comments
Closed

How is 3d point converted to 1D representation in buffer #14

shubham-shahh opened this issue Aug 26, 2022 · 2 comments

Comments

@shubham-shahh
Copy link

shubham-shahh commented Aug 26, 2022

Hi @bigsuperZZZX @USTfgaoaa ,
my understanding of functions such as GridMap::globalIdx2BufIdx and GridMap::globalIdx2InfBufIdx, is that it converts 3D point to 1D representation for a 1D buffer, correct me If I am wrong
I want to understand the working of the function mentioned below

inline int GridMap::globalIdx2BufIdx(const Eigen::Vector3i &id)
{
  int x_buffer = (id(0) - md_.ringbuffer_origin3i_(0)) % md_.ringbuffer_size3i_(0);
  int y_buffer = (id(1) - md_.ringbuffer_origin3i_(1)) % md_.ringbuffer_size3i_(1);
  int z_buffer = (id(2) - md_.ringbuffer_origin3i_(2)) % md_.ringbuffer_size3i_(2);
  if (x_buffer < 0)
    x_buffer += md_.ringbuffer_size3i_(0);
  if (y_buffer < 0)
    y_buffer += md_.ringbuffer_size3i_(1);
  if (z_buffer < 0)
    z_buffer += md_.ringbuffer_size3i_(2);

  return md_.ringbuffer_size3i_(0) * md_.ringbuffer_size3i_(1) * z_buffer + md_.ringbuffer_size3i_(0) * y_buffer + x_buffer;
}

I want to understand the working of this function, how you convert a 3D to 1D, and what's the intuition.

@bigsuperZZZX
Copy link
Member

You could refer to this paper for more details:
"Real-Time Trajectory Replanning for MAVs using Uniform B-splines and a 3D Circular Buffer".

@shubham-shahh
Copy link
Author

thanks, @bigsuperZZZX, I'll look into it. Ill close this issue for now

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

2 participants