How to sum Radians?

Requests regarding how to set up experiments in ARGoS.
lomak
Posts: 11
Joined: Tue Jun 15, 2021 2:14 pm

How to sum Radians?

Postby lomak » Wed Jun 23, 2021 7:57 pm

Hello,
Please what is the command to make the sum of radians?

pincy
Site Admin
Posts: 632
Joined: Thu Mar 08, 2012 8:04 pm
Location: Boston, MA
Contact:

Re: How to sum Radians?

Postby pincy » Wed Jun 23, 2021 8:04 pm

You simply use the + operator.
I made ARGoS.

lomak
Posts: 11
Joined: Tue Jun 15, 2021 2:14 pm

Re: How to sum Radians?

Postby lomak » Fri Jun 25, 2021 2:08 pm

I don't quite understand the definition of angles on Argos. Is there a benchmark predefined by Argos? Are the front sensors prioritized for direction change over other sensors?

pincy
Site Admin
Posts: 632
Joined: Thu Mar 08, 2012 8:04 pm
Location: Boston, MA
Contact:

Re: How to sum Radians?

Postby pincy » Fri Jun 25, 2021 5:15 pm

I'm sorry but I don't understand the question. Can you provide a specific example of what you're trying to achieve?
I made ARGoS.

lomak
Posts: 11
Joined: Tue Jun 15, 2021 2:14 pm

Re: How to sum Radians?

Postby lomak » Sat Jun 26, 2021 5:21 pm

I want to :
Recover the minimum distance from the obstacle
Retrieve the minimum angle (at neighbor 0)

Code: Select all

for(size_t i = 0; i < tProxReads.size(); ++i) { if (tProxReads[i].Value < valeurMinimale ){ valeurMinimale = tProxReads[i].Value; angleMinimale= tProxReads[i].Angle; } /*if ( tProxReads[i].Angle < angleMinimale ){ angleMinimale= tProxReads[i].Angle; }*/ }
Briefly, I wanted to replace the average of the accumulated distances and angles by the minimum distance and the minimum angle. But I come up against the problem of angles.
Hence my questions, I don't quite understand the definition of angles on Argos. Is there a benchmark predefined by Argos? Are the front sensors prioritized for direction change over other sensors?

pincy
Site Admin
Posts: 632
Joined: Thu Mar 08, 2012 8:04 pm
Location: Boston, MA
Contact:

Re: How to sum Radians?

Postby pincy » Sat Jun 26, 2021 6:32 pm

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.

lomak
Posts: 11
Joined: Tue Jun 15, 2021 2:14 pm

Re: How to sum Radians?

Postby lomak » Tue Jun 29, 2021 2:37 pm

Thanks


Return to “How to... ?”