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

Put the computation of the next informed search angle in proper place #10

Open
lukey11-zz opened this issue Jul 19, 2016 · 0 comments
Open

Comments

@lukey11-zz
Copy link
Contributor

Dear all,

We have the computation of the next informed search angle in the function of Searching.
else if(isInformed == true) {
size_t t = SearchTime++;
argos::Real twoPi = (argos::CRadians::TWO_PI).GetValue();
argos::Real pi = (argos::CRadians::PI).GetValue();
argos::Real isd = LoopFunctions->RateOfInformedSearchDecay;
argos::Real correlation = GetExponentialDecay((2.0 * twoPi) - LoopFunctions->UninformedSearchVariation.GetValue(), t, isd);
argos::Real rand = RNG->Gaussian(correlation + LoopFunctions->UninformedSearchVariation.GetValue());
argos::CRadians rotation(GetBound(rand, -pi, pi));
argos::CRadians angle1(rotation);
argos::CRadians angle2(GetHeading());
argos::CRadians turn_angle(angle2 + angle1);
argos::CVector2 turn_vector(SearchStepSize, turn_angle);
SetIsHeadingToNest(false);

            if(IsAtTarget()) {
                SetTarget(turn_vector + GetPosition());
            }

}
However, the target is updated only the condition "IsAtTarget()" is satisfied. So, I suggest to put the computation of the turning angle into this branch. This will eliminate the unnecessary computation when this condition is not satisfied. We should have
else if(isInformed == true) {

            SetIsHeadingToNest(false);

            if(IsAtTarget()) {
                                size_t          t           = SearchTime++;
                argos::Real     twoPi       = (argos::CRadians::TWO_PI).GetValue();
                argos::Real     pi          = (argos::CRadians::PI).GetValue();
                argos::Real     isd         = LoopFunctions->RateOfInformedSearchDecay;
                argos::Real     correlation = GetExponentialDecay((2.0 * twoPi) - LoopFunctions->UninformedSearchVariation.GetValue(), t, isd);
                argos::Real     rand = RNG->Gaussian(correlation + LoopFunctions->UninformedSearchVariation.GetValue());
                argos::CRadians rotation(GetBound(rand, -pi, pi));
                argos::CRadians angle1(rotation);
                argos::CRadians angle2(GetHeading());
                argos::CRadians turn_angle(angle2 + angle1);
                argos::CVector2 turn_vector(SearchStepSize, turn_angle);
                SetTarget(turn_vector + GetPosition());
            }

}

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

1 participant