Android Open Source - base_controller Kobuki Odometry Status






From Project

Back to project page base_controller.

License

The source code is released under:

Apache License

If you think the Android project base_controller listed in this page is inappropriate, such as containing malicious code/tools or violating the copyright, please email info at java2s dot com, thanks.

Java Source Code

package com.github.c77.base_driver.kobuki;
//from  w  w  w .  ja  v a  2s  .com
import com.github.c77.base_driver.AbstractOdometryStatus;
import com.github.c77.base_driver.BaseStatus;

import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;

/**
 * @author jcerruti@willowgarage.com (Julian Cerruti)
 */
public class KobukiOdometryStatus extends AbstractOdometryStatus {
    private short lastTimestamp;
    private static final double WIDTH = 0.280; // in m

    Log log = LogFactory.getLog(KobukiOdometryStatus.class);

    public KobukiOdometryStatus() {
        super(WIDTH);
    }

    void update(BaseStatus baseStatus) {
        //log.info("Updating odometry. Left Ticks = " + baseStatus.getLeftDistance() +
        //        ", Right Ticks = " + baseStatus.getRightDistance());

        if (baseStatus.getTimestamp() == lastTimestamp) {
            return;
        }

        // Approximate speed using last known distance and time lapsed
        int timeLapsed = baseStatus.getTimestamp() - lastTimestamp;
        double leftSpeed = haveLastTravel ? (baseStatus.getLeftDistance() - lastLeftTravel) / timeLapsed : 0;
        double rightSpeed = haveLastTravel ? (baseStatus.getRightDistance() - lastRightTravel) / timeLapsed : 0;

        // Calculate new robot pose
        calculateAndUpdate(baseStatus.getLeftDistance(), baseStatus.getRightDistance(),
                leftSpeed, rightSpeed);

        lastTimestamp = baseStatus.getTimestamp();
    }
}




Java Source Code List

com.github.c77.base_controller.BaseControllerNode.java
com.github.c77.base_controller.BaseOdomPublisher.java
com.github.c77.base_controller.BaseStatusPublisher.java
com.github.c77.base_driver.AbstractOdometryStatus.java
com.github.c77.base_driver.BaseDevice.java
com.github.c77.base_driver.BaseStatus.java
com.github.c77.base_driver.InertialInformation.java
com.github.c77.base_driver.OdometryStatus.java
com.github.c77.base_driver.create.CreateBaseDevice.java
com.github.c77.base_driver.husky.HuskyBaseDevice.java
com.github.c77.base_driver.husky.HuskyBaseUtils.java
com.github.c77.base_driver.husky.HuskyOdometryStatus.java
com.github.c77.base_driver.husky.HuskyPacketReader.java
com.github.c77.base_driver.husky.HuskyPacket.java
com.github.c77.base_driver.husky.HuskyParserException.java
com.github.c77.base_driver.kobuki.KobukiBaseDevice.java
com.github.c77.base_driver.kobuki.KobukiOdometryStatus.java
com.github.c77.base_driver.kobuki.KobukiPacketParser.java
com.github.c77.base_driver.kobuki.KobukiPacketReader.java