1. A computer-implemented method of controlling a bottom hole assembly (BHA), the method comprising: determining a model of BHA dynamics based on sensor measurements from the BHA; determining, based on the model of BHA dynamics, an objective function comprising a predicted future deviation from a planned wellbore path; determining a control input to the BHA that satisfies the objective function for a set of operating conditions of the BHA; generating, at a secondary system, relational information that relates the control input to the set of operating conditions; and transmitting the relational information from the secondary system to the BHA.