public static final int LM_API_CFG_NUM_BRUSHES = (LM_API_CFG | (0 << CAN_MSGID_API_S));
If we tell the jaguar how many brushes our motor has, could we use the motor’s brushes as a simple tachometer so that we could do closed loop (somewhat) speed control without adding additional sensors (encoders, potentiometers, etc.)?
edit:
And if this could be used, how many brushes do the CIMs have?
If this could be used, would this work for a speed reference (or even position)?
public static class SpeedReference {
public final byte value;
static final byte kEncoder_val = 0;
static final byte kBrush_val = 1;
public static final SpeedReference kEncoder = new SpeedReference(kEncoder_val);
public static final SpeedReference kBrushes = new SpeedReference(kBrush_val);
private SpeedReference(byte value) {
this.value = value;
}
}
So, the banebots RS-555 has 5 brushes. If I had a jaguar on the CAN bus, could the brush count be used for either the Position or speed control mode?
would something like this work?
public static class PositionReference {
public final byte value;
static final byte kEncoder_val = 0;
static final byte kPotentiometer_val = 1;
static final byte kBrushes_val = 2;
public static final PositionReference kEncoder = new PositionReference(kEncoder_val);
public static final PositionReference kPotentiometer = new PositionReference(kPotentiometer_val);
public static final PositionReference kBrushes = new PositionReference(kBrushes_val);
private PositionReference(byte value) {
this.value = value;
}
}
public void configMotorBrushes(short brushes) {
byte] dataBuffer = new byte[8];
byte dataSize;
dataSize = packINT16(dataBuffer, brushes);
setTransaction(LM_API_CFG_NUM_BRUSHES, dataBuffer, dataSize);
}
CANJaguar brushedDCMotor = new CANJaguar(2, ControlMode.kPosition);
brushedDCMotor.setPositionReference(PositionReference.kBrushes);
brushedDCMotor.configMotorBrushes(5);
brushedDCMotor.enableControl(0.0);