Move foot bot to coordinates
Posted: Mon Oct 31, 2016 12:36 am
Dears,
This sounds very naive and trivial, but, im honestly having trouble making a footbot move along a vector, in other words, i have the robot location based on
and i want to move it towards a specific point
so i basically calculate the displacement vector via
and use the SetWheelSpeedFromVector and pass the diff vector to it (from the foraging example)
however, this only resulted that the robots are rotating around their z-axis and nothing is happening.
so i thought that i should be adding this diff vector to the current location could work, and couple of robots actually moved towards the target, others went in other ways.
this made me think of angles and signs, so i used the following
still the same thing, few robots move towards the target and rest in another direction.
so my question is, how can i make them all move towards a specific location?
This sounds very naive and trivial, but, im honestly having trouble making a footbot move along a vector, in other words, i have the robot location based on
Code: Select all
CVector3 position = m_pcPositioningS->GetReading().Position;
Code: Select all
CVector2 target(12,8);
Code: Select all
CVector2 diff (target - position)
Code: Select all
SetWheelSpeedsFromVector(diff)
so i thought that i should be adding this diff vector to the current location could work, and couple of robots actually moved towards the target, others went in other ways.
Code: Select all
SetWheelSpeedsFromVector(diff + position);
Code: Select all
CQuaternion q = m_pcPositioningS->GetReading().Orientation;
CRadians cZAngle, cYAngle, cXAngle;
q.ToEulerAngles(cZAngle, cYAngle, cXAngle);
Real newX = position.GetX() + diff.GetX() * cos(cZAngle);
Real newY = position.GetY() + diff.GetY() * sin(CZAngle);
SetWheelSpeedsFromVector(CVector2(newX, newY);
so my question is, how can i make them all move towards a specific location?