Square pattern turns

Hey guys,

I am a beginner of using mission planner. Basically, I want to fly from home to the point where I want to fly in square patterns three times within 60s and move on. I tried using loiter_turn within radius, but it only flues in a circle. I want to fly in a box shape centered on the point. I don’t know which command I should execute. Please help.

There is not a command to do that. You can easily plan an Auto Mission to do it with Waypoints.

1 Like

Using the command DO_SET_ROI will also keep the quad pointed to the centre of the box (or wherever you have the ROI set.) But as Dave said, you’ll need to plan the waypoints to create the box.

https://ardupilot.org/copter/docs/common-mavlink-mission-command-messages-mav_cmd.html#mav-cmd-do-set-roi

Once you have the box planned, the DO_JUMP command will allow you to repeat it.

https://ardupilot.org/copter/docs/common-mavlink-mission-command-messages-mav_cmd.html#mav-cmd-do-jump

2 Likes

Thanks @dkemxr for your response.

Thanks @Allister for your detailed response. Is there a way that I can use a polygon to do this?

Take a look at this: https://ardupilot.org/copter/docs/common-planning-a-mission-with-waypoints-and-events.html

1 Like

If you have the ROI coordinates, and you want it in the middle of the square, simply add/subtract half square side or half diagonal in degrees to get the waypoints coordinates for two simple squares (squares with side or diagonal north-south (no rotation)). Check here.

1 Like

However you want to do it this is easy to test in the Mission Planners Simulator. Polygon is typically used as a reference for a grid.

1 Like

I don’t think so. Just as easy to drop the waypoints and set the ROI.

Are you trying to import a KML file of a polygon? It’s not straight forward but it’s doable. How accurate do your waypoints need to be? Are we talking meters or centimetres?

The thing with Mission Planner (like a lot of Ardupilot) there’s often many different ways to achieve your goal.

1 Like

Hi Allister,

Thanks again for your answer. I am not trying to import anything. There is no given number, but we are talking about in terms of time limits. Here is what I have been trying to do.

1. Auto take off from home and proceed to your north 100 meters
2. Once you hit this point, fly a square box shape centered on the point. Fly the square pattern three times within 60 seconds.
3. Then proceed to your west and hover for 15 seconds and proceed home to the original location.

Thank you for your response @Webillo

Thank you for your response @Yaros.

That was quick and I just realized I missed an important step. But since I’m guessing this is for a class or competition I’ll let you fill in the gaps. :slight_smile:

2 Likes

Sorry about my late response @Allister. Yeah, It was for my class work. Thank you so much for your help and information.

While it seems good, try to simulate it in SITL. When I simulate with DO_JUMP’s as this mission (yours slightly modified):
QGC WPL 110
0 1 0 16 0 0 0 0 49.9993 -113 100 1
1 0 3 22 0 0 0 0 49.9997 -113 1.00 1
2 0 3 201 0 0 0 0 50 -113 1.00 1
3 0 10 16 0 0 0 0 50.0001 -112.9999 4.00 1
4 0 10 16 0 0 0 0 50.0001 -113.0001 1.00 1
5 0 10 16 0 0 0 0 49.9999 -113.0001 4.00 1
6 0 10 16 0 0 0 0 49.9999 -112.9999 1.00 1
7 0 0 177 3 3 0 0 0 0 0 1
8 0 0 177 3 2 0 0 0 0 0 1
9 0 10 21 0 0 0 0 49.9995 -113 0.00 1
the jump point is messed.
A workaround is a dummy jump point (delay):
QGC WPL 110
0 1 0 16 0 0 0 0 49.9993 -113 100 1
1 0 3 22 0 0 0 0 49.9997 -113 1.00 1
2 0 3 201 0 0 0 0 50 -113 1.00 1
3 0 0 93 0.001 0 0 0 0 0 0 1
4 0 10 16 0 0 0 0 50.0001 -112.9999 4.00 1
5 0 10 16 0 0 0 0 50.0001 -113.0001 1.00 1
6 0 10 16 0 0 0 0 49.9999 -113.0001 4.00 1
7 0 10 16 0 0 0 0 49.9999 -112.9999 1.00 1
8 0 0 177 3 3 0 0 0 0 0 1
9 0 0 177 3 2 0 0 0 0 0 1
10 0 10 21 0 0 0 0 49.9995 -113 0.00 1

