hello everyone!
I am using the position sensor with the footbot. I am rotating the footbot and when it gets to the desired rotation angle it will trigger and go foward. To get the angle of the rotation using:
m_cAlpha = m_pcPosSens->GetReading().Orientation;
Using this line gives me a Quaternion as an output. This gives me (angle,0,0), from here I just want to get the angle so I can use the angle which the footbot is rotating at a particular moment, the angle I get from the quaternion is nice, because half the rotation is positive and the other half is negative going from 0 to 180 and -180 to 0, but I don't know how to get just the angle from the Quaternion (first integer of the group of numbers) so I use:
m_cAlpha.GetW()
This gives me a number between 0 to 1. The problem is with the rotation sign, first whole rotation is positive from 0 to 1 and 1 to 0 and then, second whole rotation changes to negative same 0 to -1 and -1 to 0 making it really difficult to select a fix value, since it always will have a second identical value in the opposite site of the rotation that the footbot is orientated.
I have tried everything, using:
m_cAlpha.SetX()
m_cAlpha.SetY()
to change the sign on the rotation but nothing seem to give me the desired result. One of my issues is my poor understanding of quaternions, but I have read a lot about them and still can not figure it out. It will be really helpful if someone can give me some advise. Let me know if something is not clear I will try and explain myself better.
I have attach the files so it is visible in the Log.
rot = to the Quaterion so it give (angle,0,0)
rot1 = to the m_cAlpha.GetW()
After a few rotation is possible to see that rot1 changes the sign after a whole rotation. I hope this makes thing more clear.
For some reason it does not let me attach the XML file. I used the diffusion_1.argos just adding in the sensors section the position sensor of the footbot:
<positioning implementation="default" />
Thanks for your time,
Leonardo.