edit manualControl for new ControlPad
This commit is contained in:
@@ -31,12 +31,18 @@ void ManualControl::loop() {
|
||||
}
|
||||
|
||||
void ManualControl::runManualControl() {
|
||||
int8_t x = this->input->x;
|
||||
int8_t y = this->input->y;
|
||||
// Have to be int16_t to avoid overflow (int8_t = 255 - 127 = -128)
|
||||
int16_t y = this->input->x - 127;
|
||||
int16_t x = this->input->y - 127;
|
||||
|
||||
// if (x || y) {
|
||||
// std::cout << "x: " << (int) this->input->x << " y: " << (int) this->input->y << std::endl;
|
||||
// std::cout << "x: " << (int) x << " y: " << (int) y << std::endl;
|
||||
// }
|
||||
|
||||
double value_per_step = this->max_speed * 2 / 256;
|
||||
this->moveControl->setSpeed((y * -1) * value_per_step);
|
||||
this->moveControl->setSpeed(-y * value_per_step);
|
||||
|
||||
value_per_step = this->max_rotation * 2 / 256;
|
||||
this->moveControl->setRotationSpeed(-x * value_per_step);
|
||||
this->moveControl->setRotationSpeed(x * value_per_step);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user