This happens:


Up left: first mission (messed).
Up right: second mission.
Down: height on second mission (shows six squares). Both missions should do 4x3=12 squares, but on the second DO_JUMP the loop counter is messed.

Unless I miss something…

I can’t make heads or tails of the way you have the waypoints written out there in terms of what the DO_JUMP is doing. That doesn’t mean something’s wrong, I just don’t understand the format. :slight_smile:

I notice you’re using QGC, and I used Mission Planner for my example. They do handle somethings slightly differently so that might play into this. Not sure though.

Simply, read any .waypoints file with a text editor and compare. You can also copy&paste lines above into a .waypoints file, change spaces in tabs and it should work (if not, inspect it with a binary editor for any strange characters).

QGC or MP shouldn’t matter; for simulation they just observe. I first observed this in SITL, so for real life missions I have always inserted the dummy jump points. Referring to the double jump, I suppose there is a unique loop counter internally, so no solution (in real life it doesn’t work either).

Yeah, as soon as I read the words “text editor” I realized I probably shouldn’t be posting after a certain hour. :man_facepalming:

Anyhow…

QGC WPL 110
0	1	0	16	0	0	0	0	51.268789	-113.249816	931.210022	1
1	0	3	22	0.00000000	0.00000000	0.00000000	0.00000000	51.26896850	-113.24980860	25.000000	1
2	0	3	16	0.00000000	0.00000000	0.00000000	0.00000000	51.26914830	-113.24980080	25.000000	1
3	0	3	201	0.00000000	0.00000000	0.00000000	0.00000000	51.26998400	-113.24941460	25.000000	1
4	0	3	16	0.00000000	0.00000000	0.00000000	0.00000000	51.26960470	-113.24980080	25.000000	1
5	0	3	16	0.00000000	0.00000000	0.00000000	0.00000000	51.27042700	-113.24979010	25.000000	1
6	0	3	16	0.00000000	0.00000000	0.00000000	0.00000000	51.27043040	-113.24880840	25.000000	1
7	0	3	16	0.00000000	0.00000000	0.00000000	0.00000000	51.26959130	-113.24886740	25.000000	1
8	0	3	177	4.00000000	2.00000000	0.00000000	0.00000000	0.00000000	0.00000000	0.000000	1
9	0	3	16	0.00000000	0.00000000	0.00000000	0.00000000	51.26961150	-113.25073420	25.000000	1
10	0	3	20	0.00000000	0.00000000	0.00000000	0.00000000	0.00000000	0.00000000	0.000000	1

I just ran this mission in the simulator on Mission Planner. The DO_JUMP performed as expected. No extra commands required.

One thing I’ve noticed with DO_SET_ROI, is that if it’s repeated in the jump the projected flight path (yellow lines) on the planner will show it like it’s a waypoint, but when you fly it or run the SITL it doesn’t actually fly there. In the example I just created I put the ROI command before the looped section of waypoint and that didn’t happen.

I’m not sure why you are needing the dummy jump point. I’ve never run into that on Plane or Copter. Try the mission I posted here in MP if you can and see what happens.

Sure? I suppose you want to run this square several times, with ROI moreless at its center:


but in MP result triangles. See this video. In QGC the same happens (both are observers).

It is spanish, but the waypoints heard are:
3,4,5,6,4,5,6,4,5,6,8,9

Capture your simulation and let me see it.

Yes, that’s what the OP was looking to do and that’s what my mission plan does.

Here’s the video. This was with the same waypoint file I posted above.

The DO_JUMP to waypoint 4 on yours is correct. But for some reason your WP4 and my WP4 are different. In my file WP4 is the lower left corner of the box, so that’s why it’s not cutting the corner. Your WP4 is the upper left corner, so it is making the triangle to go from lower right to upper left.

When you re-order or delete/add commands & waypoints DO_JUMP commands do not change. You need to manually adjust them. So if you added any command to the mission before the DO_JUMP that will screw up the flow.