two wheels joined three Distance joints works UNSTABLE!

there is testbed code:
[code]
class MySimpleTest : public Test
{
public:
MySimpleTest()
{
// ground
b2BodyDef groundDef;
groundDef.type = b2_staticBody;
groundDef.position = b2Vec2(0.0f, 0.0f);
b2Body* groundBody = m_world->CreateBody(&groundDef);
b2PolygonShape groundShap;
groundShap.SetAsBox(100.0f, 2.0f);
groundBody->CreateFixture(&groundShap, 0.0f);

groundDef.position = b2Vec2(-99.0f, 20.0f);
groundShap.SetAsBox(1.0f, 18.0f);
b2Body* breakBodyLeft = m_world->CreateBody(&groundDef);
breakBodyLeft->CreateFixture(&groundShap, 0.0f);

groundDef.position = b2Vec2(99.0f, 20.0f);
groundShap.SetAsBox(1.0f, 18.0f);
b2Body* breakBodyRight = m_world->CreateBody(&groundDef);
breakBodyRight->CreateFixture(&groundShap, 0.0f);

// slope
groundDef.position.Set(0.0f, 20.0f);
groundDef.angle = -0.3f;
groundShap.SetAsBox(20.0f,0.2f);
b2Body* slope = m_world->CreateBody(&groundDef);
slope->CreateFixture(&groundShap, 0.0f);



// wheel
b2BodyDef wheelDef;
wheelDef.type = b2_dynamicBody;
wheelDef.position = b2Vec2(-5.0f, 32.0f);
b2CircleShape wheelShap;
wheelShap.m_p.SetZero();
wheelShap.m_radius = 3.0f;
b2FixtureDef wheelFixture;
wheelFixture.shape = &wheelShap;
wheelFixture.density = 3.0f;
wheelFixture.friction = 5.5f;
wheelFixture.restitution = 0.3f;
b2Body* wheelBody1 = m_world->CreateBody(&wheelDef);
wheelBody1->CreateFixture(&wheelFixture);
wheelDef.position.x += 10.0f;
b2Body* wheelBody2 = m_world->CreateBody(&wheelDef);
wheelBody2->CreateFixture(&wheelFixture);

// join the two wheels
b2DistanceJointDef wjion;
wjion.Initialize(wheelBody1, wheelBody2, wheelBody1->GetPosition(), wheelBody2->GetPosition());
m_world->CreateJoint(&wjion);
wjion.Initialize(wheelBody1, wheelBody2, wheelBody1->GetPosition()+b2Vec2(0, 1), wheelBody2->GetPosition()+b2Vec2(0, 1));
m_world->CreateJoint(&wjion);
wjion.Initialize(wheelBody1, wheelBody2, wheelBody1->GetPosition()+b2Vec2(1, 0), wheelBody2->GetPosition()+b2Vec2(1, 0));
m_world->CreateJoint(&wjion);

/*
// box
b2BodyDef boxDef;
boxDef.type = b2_dynamicBody;
boxDef.position = b2Vec2(0.0f, 25.0f);
b2PolygonShape boxShap;
boxShap.SetAsBox(5,5);
b2FixtureDef boxFixture;
boxFixture.shape = &boxShap;
boxFixture.density = 2.0f;
boxFixture.friction = 2.5f;
boxFixture.restitution = 0.01f;
b2Body* boxBody = m_world->CreateBody(&boxDef);
boxBody->CreateFixture(&boxFixture);
*/

//wheelBody2->ApplyAngularImpulse(-2000.0f);

}


static Test* Create() {
return new MySimpleTest();
}

};
[code]
The third distance joint is redundant and causes internal tension to build up due to small inaccuracies. You can relax the system by using soft distance joints for the 2nd and 3rd joint.

Code:
b2DistanceJointDef wjion;
wjion.bodyA = wheelBody1;
wjion.bodyB = wheelBody2;
wjion.length = 10.0f;

wjion.localAnchorA.SetZero();
wjion.localAnchorB.SetZero();
m_world->CreateJoint(&wjion);

wjion.frequencyHz = 10.0f;
wjion.dampingRatio = 0.8f;

wjion.localAnchorA.Set(0.0f, 1.0f);
wjion.localAnchorB.Set(0.0f, 1.0f);
m_world->CreateJoint(&wjion);

wjion.localAnchorA.Set(1.0f, 0.0f);
wjion.localAnchorB.Set(1.0f, 0.0f);
m_world->CreateJoint(&wjion);

Original thread: https://box2d.org/forum/viewtopic.php?t=7630