float targetCourse = gps.gprmc_course_to(storedLat, storedLong);
float currentCourse = "input from compass chip"
if (targetCourse > 180)
{
if (currentCourse > targetCourse) { // current is between 360 & target but target > 180
turn counterClockWise();
}
else if (currentCourse < targetCourse) && (currentCourse < targetCourse - 180) { //current is 0-180 target >180
turn counterClockWise();
}
else if (currentCourse < targetCourse) && (currentCourse > 180) { // current is > 180 but < target
turn clockWise();
}
}
if (targetCourse < 180) {
if (currentCourse < targetCourse) { //current 0-target
turn clockWise();
}
else if (currentCourse > targetCourse + 180) { // current > target +180
turn clockWise();
}
else if (currentCourse > targetCourse) { // current > target but less than 180
turn counterClockWise();
}
steer = gps.gprmc_course_to(storedLat, storedLong) - (heading Degrees)
if (steer < 0) { steer += 360;}
if (d > 180) { steer -= 360; }
if (steer <= -20 && steer >= -180)
{
digitalWrite(left, LOW);
digitalWrite(right, HIGH);
}
else if (steer >= 20 && steer <= 180)
{
digitalWrite(left, HIGH);
digitalWrite(right, LOW);
}
else
{
digitalWrite(left, HIGH);
digitalWrite(right, HIGH);
}
steer = gps.gprmc_course_to(storedLat, storedLong) - (heading Degrees)
woodygb wrote:Question ...Does the motor rotate 360 degrees to get reverse?
void steering() {
// calculate relative direction to destination
int steer = gps.gprmc_course_to(storedLat, storedLong) - (currentCourse) ;
// check if negative number, turn into positive.
if (steer < 0) {
steer += 360;
}
if (steer > 180) {
steer -= 360;
}
Serial.print("CTD used for relay control - ");
Serial.print(steer);
Serial.println();
//Turn left
if (steer <= -20 && steer >= -180)
{
digitalWrite(left, LOW);
digitalWrite(right, HIGH);
}
else if (steer >= 20 && steer <= 180)
{
digitalWrite(left, HIGH);
digitalWrite(right, LOW);
}
else
{
digitalWrite(left, HIGH);
digitalWrite(right, HIGH);
}
}
LROBBINS wrote:Have you tuned the motor compensation? If too low, it will have trouble with "high load" situations, including turn-in-place. Careful though, too high and the chair can become unmanageable, even to the point of runaway behavior.
Burgerman wrote:It makes it easier to drive. The load compensation when set correctly, automatically compensates for load. So the chair will respond the same, either loaded or not, slope or not, grass or tarmac, hill or no hill.
When its not set high enough you must add more power to overcome a load or weight yourself, and then it runs away after you do it. Or it refuses to turn. When set even fractionally too high it over compensates and can run away.
... This may seem like a daft question but ...because when i get off the chair lifts off the ground
woodygb wrote:... This may seem like a daft question but ...because when i get off the chair lifts off the ground
Why does the chair lift up? .... I always thought that you set the nose weight of the trailer hitch at 10-15 percent of the trailer weight... thus it should be pressing down on the ball hitch attached to the rear of the chair.
OR ...Do you mean that the casters are lifted off the ground without your weight on the chair?
Return to Everything Powerchair
Users browsing this forum: Juggler258, yeshelp and 123 guests