# navfn ros priority blocks

As code shows below, i do not understand the const 'INVSQRT2' and the variable 'curT',what do they play roles in code,how can i understand them

#define INVSQRT2 0.707106781

  float le = INVSQRT2*(float)costarr[n-1];
float re = INVSQRT2*(float)costarr[n+1];
float ue = INVSQRT2*(float)costarr[n-nx];
float de = INVSQRT2*(float)costarr[n+nx];

if (pot < curT)   // low-cost buffer block
{
if (l > pot+le) {
push_next(n-1);
}
if (r > pot+re)
{
push_next(n+1);
}
if (u > pot+ue)
{

push_next(n-nx);
}
if (d > pot+de)
{
push_next(n+nx);
}
}
else
{
if (l > pot+le) {

push_over(n-1);
}
if (r > pot+re)
{
push_over(n+1);
}
if (u > pot+ue)
{

push_over(n-nx);
}
if (d > pot+de)
{

push_over(n+nx);
}
}

edit retag close merge delete

This is not really a question. Also, you are lacking a lot of context. What is this code, where is it from, what should it do and most importantly: Where do curT etc come from? This only appears once in this code. How do you think we should be able to get this?

( 2017-03-03 01:06:56 -0600 )edit

INVSQRT2, however, is "invert squareroot of 2", so 1/sqrt(2).

( 2017-03-03 01:07:29 -0600 )edit

( 2017-03-07 01:38:32 -0600 )edit

I know INVSQRT2=1/sqrt(2),but I do not know why costarr should multiply it

( 2017-03-07 01:43:52 -0600 )edit

alright, this sounds more like a question. Cannot help with that, though. Maybe check the details of Djikstra alogrithm? Note, you linked to the diamondback source. This is quite old. better always use the link to the Code Api on the ROS wiki...

( 2017-03-07 03:19:01 -0600 )edit

Alright,whatever,thanks

( 2017-03-07 03:25:28 -0600 )edit