MATLAB code

From Bike Wiki
Revision as of 00:16, 16 May 2020 by Kunalroy (talk | contribs)
Jump to navigation Jump to search

Commonly Used Variables

  • state: state is an vector with 8 state variables, in order they are, time step, X position, Y position, Lean Angle, Yaw Angle, Steer Angle, Lean Angle Rate, Velocity
  • motCommands - this is the same as in the control equation, for forward moving balancing, it is steer angle rate

MATLAB files

animateBike.m

Inputs:

  • state
  • p
  • motCommands
  • delta_offset
  • phi_offset

balanceControlOptimizer.m

BikeAndMotorConstants.m

CircleAboutZ.m

Inputs:

  • r - radius of the circle

drawBike.m

Inputs:

  • x
  • y
  • z
  • yaw
  • roll
  • steer
  • p

lqr_BC_optimizer.m

plotMultipleControllersTogether.m

rhs.m

  • currentState
  • p
  • K
  • delta_offset
  • phi_offset

runBicycleTest.m

Inputs:

  • x0,y0 - intial location
  • v0 - initial speed
  • delta0 - intial steer angle
  • phi0 - intial lean angle
  • phi_dot0 - intial derivative of lean angle
  • psi0 - intial yaw angle (heading)
  • K - vector of gains (k1, k2, k3)
  • delta_offset - either a scalar (a constant offset), or a vector of offsets (the bike will attempt to hit delta_offset(n) at the nth timestep
  • numTimeSteps - the number of time steps to run the simulation for
  • graph - 1= draws graph, 0 =does not

testSteerOffset.m

See also