You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
53 lines
1.3 KiB
53 lines
1.3 KiB
using System;
|
|
using System.Collections.Generic;
|
|
using System.Linq;
|
|
using System.Text;
|
|
using System.Threading.Tasks;
|
|
|
|
namespace RaspiControl {
|
|
internal class Navigation {
|
|
private int angleRight;
|
|
private int angleLeft;
|
|
public Navigation() {
|
|
this.angleRight = 0;
|
|
this.angleLeft = 0;
|
|
}
|
|
|
|
public void ResetAngle() {
|
|
this.angleRight = 0;
|
|
this.angleRight= 0;
|
|
}
|
|
|
|
public int GetAngleLeftStep() {
|
|
this.angleLeft -= 10;
|
|
if (this.angleLeft < -180) {
|
|
this.angleLeft = -180;
|
|
}
|
|
return -10;
|
|
}
|
|
|
|
public int GetAngleRightStep() {
|
|
this.angleRight += 10;
|
|
if (this.angleRight > 180) {
|
|
this.angleRight = 180;
|
|
}
|
|
return 10;
|
|
}
|
|
|
|
public int IncreaseAngleLeft() {
|
|
this.angleLeft -= 10;
|
|
if(this.angleLeft < -180) {
|
|
this.angleLeft = -180;
|
|
}
|
|
return this.angleLeft;
|
|
}
|
|
|
|
public int IncreaseAngleRight() {
|
|
this.angleRight += 10;
|
|
if (this.angleRight > 180) {
|
|
this.angleRight = 180;
|
|
}
|
|
return this.angleRight;
|
|
}
|
|
}
|
|
}
|
|
|