Friday, January 18, 2019

Good Variable names

Good code requires minimal comments to understand it. One of the best ways to achieve clarity is to use good variable names. Examples of bad variable names:
  • euler
  • h
  • azimuth
  • acc
Better variable names:
  • eulerRFB321NED2Body_rad: Rotated frame based Euler angles that will transform the NED frame to body fixed frame. Unit is radians. Note that array element order should be 0 = yaw, 1 = pitch, 2 = roll to reduce potential confusion.
  • hMSL_ft: Height above mean sea level. Unit is feet.
  • azimuthCWFromTrueNorth_deg: Azimuth measured clockwise from true North. Unit is degrees.
  • a_bi_NED_mps2: acceleration of body with respect to inertial frame, expressed in NED frame. Unit is m/s^2

No comments: