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

Probable assimetry in angle errors? #8

Open
FelipeCoimbra opened this issue Jun 1, 2018 · 1 comment
Open

Probable assimetry in angle errors? #8

FelipeCoimbra opened this issue Jun 1, 2018 · 1 comment

Comments

@FelipeCoimbra
Copy link

As far as I've been reading source code (visualsenderplayer.h/.cpp and bodysender.h/.cpp to be more precise) regarding noise generation on angle information received by players it seems there are some differences in angle quantization.

When sending visual information, any angles are first rounded to the nearest integer and then truncated to int. This seems to be some correction from V7 version of the visualsender as some comments describe it

/*!
//===================================================================
//
//  CLASS: VisualSensorPlayerV7
//
//  DESC: Class for the version 7 visual protocol.  This version
//        fixed a bug in the generation of directions in that they
//        were truncated to int, rather than rounded.  This meant
//        error in the direction pointed was at most times between
//        -0.5 and +0.5 degrees, but occationally between -1.0 and
//        +1.0 degrees and at other times exact.  With the new method
//        of rounding, the error is always between -0.5 and +0.5.
//
//===================================================================
*/

This makes sense as simply truncating would give a -0.9 difference if the actual angle was 1.9 and a +0.9 difference if actual angle was -1.9 for example. Rounding garantee 0.5 absolute difference in any situation.

However, SenseBody gives information about neck angles and velocity directions and there seems to be no rounding of this info before truncating.

On bodysender.cpp:

void
BodySenderPlayerV5::sendNeck()
{
    int ang = Rad2IDeg( self().angleNeckCommitted() );
    serializer().serializeNeckAngle( transport(),
                                     ang );
}

void
BodySenderPlayerV6::sendVelocity()
{
    double mag = Quantize( self().vel().r(), 0.01 );
    int head =  Rad2IDeg( normalize_angle
                          ( self().vel().th()
                            - self().angleBodyCommitted()
                            - self().angleNeckCommitted() ) );
    serializer().serializeBodyVelocity( transport(), mag, head );
}

On utility.h:

inline
int
Rad2IDeg( const double & a )
{
    return static_cast< int >( a * RAD2DEG );
}

Is there any reason for this or is it a bug?

@hidehisaakiyama
Copy link
Member

It may have been discussed in the past. But, I don't know that.
In my opinion, this would be a potential bug.
If we like to fix this, it is necessary to update the protocol version after some discussions in the community.

wbwatkinson pushed a commit to wbwatkinson/rcssserver that referenced this issue Jun 20, 2020
Add ball y parameters for HFORef::resetField()
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