git.haldean.org droidcopter / dac7cab
Server processes velocity vector from 360 controller Benjamin Bardin 10 years ago
3 changed file(s) with 11 addition(s) and 3 deletion(s). Raw diff Collapse all Expand all
Binary diff not shown
3434 public class Guidance implements Constants, Receivable {
3535
3636 /** How many times per second the PID loop will run */
37 public int PIDREPS = 1;
37 public int PIDREPS = 20;
3838
3939 /** Maximum permissible target velocity, in m/s; larger vectors will be resized */
4040 public static final double MAX_VEL = 2.0;
197197 zoom, getAxis(AXIS_R_V), getAxis(AXIS_R_H));
198198 }
199199 else {
200
201
200 double[] vels = new double[3];
201 vels[0] = getAxis(AXIS_L_H);
202 vels[1] = getAxis(AXIS_L_V);
203 vels[2] = getAxis(AXIS_R_V);
204 //3.0 is the value of the maximum normal vector
205 double adjustment = EnsignCrusher.MAX_VELOCITY / Math.sqrt(3.0);
206 for (v : vels) {
207 v *= adjustment;
208 }
209 EnsignCrusher.manualVelocity(vels);
202210 }
203211 }
204212