# Hover Tutorial

RigidChips :: Rigid-Chips :: Tutorials

## Hover Tutorial

Another salvaged tutorial. ~~If it's yours, claim it!~~

Fred

EDIT: This is also

I finally got time to create this tutorial.

A hover is a dynamic system. A stable dynamic system requires 2 elements: restoring force and damping, so that the system will return to and stay at its equilibrium state. The simplest example is a spring with damping (friction). When a spring is stretched or compressed, it will try to restore to its original length with a force of magnitude proportional to the displacement but opposite in direction. This leads to the formula

F = -kx,

where F is the force, x is the displacement, and k is the "elastic constant", or "spring constant". Note that F and x are vectors, meaning that they have both magnitude and direction. But for a 1-D problem, a scalar is good enough.

However, this is just half of the whole picture. From a physical point of view, it is not hard to see that there is no energy dissipation, therefore the spring would oscillate forever. For this, we need damping.

A simple damping force is of magnitude proportional to the speed, but just like the restoring force, is opposite in direction. E.g. if an object is moving to the right, there will be a force pushing it to the left, causing it to decelerate. The formula is

f = -bv,

where f is the friction force, v is the velocity, and b is the damping constant.

Combining the two equations, we now have the full equation for a damped spring system:

F = -kx-bv ---------------> equation (1)

Combine this with Newton's second law, F = ma, and after rearranging, we have

ma+bv+kx = 0

which is the standard ODE for linear dynamic systems.

