updated steering values and added dome verbos logs

This commit is contained in:
2012-01-26 12:15:57 -05:00
parent c59cf45838
commit 9f34ed410b
5 changed files with 21 additions and 19 deletions

View File

@@ -20,7 +20,7 @@ public class Debug {
/**
* Sets the size of the radius of a user selected point in km
*/
public static final float RADIUS = .010f;
public static final float RADIUS = .005f;
/**
* Sets the amount of kilometers that a radius needs to be penetrated by an accuracy circle in km

View File

@@ -31,8 +31,8 @@ public class IOIOTruckManager extends IOIOManager {
private static final String TAG = "IOIOTruckThread";
private Activity mActivity;
private IOIOTruckThreadListener mListener;
private int mLeftDriveValue;
private int mRightDriveValue;
private int mDriveValue;
private int mSteerValue;
private int mShifterValue;
private boolean mStatLedValue;
private TB6612FNGMotorDriver mLeftMotor;
@@ -60,8 +60,8 @@ public class IOIOTruckManager extends IOIOManager {
*/
private void arcadeDrive() throws ConnectionLostException {
int left, right;
left = (mLeftDriveValue + mRightDriveValue) /2;
right = (mLeftDriveValue - mRightDriveValue) / 2;
left = (mDriveValue + mSteerValue) /2;
right = (mDriveValue - mSteerValue) / 2;
mLeftMotor.setSpeed(left);
mRightMotor.setSpeed(right + 1500);
@@ -71,7 +71,7 @@ public class IOIOTruckManager extends IOIOManager {
* @return the mDriveValue
*/
public synchronized int getDriveValue() {
return mLeftDriveValue;
return mDriveValue;
}
/**
@@ -85,7 +85,7 @@ public class IOIOTruckManager extends IOIOManager {
* @return the mSteerValue
*/
public synchronized int getSteerValue() {
return mRightDriveValue;
return mSteerValue;
}
/**
@@ -155,7 +155,7 @@ public class IOIOTruckManager extends IOIOManager {
* @param mDriveValue the mDriveValue to set
*/
public synchronized void setDriveValue(int mDriveValue) {
this.mLeftDriveValue = mDriveValue;
this.mDriveValue = mDriveValue;
}
/**
@@ -176,7 +176,7 @@ public class IOIOTruckManager extends IOIOManager {
* @param mSteerValue the mSteerValue to set
*/
public synchronized void setSteerValue(int mSteerValue) {
this.mRightDriveValue = mSteerValue;
this.mSteerValue = mSteerValue;
}
/**

View File

@@ -59,13 +59,13 @@ public class IOIOTruckValues extends IOIOValues {
* drive the truck forward
* PWM value
*/
public static final int DRIVE_FORWARD = 1300;
public static final int DRIVE_FORWARD = 1000;
/**
* drive the truck in reverse
* PWM value
*/
public static final int DRIVE_REVERSE = 1700;
public static final int DRIVE_REVERSE = 2000;
/**
* IOIO port for the "shifter"
@@ -87,5 +87,4 @@ public class IOIOTruckValues extends IOIOValues {
*/
public static final int STEER_LEFT = 1300;
}

View File

@@ -11,6 +11,7 @@ import android.os.Bundle;
import android.os.PowerManager;
import android.os.PowerManager.WakeLock;
import android.support.v4.app.FragmentActivity;
import android.util.Log;
import android.view.View;
import android.view.View.OnClickListener;
import android.widget.Button;
@@ -263,13 +264,18 @@ public class NavigationActivity extends FragmentActivity implements CompassListe
*/
if(mPoint != null)
if(GeoUtils.isIntersecting(point, (float) (accuracy / 1E3), mPoint, Debug.RADIUS, Debug.FUDGE_FACTOR)) {
Log.v(TAG, "Dest Reached, Stopping");
mIOIOManager.setDriveValue(IOIOTruckValues.DRIVE_STOP);
updateGoButton(true);
updateLog(R.string.dest_reached);
} else
} else {
Log.v(TAG, "Driving Forward");
mIOIOManager.setDriveValue(IOIOTruckValues.DRIVE_FORWARD);
else
}
else{
Log.v(TAG, "Lost GPS signal, stopping");
mIOIOManager.setDriveValue(IOIOTruckValues.DRIVE_STOP);
}
}

View File

@@ -36,6 +36,7 @@ public class TB6612FNGMotorDriver {
* @author ricky barrette
*/
public TB6612FNGMotorDriver(IOIO ioio, int pwmPin, int in1Pin, int in2Pin) throws ConnectionLostException {
Log.v(TAG, "Initializing TB6612FNG Motor Driver on ports: (pwm) "+ pwmPin +", (in1) "+ in1Pin +", (in2) "+in2Pin);
mPWM = ioio.openPwmOutput(pwmPin, PWM_FREQUENCY);
mPWM.setDutyCycle(0);
mIn1 = ioio.openDigitalOutput(in1Pin, false);
@@ -49,8 +50,6 @@ public class TB6612FNGMotorDriver {
* @author ricky barrette
*/
public void setSpeed(float speed) throws ConnectionLostException {
if(Debug.DEBUG)
Log.v(TAG, "setSpeed(float): "+speed);
if(speed == 0) {
//stop
mIn1.write(false);
@@ -74,8 +73,6 @@ public class TB6612FNGMotorDriver {
* @author ricky barrette
*/
public void setSpeed(int speed) throws ConnectionLostException {
if(Debug.DEBUG)
Log.v(TAG, "setSpeed(int): "+speed);
if(speed == 1500)
setSpeed(0f);
else if(speed < 1500)