Skip to content

Conversation

@peterbarker
Copy link
Contributor

Just takes off and does 1 circle. Doesn't actually explicitly test anything yet.

For some values of "1 circle". If we round up (so to speak).

image

@peterbarker
Copy link
Contributor Author

I guess this is actually correct, it's just the tangential entrance to the circle makes it look strange.

@peterbarker
Copy link
Contributor Author

I guess this is actually correct, it's just the tangential entrance to the circle makes it look strange.

There's no tangential entrance to these circles, doofus.

I've added a couple of patches which make things a little better:

image

@peterbarker
Copy link
Contributor Author

I discussed the lack of closure here with Leonard. He suggests not to worry about this at this point as the new circular-waypoint code should fix this (it uses different maths to work out how far you have progressed).

I did have an idea we could update how far we've been based on actual trig at 10Hz - but seems overkill if Leonard's going to fix things anyway.

(the basic problem is that we're integrating an angular velocity and it doesn't work particularly well!)

@rmackay9
Copy link
Contributor

I'll give this a test, thanks!

@rmackay9
Copy link
Contributor

rmackay9 commented Oct 28, 2025

Thanks very much for finding this bug. It seems this doesn't completely resolve the bugs though because a mission like below, where the edge of the circle is within 3m horizontally from the vehicle leads to the vehicle not climbing to the desired altitude. In master, it does climb to the correct altitude but of course, it also behaves badly at the start of the circle

image

Two possible solutions:

  1. simply remove the use of dist_to_edge_m and always fly to the edge of the circle
  2. modify AC_Circle::get_closest_point_on_circle_NEU_m so that it actually returns the 3D distance to the edge of the circle instead of the circle center

@peterbarker
Copy link
Contributor Author

Thanks very much for finding this bug. It seems this doesn't completely resolve the bugs though because a mission like below, where the edge of the circle is within 3m horizontally from the vehicle leads to the vehicle not climbing to the desired altitude. In master, it does climb to the correct altitude but of course, it also behaves badly at the start of the circle

I've added a patch to address this - and another example test which starts the Copter off on the circumference of the loiter circle. It climbs to the circle height as wp navigation and then starts to circle.

2. modify AC_Circle::get_closest_point_on_circle_NEU_m so that it actually returns the 3D distance to the edge of the circle instead of the circle center

Well... it happens to return you the point on the circle - so I just took the length :-)

@peterbarker peterbarker force-pushed the pr/circle-test branch 2 times, most recently from f05f7a1 to dc598d1 Compare October 29, 2025 00:52
we use this result when projecting in 2D later on
…ter'

This should give more predictable movement for a vehicle told to circle on exactly where it is - we will more-often choose to reverse backwards ono the circle rather than projecting the vehicle's vector-to-center back onto the circumference
If the vehicle's stopping point is (1, 0, 0) and the center is at (0, 0, 0) then (stopping_point - center) is (1, 0, 0) - but the vector *to* the center *from*  the stopping point is clearly (-1, 0, 0).

So rename the variable to invert it.  Saves changing the maths
@peterbarker
Copy link
Contributor Author

Now closes #13161 because of the added epsilon!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

Development

Successfully merging this pull request may close these issues.

4 participants