(I think I've gone too far. :? )

For simple hovering (neglect horizontal movement and heading), a hover has 3 degrees of freedom: vertical displacement, pitch and roll. The requirement of stable hovering is 1. keep it at a desired height and 2. keep it level (unless you want to make a vector hover). There are mainly 2 slightly different approaches: "coupled" and "decoupled". Both methods treat jets as springs. From equation (1) above, if we replace the force with power of jets, we then can give jets the same behavior as damped springs.

The "coupled" method is in fact simpler. Each jet tries to keep at the target height, and each have their own damping, so that if the vehicle is balanced, the jets will keep the vehicle level and at the same height. The only difference is that, now we have gravity to pull the vehicle down, therefore we have to cancel out the effect of the gravity. In models 1 and 1b, you can see a constant for each jet's power: wt*6*1/4. Combined forces from the 4 jets will make the hover "weightless", if the hover stays level.

The other method is the "decoupled method". It separates the height of the whole vehicle and the pitch/roll of it into different terms, then combine them back together in the calculation of each jet's power. Although it is more complicated, there are two advantages over the first method: 1. you can adjust the stiffness and damping with respect to vertical displacement and tilting separately, therefore optimise the dynamic response in all 3 types of movements (this deals with damping ratio, if you know what it is), and 2. it can be expanded to make vector hovers. In models 2 and 2b, "pitchs" and "rolls" ("s" stands for "state") are the angle of tilting of the hover, and pitchw and rollw ("w" = "omega", which is the standard notation for angular speed) are angular speeds. They are analogous to displacement and speed in linear translation respectively, therefore can apply to the damped spring model as well.

P.S. For people who knows much enough about physics: yes, the equations used in these modelsl are linearised with the assumption of tilt and horizontal velocity being very small.

Fred

EDIT: This is also

**Bwansy's tutorial.**__Hover Tutorial__I finally got time to create this tutorial.

**Underlying principles**(don't read this if you hate physics, but then you wouldn't play RC, would you?)A hover is a dynamic system. A stable dynamic system requires 2 elements: restoring force and damping, so that the system will return to and stay at its equilibrium state. The simplest example is a spring with damping (friction). When a spring is stretched or compressed, it will try to restore to its original length with a force of magnitude proportional to the displacement but opposite in direction. This leads to the formula

F = -kx,

where F is the force, x is the displacement, and k is the "elastic constant", or "spring constant". Note that F and x are vectors, meaning that they have both magnitude and direction. But for a 1-D problem, a scalar is good enough.

However, this is just half of the whole picture. From a physical point of view, it is not hard to see that there is no energy dissipation, therefore the spring would oscillate forever. For this, we need damping.

A simple damping force is of magnitude proportional to the speed, but just like the restoring force, is opposite in direction. E.g. if an object is moving to the right, there will be a force pushing it to the left, causing it to decelerate. The formula is

f = -bv,

where f is the friction force, v is the velocity, and b is the damping constant.

Combining the two equations, we now have the full equation for a damped spring system:

F = -kx-bv ---------------> equation (1)

Combine this with Newton's second law, F = ma, and after rearranging, we have

ma+bv+kx = 0

which is the standard ODE for linear dynamic systems.

(I think I've gone too far. :? )

**Applying in RC**For simple hovering (neglect horizontal movement and heading), a hover has 3 degrees of freedom: vertical displacement, pitch and roll. The requirement of stable hovering is 1. keep it at a desired height and 2. keep it level (unless you want to make a vector hover). There are mainly 2 slightly different approaches: "coupled" and "decoupled". Both methods treat jets as springs. From equation (1) above, if we replace the force with power of jets, we then can give jets the same behavior as damped springs.

The "coupled" method is in fact simpler. Each jet tries to keep at the target height, and each have their own damping, so that if the vehicle is balanced, the jets will keep the vehicle level and at the same height. The only difference is that, now we have gravity to pull the vehicle down, therefore we have to cancel out the effect of the gravity. In models 1 and 1b, you can see a constant for each jet's power: wt*6*1/4. Combined forces from the 4 jets will make the hover "weightless", if the hover stays level.

The other method is the "decoupled method". It separates the height of the whole vehicle and the pitch/roll of it into different terms, then combine them back together in the calculation of each jet's power. Although it is more complicated, there are two advantages over the first method: 1. you can adjust the stiffness and damping with respect to vertical displacement and tilting separately, therefore optimise the dynamic response in all 3 types of movements (this deals with damping ratio, if you know what it is), and 2. it can be expanded to make vector hovers. In models 2 and 2b, "pitchs" and "rolls" ("s" stands for "state") are the angle of tilting of the hover, and pitchw and rollw ("w" = "omega", which is the standard notation for angular speed) are angular speeds. They are analogous to displacement and speed in linear translation respectively, therefore can apply to the damped spring model as well.

P.S. For people who knows much enough about physics: yes, the equations used in these modelsl are linearised with the assumption of tilt and horizontal velocity being very small.

**DemoHover1**- Code:
`// [RCD]`

Val

{

JETPWRB(default=0, min=-999999999, max=999999999, disp=0)

JETPWRF(default=0, min=-999999999, max=999999999, disp=0)

JETPWRL(default=0, min=-999999999, max=999999999, disp=0)

JETPWRR(default=0, min=-999999999, max=999999999, disp=0)

}

Key

{

}

Body

{

Core(name=CORE) {

W:Jet(power=JETPWRL, name=JETL) { }

E:Jet(power=JETPWRR, name=JETR) { }

N:Jet(power=JETPWRF, name=JETF) { }

S:Jet(power=JETPWRB, name=JETB) { }

}

}

Script

{wt = _WEIGHT()*9.81

tgtht = 2

hoverstiff = 1

hoverdamp = 0.15

JETPWRL = wt*6*(1/4+(tgtht-_H(JETL))*hoverstiff-_VY(JETL)*hoverdamp)

JETPWRR = wt*6*(1/4+(tgtht-_H(JETR))*hoverstiff-_VY(JETR)*hoverdamp)

JETPWRF = wt*6*(1/4+(tgtht-_H(JETF))*hoverstiff-_VY(JETF)*hoverdamp)

JETPWRB = wt*6*(1/4+(tgtht-_H(JETB))*hoverstiff-_VY(JETB)*hoverdamp)}

**DemoHover1b**- Code:
`// [RCD]`

Val

{

JETPWRB(default=0, min=-999999999, max=999999999, disp=0)

JETPWRF(default=0, min=-999999999, max=999999999, disp=0)

JETPWRL(default=0, min=-999999999, max=999999999, disp=0)

JETPWRR(default=0, min=-999999999, max=999999999, disp=0)

}

Key

{

}

Body

{

Core(name=CORE) {

W:Jet(power=JETPWRL, name=JETL) { }

E:Jet(power=JETPWRR, name=JETR) { }

N:Jet(power=JETPWRF, name=JETF) { }

S:Jet(power=JETPWRB, name=JETB) { }

}

}

Lua

{function main()

wt = _WEIGHT()*9.81

tgtht = 2

hoverstiff = 1

hoverdamp = 0.15

JETPWRL = wt*6*(1/4+(tgtht-_H(JETL))*hoverstiff-_VY(JETL)*hoverdamp)

JETPWRR = wt*6*(1/4+(tgtht-_H(JETR))*hoverstiff-_VY(JETR)*hoverdamp)

JETPWRF = wt*6*(1/4+(tgtht-_H(JETF))*hoverstiff-_VY(JETF)*hoverdamp)

JETPWRB = wt*6*(1/4+(tgtht-_H(JETB))*hoverstiff-_VY(JETB)*hoverdamp)

end}

**DemoHover2**- Code:
`// [RCD]`

Val

{

JETPWRB(default=0, min=-999999999, max=999999999, disp=0)

JETPWRF(default=0, min=-999999999, max=999999999, disp=0)

JETPWRL(default=0, min=-999999999, max=999999999, disp=0)

JETPWRR(default=0, min=-999999999, max=999999999, disp=0)

}

Key

{

}

Body

{

Core(name=CORE) {

W:Jet(power=JETPWRL, name=JETL) { }

E:Jet(power=JETPWRR, name=JETR) { }

N:Jet(power=JETPWRF, name=JETF) { }

S:Jet(power=JETPWRB, name=JETB) { }

}

}

Script

{wt = _WEIGHT()*9.81

tgtht = 2

hoverstiff = 1

hoverdamp = 0.15

rotstiff = 0.3

rotdamp = 0.05

ht = _H(CORE)

vy = _VY(CORE)

pitchs = (_Y(JETF)-_Y(JETB))/1.2

rolls = (_Y(JETR)-_Y(JETL))/1.2

pitchw = (_VY(JETF)-_VY(JETB))/1.2

rollw = (_VY(JETR)-_VY(JETL))/1.2

pitcht = -pitchs*rotstiff-pitchw*rotdamp

rollt = -rolls*rotstiff-rollw*rotdamp

fy = (tgtht-ht)*hoverstiff-vy*hoverdamp

JETPWRL = wt*6*(1/4+fy-rollt)

JETPWRR = wt*6*(1/4+fy+rollt)

JETPWRF = wt*6*(1/4+fy+pitcht)

JETPWRB = wt*6*(1/4+fy-pitcht)}

**DemoHover2b**- Code:
`// [RCD]`

Val

{

JETPWRB(default=0, min=-999999999, max=999999999, disp=0)

JETPWRF(default=0, min=-999999999, max=999999999, disp=0)

JETPWRL(default=0, min=-999999999, max=999999999, disp=0)

JETPWRR(default=0, min=-999999999, max=999999999, disp=0)

}

Key

{

}

Body

{

Core(name=CORE) {

W:Jet(power=JETPWRL, name=JETL) { }

E:Jet(power=JETPWRR, name=JETR) { }

N:Jet(power=JETPWRF, name=JETF) { }

S:Jet(power=JETPWRB, name=JETB) { }

}

}

Lua

{function main()

wt = _WEIGHT()*9.81

tgtht = 2

hoverstiff = 1

hoverdamp = 0.15

rotstiff = 0.3

rotdamp = 0.05

ht = _H(CORE)

vy = _VY(CORE)

pitchs = (_Y(JETF)-_Y(JETB))/1.2

rolls = (_Y(JETR)-_Y(JETL))/1.2

pitchw = (_VY(JETF)-_VY(JETB))/1.2

rollw = (_VY(JETR)-_VY(JETL))/1.2

pitcht = -pitchs*rotstiff-pitchw*rotdamp

rollt = -rolls*rotstiff-rollw*rotdamp

fy = (tgtht-ht)*hoverstiff-vy*hoverdamp

JETPWRL = wt*6*(1/4+fy-rollt)

JETPWRR = wt*6*(1/4+fy+rollt)

JETPWRF = wt*6*(1/4+fy+pitcht)

JETPWRB = wt*6*(1/4+fy-pitcht)

end}

Last edited by fredsmith on Fri Jan 28, 2011 12:56 am; edited 1 time in total

**fredsmith**- Hover
- Posts : 109

Join date : 2011-01-19

Location : Nowhere and everywhere.

## Re: Hover Tutorial

Corrected to give you the credit.

By the way, could you explain more about the damping factor? I don't exactly understand that part. I know why it's there (or else the system would continuously oscillate in a sinusoidal fashion), but... how does the factor work in the equation?

By the way, could you explain more about the damping factor? I don't exactly understand that part. I know why it's there (or else the system would continuously oscillate in a sinusoidal fashion), but... how does the factor work in the equation?

Last edited by fredsmith on Fri Jan 28, 2011 12:58 am; edited 1 time in total (Reason for editing : grammer mistakes =P)

**fredsmith**- Hover
- Posts : 109

Join date : 2011-01-19

Location : Nowhere and everywhere.

## Re: Hover Tutorial

it uses the hover's velocity and tries to stop it

**RA2lover**- Walker
- Posts : 382

Join date : 2010-10-11

Age : 23

Location : Brazil

## Re: Hover Tutorial

Okay, yeah, I figured it out. Thanks anyway.

**fredsmith**- Hover
- Posts : 109

Join date : 2011-01-19

Location : Nowhere and everywhere.

Similar topics

» Curl Tutorial!

» AOE_Fan's RMS Command Tutorial

» How to make .abk book ( Arena ) step by step... tutorial...

» i need help ;/

» IvanHoe 999946f x64 vs. IvanHoe B46fB x64, 2.800 games, still running

» AOE_Fan's RMS Command Tutorial

» How to make .abk book ( Arena ) step by step... tutorial...

» i need help ;/

» IvanHoe 999946f x64 vs. IvanHoe B46fB x64, 2.800 games, still running

RigidChips :: Rigid-Chips :: Tutorials

Page

**1**of**1****Permissions in this forum:**

**cannot**reply to topics in this forum