Trajectory Controller

Trajectory Controller

A while ago, we reviewed how a hover controller works, in this post we are going to discuss how to go a bit further and create a trajectory controller.

In that previous blog post we discussed about how to control a drone to make it hold a specified position. This refers to the part of Control in the GNC argo. This refers to the manipulation of the forces, by way of steering controls, thrusters, etc., needed to track guidance commands while maintaining vehicle stability.

In this part we are focused on the Guidance. This refers to the determination of the desired path of travel (the “trajectory”) from the vehicle’s current location to a designated the target, as well as desired changes in velocity, rotation and acceleration for following that path.

There is several steps before we can achieve this. Mainly the next ones:

  1. Fly the vehicle using the flight stack
  2. Design a controller that will track/hold a specified position
  3. Create a trajectory, based on time and other factors

For the first part, in this blog we will use Altax Flight Stack, that compromises a companion computer and a flight controller. In this particular case I’m using a naze32 as flight controller, and two companion computers: Raspberry Pi 2 and oDroid U3.

The naze32 is connected to the Odroid U3 via a usb cable (a very short one). The vehicle is a 330mm rotor to rotor fiber glass frame, with 7×3.8in propellers, 1130kv motors, 15amps ESCs and a 3000mah 10C battery. It will fly for 11-13 minutes.

The Odroid U3 is running Ubuntu 14.04.1 in a eMMC module, which makes it boot and run generally faster. Its being powered by a BEC that is connected to the main battery.

The companion computer will “talk” a special language in order to send commands to the vehicle, this one is described here. And the most important part is that it will run the DronePilot framework. This framework is the that will pilot the vehicle.

For the second part (position controller), you can refer to this page to see how it works.

And now the trajectory part…

We need to generate certain X and Y coordinates that then it will be “fed” to the position controller at a specific time. We are going to create two types of trajectories, circle and a infinity symbol. Why this ones? because this ones are easy to generate and perfect to excite all the multi-rotor modes.

How to generate a circle trajectory??

circle

This one is very simple… there is basically two parameters needed… Radius and angle. In our case the angle part we are going to combine it with the step time of the main loop of the controller and pi… basically the angle one will go from 0 to 360 degrees (in radians of course). The code looks like this:

circle

So, if we declare “w” like this: (2*pi)/12 it means that the trajectory will take 12 seconds to complete a full revolution, and then start over. This is the parameter that we will change if we want the vehicle to travel faster. Its better to start with a slow value, and then progress to faster trajectories.

The next step is to “fed” this coordinates to the position controller inside the control loop. That is done in this script.

The infinity trajectory is a special one! this one is called in several ways: Inifity trajectory, figure of eight… And there is several ways of how to calculate the coordinates, you can see in the next gif the posibilites of how to create a figure of eight:

infinity

The one I like the red dot one! why is this?? that one is called the Lemniscate of Bernoulli, which is constructed as a plane curve defined from two given points F1 and F2, known as foci, at distance 2a from each other as the locus of points P so that PF1·PF2 = a2.

600px-Lemniscate_of_Bernoulli_props.svg

This lemniscate was first described in 1694 by Jakob Bernoulli as a modification of an ellipse, which is the locus of points for which the sum of the distances to each of two fixed focal points is a constant. We can calculate it as a parametric equation:

infinity

And then the rest is feeding that information to the position controller which will try to follow that trajectory as the dots on the plots. Magic.

fastest

 

The cool video can be seeing here:

25 thoughts on “Trajectory Controller

  1. With your post, your readers, particularly those beginners who are trying to explore this field won’t leave your page empty-handed. Here is mine at Seoranko I am sure you’ll gain some useful information about Computer Graphics too.

  2. This post is incredibly informative! The way you break down intricate concepts into understandable terms is commendable. The actionable advice provided is both practical and beneficial. Your engaging writing style ensures that readers remain captivated throughout. It’s clear that a significant amount of research and effort went into creating this piece.

  3. You’ve written terrific content on this topic, which goes to show how knowledgable you are on this subject. I happen to cover about Martial Arts on my personal blog Articlecity and would appreciate some feedback. Thank you and keep posting good stuff!

  4. I like how well-written and informative your content is. You have actually given us, your readers, brilliant information and not just filled up your blog with flowery texts like many blogs today do. If you visit my website Articleworld about SEO, I’m sure you can also find something for yourself.

  5. Fantastic post! I thoroughly enjoyed reading it. Your insights are practical and easy to apply. It’s impressive how you simplify complex concepts into understandable steps. Your writing style is engaging, keeping me interested throughout. I appreciate the effort you put into making your content helpful and informative. Looking forward to more valuable posts from you. Keep up the excellent work, and thank you for sharing your knowledge with us!

  6. This blog post offers a literary voyage, seamlessly merging eloquence with profound insights to navigate unexplored areas. The author’s skill in addressing intricate concepts crafts a captivating narrative that surpasses usual limits. It’s not just educational; it’s an intellectual adventure that kindles curiosity and promotes introspection.

Leave a Reply

Your email address will not be published. Required fields are marked *