I'm not sure I understand the question. It is not clear to me what the title (summing radians) has to do with finding the smallest angle (which is what you're showing in your code). I also don't understand what benchmark for angles you are referring to - and there's nothing of the sorts in ARGoS.
What I think I understood is that you'd like to have the vector (distance, angle) to the closest obstacle when using the proximity sensor. I will reply according to this hypothesis, let me know if this is off the mark.
If that is the case, you first need to know that the proximity sensors return readings from 0 to 1. 0 means no obstacle, while 1 means that the obstacle is touching the sensor. The values drop superlinearly from 1 to 0 according to the distance from the sensor to the obstacle. For example, in the
generic proximity sensors is formula is exp(-distance). In the
foot-bot proximity sensor the formula is (A / (distance + B)), with values of A and B fitted from real data.
The second thing you need to know is how the proximity sensors are distributed on the robot body. In the foot-bot and the e-puck, for example, the proximity sensors are distributed equally in a ring around the body of the robot. The angle corresponding to 0 radians points along the local x axis of the robot; the local x axis is the forward direction of the robot (i.e., its "nose").
Thus, if you want the vector (distance, angle) to the closest obstacle, you need to find the proximity sensor with the highest (not lowest!) reading, and take the angle of the corresponding sensor. Assuming you're using the foot-bot, the code to achieve this is as follows:
Code: Select all
// this is not code you need to write, it's just to show how I call the sensor in the rest of the code
CCI_FootBotProximitySensor* m_pcProximity;
// this is where the actual code starts
const CCI_FootBotProximitySensor::TReadings& tProxReads = m_pcProximity->GetReadings();
size_t unClosest = 0;
for(size_t i = 1; i < tProxReads.size(); ++i) {
if(tProxReads[unClosest].Value < tProxReads[i].Value) {
unClosest = i;
}
}
// this is the vector to the closest obstacle
CVector2 cToClosest(tProxReads[unClosest].Value, tProxReads[unClosest].Angle);
I made ARGoS.