Six crescent shaped legs

Dependencies:   mbed

SyncGroup.cpp

Committer:
sim642
Date:
2016-06-21
Revision:
47:4f418a4b0051
Parent:
18:1437610bea8b

File content as of revision 47:4f418a4b0051:

#include "SyncGroup.hpp"
#include "Math.hpp"

float SyncGroup::update(EncoderMotor *motor, float factor)
{
    factors[motor] = factor;
    return getMinimum(motor);
}

float SyncGroup::getMinimum(EncoderMotor *exclude)
{
    float factor = 1.f;
    for (std::map<EncoderMotor*, float>::iterator it = factors.begin(); it != factors.end(); ++it)
    {
        if (it->first != exclude)
            factor = ::min(factor, it->second);
    }
    return factor;
}