Hi,
We are using following code for motion profiling over odometry. we are having issue in programing robot is not moving to desired position as we code for. I think we are not configuring the dimensions correctly. can anyone verify our code and suggest how to set gear ratio in this line of code? I am using a blue cartridge and I am using a gear ratio of 36:70 from motor shaft to wheel shaft.
.withDimensions({AbstractMotor::gearset::blue,(1.4)}, {{3.2_in, 14_in}, imev5BlueTPR})
//our configuration
std::shared_ptr drive =
ChassisControllerBuilder().withMotors(
{-10,- 2}, // Left motors are 1 & 2 (reversed)
{5, 6} // Right motors are 3 & 4
).withGains(
{0.001, 0, 0.0001}, // Distance controller gains
{0.001, 0, 0.0001}, // Turn controller gains
{0.001, 0, 0.0001} // Angle controller gains (helps drive straight)
)
.withDimensions({AbstractMotor::gearset::blue,(70.0/36.0)}, {{3.2_in, 14_in}, imev5BlueTPR})
.withOdometry() // use the same scales as the chassis (above)
.buildOdometry(); // build an odometry chassis
std::shared_ptr profileController =
AsyncMotionProfileControllerBuilder()
.withLimits({
1.0, // Maximum linear velocity of the Chassis in m/s
2.0, // Maximum linear acceleration of the Chassis in m/s/s
10.0 // Maximum linear jerk of the Chassis in m/s/s/s
})
.withOutput(drive)
.buildMotionProfileController();
profileController->generatePath({
{0_ft, 0_ft, 0_deg}, // Profile starting position, this will normally be (0, 0, 0)
{3_ft, 0_ft, 0_deg}}, // The next point in the profile, 3 feet forward
“A” // Profile name
);
profileController->setTarget(“A”);
profileController->waitUntilSettled();
Thanks