kas-lab / suave

An Exemplar for Self-Adaptive Underwater Vehicles performing pipeline inspection
https://kas-lab.github.io/suave/
Apache License 2.0
27 stars 9 forks source link

change in spiral_points function #27

Closed Rezenders closed 1 year ago

Rezenders commented 1 year ago

I was checking the spiral point function and I noticed that spiral width actually increases over time and it doesn't correspond to the spiral width parameter

Example:

resolution = 0.1
spiral_width = 1

i=1
x1 = np.cos(1*0.1)*1*0.1*1 = 0.09950041652780259

i=63 (approximately one complete turn)
x2 = np.cos(63*0.1)*1*0.1*63 = 6.299109409215515

So I propose this change:

x = np.cos(step_idx) * (spiral_width/(2*math.pi)) * step_idx
y = np.sin(step_idx) * (spiral_width/(2*math.pi)) * step_idx

i=63
x2 = np.cos(63*0.1)*(1/(2*math.pi))*0.1*63 = 1.002534399553318

Now the difference between x1 and x2 correspond to the spiral width. Maybe you were aiming for something different when you designed it, so let me know.

jeroenzwan commented 1 year ago

I was checking the spiral point function and I noticed that spiral width actually increases over time and it doesn't correspond to the spiral width parameter

Example:

resolution = 0.1
spiral_width = 1

i=1
x1 = np.cos(1*0.1)*1*0.1*1 = 0.09950041652780259

i=63 (approximately one complete turn)
x2 = np.cos(63*0.1)*1*0.1*63 = 6.299109409215515

So I propose this change:

x = np.cos(step_idx) * (spiral_width/(2*math.pi)) * step_idx
y = np.sin(step_idx) * (spiral_width/(2*math.pi)) * step_idx

i=63
x2 = np.cos(63*0.1)*(1/(2*math.pi))*0.1*63 = 1.002534399553318

Now the difference between x1 and x2 correspond to the spiral width. Maybe you were aiming for something different when you designed it, so let me know.

I see, yes that would be more accurate. I just designed spiral_width to be the variable that adjusts the width with which the UUV is spiraling, not considering that it had to be the actual spiral width value. So I am fine with these changes :).