Fixed loop times on OTOS localizer. Updated the pinpoint to the latest driver
This commit is contained in:
@ -314,9 +314,16 @@ public class GoBildaPinpointDriver extends I2cDeviceSynchDevice<I2cDeviceSynchSi
|
|||||||
* @param yEncoder FORWARD or REVERSED, Y (strafe) pod should increase when the robot is moving left
|
* @param yEncoder FORWARD or REVERSED, Y (strafe) pod should increase when the robot is moving left
|
||||||
*/
|
*/
|
||||||
public void setEncoderDirections(EncoderDirection xEncoder, EncoderDirection yEncoder){
|
public void setEncoderDirections(EncoderDirection xEncoder, EncoderDirection yEncoder){
|
||||||
|
if (xEncoder == EncoderDirection.FORWARD){
|
||||||
|
writeInt(Register.DEVICE_CONTROL,1<<5);
|
||||||
|
}
|
||||||
if (xEncoder == EncoderDirection.REVERSED) {
|
if (xEncoder == EncoderDirection.REVERSED) {
|
||||||
writeInt(Register.DEVICE_CONTROL,1<<4);
|
writeInt(Register.DEVICE_CONTROL,1<<4);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (yEncoder == EncoderDirection.FORWARD){
|
||||||
|
writeInt(Register.DEVICE_CONTROL,1<<3);
|
||||||
|
}
|
||||||
if (yEncoder == EncoderDirection.REVERSED){
|
if (yEncoder == EncoderDirection.REVERSED){
|
||||||
writeInt(Register.DEVICE_CONTROL,1<<2);
|
writeInt(Register.DEVICE_CONTROL,1<<2);
|
||||||
}
|
}
|
||||||
|
@ -108,10 +108,12 @@ public class OTOSLocalizer extends Localizer {
|
|||||||
*/
|
*/
|
||||||
@Override
|
@Override
|
||||||
public Pose getPose() {
|
public Pose getPose() {
|
||||||
SparkFunOTOS.Pose2D rawPose = otos.getPosition();
|
Pose pose = new Pose(otosPose.x, otosPose.y, otosPose.h);
|
||||||
Pose pose = new Pose(rawPose.x, rawPose.y, rawPose.h);
|
|
||||||
|
|
||||||
return MathFunctions.addPoses(startPose, MathFunctions.rotatePose(pose, startPose.getHeading(), false));
|
Vector vec = pose.getVector();
|
||||||
|
vec.rotateVector(startPose.getHeading());
|
||||||
|
|
||||||
|
return MathFunctions.addPoses(startPose, new Pose(vec.getXComponent(), vec.getYComponent(), pose.getHeading()));
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
Reference in New Issue
Block a user