Note that there are some explanatory texts on larger screens.

plurals
  1. POQuadrotor Target-Tracking Flight Pattern
    primarykey
    data
    text
    <p>I'm programming a quadrotor helicopter drone to chase a moving ground target automatically using image processing. The hardware I'm working with is pretty limited, so in order to make my automatic commands account for the drone's velocity (it doesn't know when it's moving) I have to manually track my target's relative position over time (which can be roughly translated into the drone's movement).</p> <p>So here's what I have in that regard:</p> <pre><code>int lastX = Targets_Last_Position_Xcoord(); int lastY = Targets_Last_Position_Ycoord(); int nowX = Targets_Current_Position_Xcoord(); int nowY = Targets_Current_Position_Ycoord(); int speedModX = (float)(60 - (abs(lastX)-abs(nowX))) / 60.0f; // Image dimension is 120 int speedModY = (float)(73 - (abs(lastY)-abs(nowY))) / 73.0f; // Other dimension is 146 changePitch(((nowX - 60)/60.0f)*(1 + speedModX)); changeRoll(((nowY - 73)/73.0f)*(1 + speedModY)); </code></pre> <p>The function "changePitch" and the others like it cause the next command sent to the drone to include a Pitch change of the specified percentage of the preset maximum tilt. So, I'm telling the drone to tilt an amount directly related to the target's distance from the center of the screen; then I'm throwing in a multiplier based on where the target moved (the distance between the target's last spot and its current spot).</p> <p>This is my intention anyways; this code only seems to be helping a little bit, and other factors such as air flow and mechanical imbalance (it isn't the most high-quality equipment out there) may be interfering, leaving me to simply see what I want to see.</p> <p>Is the method I'm using to account for the drone's velocity correct, and/or is there a better way to handle this?</p> <p>EDIT: calculation of speedModX and speedModY was changed, previous form had unwanted results under some circumstances. New formula correctly creates a modifier based on the difference between the target's previous distance from the origin and the target's current distance from the origin.</p>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload