aldebaran/naoqi_navigation_samples

About calculation method of accuracy that can be taken with relocalizeInMapAPI

Closed this issue · 8 comments

Hi!

I have one question about relocalizeInMapAPI.
relocalizeInmapAPI returned [x, y, theta][x’, y', theta'] for me.

How do you calculate the size of an ellipse from the values ​​of these two lists?
I think this one.

        accracyposition = self.nav.relocalizeInMap([float(target[0]), float(target[1]), 0.0])[1]
        accracy_A = accracyposition[0]
        accracy_B = accracyposition[1]
        Radius_A = float(accracy_A[0])*float(accracy_A[0]) + float(accracy_A[1])*float(accracy_A[1])
        Radius_A = math.sqrt(float(Radius_A))
        Radius_B = float(accracy_B[0])*float(accracy_B[0]) + float(accracy_B[1])*float(accracy_B[1])
        Radius_B = math.sqrt(float(Radius_B))
        Ellipse_area = m.PI * float(Radius_A) * float(Radius_B)
        Sector_area = float(Ellipse_area) * math.fabs((float(accracy_A[2]) - float(accracy_B[2])) / 360)

Is this 「Sector_area」Pepper's accracy value ?

Hello,

The {x', y', theta'} define an ellipse to express the confidence of the localization. see this
x' and y' represent the maximum distance between the actual robot localization and the computed localization along the x and y axis.
theta' is the maximum orientation difference between actual robot orientation and the computed one.

Why do you want to compute the actual ellipse area?

Instead you can use them directly to consider a relocalization as failing if one of the values is above a specific threshold.
1m for x' and y' and PI/2 for theta' seem to be a reasonable choice to start with.

Hello,
Thank you for telling me.
I was mistaken about relocalizationAPI's return value.
I thought that pepper exists in elipse area.

I have understood about relocalizationAPI's return value.
I will fix SLAM app I will check [x' ,y', theta'] with different paramaters.

Hello,
I make "lost child Pepper"'s script!!
I'd like you to check out my script.
this script's mean is
「An abnormal value is detected by x or y or theta, and if any one of the three is abnormal, it counts up.
When the counted value exceeds 10, the process is ended.」
*「self.onContinue」is loop function.
*「self.onEnd」is finish.

  • init→self.Abnormal_value=0
    init→self.nav = self.session.service("ALNavigation")

    def onInput_onStart(self):
        import collections
        import almath
        Currentpoint_Coordinate=list()
        
        self.nav.startLocalization()
        Currentpoint_Coordinate = self.nav.getRobotPositionInMap()[0]
        self.logger.warning(str(Currentpoint_Coordinate))
        accracyposition = self.nav.relocalizeInMap(Currentpoint_Coordinate)[1]
        accracy = accracyposition[1]
        Param_x = accracy[0]
        Param_y = accracy[1]
        Param_theta = accracy[2]
        self.logger.warning("~~~~~~Param_x::"+str(Param_x)+",Param_y::"+str(Param_y)+",Param_theta::"+str(Param_theta)+"~~~~~~~~")
        if float(Param_x) > float(10):
            self.Abnormal_value=self.Abnormal_value+1
            self.logger.info("x座標が異常です=The x coordinate is abnormal")
        else:            
            if float(Param_y) > float(10):
                self.Abnormal_value=self.Abnormal_value+1
                self.logger.info("y座標が異常です=The y coordinate is abnormal")
            else:
                if float(Param_theta) > float(30):
                    self.Abnormal_value=self.Abnormal_value+1
                    self.logger.info("角度が異常です=The theta coordinate is abnormal")
                else:
                    self.Abnormal_value=0
            
        self.logger.info("異常値::"+str(self.Abnormal_value))
        if int(self.Abnormal_value) < int(10):
            self.onContinue()
        else:
            self.onEnd()

This scripts looks right, a few comments though:

  • You do not need to use relocalizeInMap here, has it should make the robot perform a full turn to correctly localize
  • you can retrieve robot_localization et accuracy in one ALNavigation code, this will prevent racy effect of computing a new localization and ellipse and processing an old localization.
localization_and_ellipse = self.nav.getRobotPositionInMap()
Currentpoint_Coordinate = localization_and_ellipse[0]
accracyposition = localization_and_ellipse[1]
  • Maybe you should lower the x/y threshold to something around 2m.
  • What is the frequency update of the loop function?
    If it is too high, the localization may not have enough time to be updated, and the resulting error will not be filtered. If it is too low, it will take more time to detect a "wrong localization".
  • param_theta is returned by getRobotPositionInMap in radians so you should either change your theta threshold to 0.52 or convert the returned theta in degrees with Param_theta * almath.TO_DEG
  • You can tune the performance of this by tuning the X/Y/Theta threshold to detect more or less abnormal cases and the abnormal_value threshold to stop more or less quickly

But more importantly, does it work?
Hope it helps, let me know how it works for you,

Lucas

Thank you for watching the script.

I was misunderstanding.
I thought that accuracy of Pepper's position can be obtained only with relocalizeInMapAPI, but that was not the case.

→What is the frequency update of the loop function?
I will set "frequency update of the loop function" at 1 second intervals.

→Hope it helps, let me know how it works for you,
I'd like to detect that Pepper himself got lost when I was launching the SLAM application.
If you know that you get lost by Pepper yourself, you may be able to tell the fact that you got lost, for example by stopping the guidance or doing localization, or by sending an http request to the person in charge thinking about.
By doing this you may not need to keep watching Pepper all the time.

Ken

Hello.
I have one more question.

→Maybe you should lower the x/y threshold to something around 2m.
The reason you answered "Because the reason why you do not take x and y separately as parameters is ellipse, so they do not make much sense separately"?

Ken

I am not sure I understand your question but what I can tell is:
x' and y' define an ellipse so they should be considered separately. However they both represent a distance, hence they should be checked against the same threshold.
So I believe you can use one x/y threshold and check it against x and y separately.

I'm sorry. I mistaked about "x/y".

I thought that "x/y" means x ,y division.
But, thanks to your answer I was able to understand this problem.

Thank you!!