For this years game, we are using a reverse double four bar lift to place cubes in towers. In order keep the lift from twisting due to external problems, (gear slip, robot impact, etc.) we added a potentiometer to each side of the lift to track each side individually. I would like to use an async position controller in Pros achieve this, however, I cannot identify how to structure the controller builder.
Potentiometer rightLiftAngle(rPot);
auto leftLiftControl = AsyncPosControllerBuilder().withMotor(lLift).withSensor(lPot).build();
The names ‘lLift’ and ‘lPot’ are global identifiers to the ADI port numbers. How do identify that this port is a potentiometer, or is the fact that I only specify one port in the sensor field enough information to identify the sensor type?
Potentiometer rightLiftAngle(rPot);
auto pot_ptr = std::make_shared(rightLiftAngle);
auto leftLiftControl = AsyncPosControllerBuilder().withMotor(lLift).withSensor(pot_ptr).build();
leftLiftControl->tarePosition(); // set cutrrent position as "zero"
leftLiftControl->setTarget(...);
rightLiftControl->setTarget(...);
while( !leftLiftControl->isSettled() &&
!rightLiftControl->isSettled() )
pros::task::delay(10);