I am attempting to use the okapilib 2D motion profiller for autonomous movement of the chassis. However there are quite a few issues that I am having:
If I change the code for the pathfinding generator even one tiny bit eg.
profileController->generatePath({
{0_ft, 0_ft, 0_deg},
{3_ft, 0_ft, 0_deg}},
"A"
to
profileController->generatePath({
{0_ft, 0_ft, 0_deg},
{3_ft, 0_ft, 0_deg},
{3_ft, 0_ft, 90_deg}},
"A"
then the autonomous simply does nothing, the robot does not move!
Also, if I change the _ft to _cm it does the same.
Another thing to note is that if I use the code below, the robot moves less than 2 feet instead of the 3 that I told it to go!
#include "main.h"
#include "okapi/api.hpp"
using namespace okapi;
auto chassis =
ChassisControllerBuilder()
.withMotors(1, 2)
.withDimensions(AbstractMotor::gearset::green, {{4_in, 14.9_in}, imev5GreenTPR})
.build();
auto profileController =
AsyncMotionProfileControllerBuilder()
.withLimits({1.0, 1.0, 5.0})
.withOutput(chassis)
.buildMotionProfileController();
void autonomous()
{
#define SIG_1 1
pros::Vision vision_sensor (20);
pros::Motor leftdrive (1);
pros::Motor rightdrive (2, true);
pros::Motor leftintake (3);
pros::Motor rightintake (4);
pros::Motor lift1 (5, true);
pros::Motor lift2 (7);
pros::Motor cage (20, true);
pros::Motor liftIntake (9);
pros::ADIAnalogIn sline (2);
leftdrive.set_brake_mode(pros::E_MOTOR_BRAKE_BRAKE);
rightdrive.set_brake_mode(pros::E_MOTOR_BRAKE_BRAKE);
leftintake.set_brake_mode(pros::E_MOTOR_BRAKE_HOLD);
rightintake.set_brake_mode(pros::E_MOTOR_BRAKE_HOLD);
lift1.set_brake_mode(pros::E_MOTOR_BRAKE_HOLD);
lift2.set_brake_mode(pros::E_MOTOR_BRAKE_HOLD);
cage.set_brake_mode(pros::E_MOTOR_BRAKE_HOLD);
liftIntake.set_brake_mode(pros::E_MOTOR_BRAKE_HOLD);
cage.set_gearing(pros::E_MOTOR_GEARSET_36);
lift1.set_gearing(pros::E_MOTOR_GEARSET_36);
lift2.set_gearing(pros::E_MOTOR_GEARSET_36);
leftdrive.set_gearing(pros::E_MOTOR_GEARSET_36);
rightdrive.set_gearing(pros::E_MOTOR_GEARSET_36);
profileController->generatePath({
{0_ft, 0_ft, 0_deg},
{3_ft, 0_ft, 0_deg}},
"A"
);
profileController->setTarget("A");
profileController->waitUntilSettled();
}
Are there any PROS 2D motion profiling tutorials besides the https://okapilib.github.io/OkapiLib/md_docs_tutorials_concepts_twodmotionprofiling.html
one? < this one is not really a tutorial, just a model for one particular piece of code, it doesn’t explain how you customise it or even change it slightly to fit your needs!