# acounting for curves in robot navigation

I was looking continuing to mess around with robot GPS Ideas most of the ideas I have seen executed involved assuming that all robot movements are made up of small straight lines, which is false, and will lead to error, even if there is no wheel slip, or sensor drift, to me this was unacceptable, so I tried looking for ways to integrate the curves into my calculations, I found one way using some law of cosines, and then comparing the distance between the wheels, and the difference in their sensor reading, this was bulky, and eventually gave a bunch of divide by zeros in the code and I could never get it working, however, while I was messing around with numbers, I stumbled on something that I had never known before, if you draw a secant line across any arc, the length of that line is proportional to the distance of that arc and the angle of the circle that the arc take up, and this is true, regardless of the diameter of the circle, what this means is that I can take the length of the arc(this would be my encoder values) and the angle of the arc (this would be the change in gyro value from the beginning of the measurement period to the end) and find out a straight line distance my robot moves

however this has one problem:

I write the equation like this
Secant = Arc Distance * P
P is the proportion between the arc distance and the secant distance, and the Value P is determined by the angle of the arc, and it doesn’t change with diameter of the circle
at the bottom you will find a spread sheet giving every value of P for every angle, my problem is I cannot find the equation relating P and the angle, I could create a lookup table, but I would rather express it as an equation
I tried using things like quadratic regression to find it but could never get a match (you can see it’s not a parabola, but I tried other such as cubic regression as well)

If any one could give me the equation for this that would be fantastic, or if they could tell me the type of equation that would be great too.

I don’t think I understand. Isn’t the equation relating p and the angle right there in your spreadsheet? That is, didn’t you calculate P for each angle using an equation?

the idea is that I can multiply any arc by P and get the length of the secant line, so long as I know the angle for the arc and the P value that corresponds to the angle.

however, the P value there is calculated for

ohhh

wait a second, that was really obvious, oh gosh, ok thanks for that

in typing this out I just realized how dumb my question was

what I was about to say is P value in the spread sheet is calculated by comparing the arc calculated for that angle using a specific diameter, and the line of the triangle for a specific diameter, but if P is constant regardless of diameter, than I can calculate P for any random diameter and use those values for any diameter

not sure if what I typed made any sense, but your response helped me answer my own question, I was WAYYYY overthinking this

Haha No problem In general P will be 2*sin(theta/2)/theta. But I would suggest checking this for yourself rather than trusting me :).

Read the items in this post. They do account for it being a curve in Affine transformations. Luckily you are most likely dealing with a 2D rigid body that the radius of the turn is fixed.

https://vexforum.com/showpost.php?p=388233&postcount=9

Specifically this one. Look at section 5.2 the picture shows the rotation as a curve. Once you get rid of that, the rest is translation.

http://people.cs.clemson.edu/~dhouse/courses/401/notes/affines-matrices.pdf

could someone explain the concept of robot GPS,
I think i may have a way of how i will accomplish it

If you know where you are on the field, you should be able to know how hard you have to throw the ball to get it into the target no matter where you are. Adjusting launch angle or force of throw automatically is really cool.

If you only have one red ball in your loader, you really want it to go into the net vs wasting all those points.

I checked it, it should be Sin(theta/2)/(PI*(theta/360))

My simulation uses something like that, but the difference is tiny, especially when you are simulating it dozens of times per second
ill make an animation to show the difference

well your simulation was fantastic, so this must mean I’m on the right track