Skip to content

Probable assimetry in angle errors? #8

@FelipeCoimbra

Description

@FelipeCoimbra

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?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions