Simplified the algorithm wrt Mistry: I never understood why he stacked
the primary on top of the secondary when solving for the
secondary. So, now there are only two reasons to stack:
  1. adding joint limits to the primary
  2. collecting the tail of the task hierarchy in the ternary level.
Note that (2) can happen with the task hierarchy shifted "one down" in
case the joint limits make the primary task inachievable.

Didn't test this with joint limits yet though.
Joint limits seem to work, at least within the range of issues noticed
earlier, too:
  1. joint locking can keep the robot in an "awkward" position without
     trying to satisfy the secondary task even though there would be a
     solution that satisfies joint limits if they were left go (could
     be some sort of local minima effect created by the nullspace of
     the fused limit+primary task)
  2. joint limit plotting breaks down for angles of magnitude greater
     than 2pi or something like that.