lejos.robotics.localization.CompassPoseProvider Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of lejos-ev3-api Show documentation
Show all versions of lejos-ev3-api Show documentation
leJOS (pronounced like the Spanish word "lejos" for "far") is a tiny Java Virtual Machine. In 2013 it was ported to the LEGO EV3 brick.
The newest version!
package lejos.robotics.localization;
import lejos.robotics.DirectionFinder;
import lejos.robotics.navigation.MoveProvider;
import lejos.robotics.navigation.Pose;
/**
* Pose Provider using a compass (or other direction finder) to provide
* location and heading data.
*
* Note: This is a temporary class to allow access compass data until we have
* a more encompassing solution for data from multiple instrumentation.
* @author BB
*
*/
public class CompassPoseProvider extends OdometryPoseProvider {
private DirectionFinder compass;
public CompassPoseProvider(MoveProvider mp, DirectionFinder compass) {
super(mp);
this.compass = compass;
}
public Pose getPose() {
Pose temp = super.getPose();
temp.setHeading(compass.getDegreesCartesian());
return temp;
}
}