Motion Profiling

If you add “true” to the setTarget parameter wouldn’t it mirror the movement which would mean moving backwards?

The issue is you need a trajectory with positive power on 1 side and negative on the other.
And no amount of flags will get pathfinder to give that result.

1 Like

If I generate these paths:

profileController->generatePath({{0_in, 0_in, 0_deg}, {50_in, 0_in, 0_deg}}, "A");
profileController->generatePath({{0_in, 0_in, 0_deg}, {0_in, 30_in, 0_deg}}, "B");

and run path A then path B, how would the robot move?

If it didnt error I would expect something like
image

What could be the errors you mentioned?

If I ran this path after moving forward, would it move to the point and turn the robot 45 degrees (left or right)?

profileController->generatePath({{0_in, 0_in, 0_deg}, {30_in, 0_in, -45_deg}}, "D");

Pathfinder doesn’t take negative values in the path declaration

So do I just put “true” in the second parameter of the setTarget function to move the other way ?

profileController->generatePath({{0_in, 0_in, 0_deg}, {30_in, 0_in, 45_deg}}, "A");
profileController->setTarget("A", true);

Also, how would the robot move with this path?

Yes but it will not make a point turn, instead it will move in a curve similar to this

image

I’m pretty sure it doesn’t have to be zero. The relative positions are what matter.

So in Okapilib’s documentation about setting the target of a AsyncMotionProfileController, it said that there were 3 parameters when calling the setTarget function. The first param is the path name, and the second param is following the profile backwards, and the third parameter is mirroring the profile. What’s the difference between following profile backwards and mirroring the profile?

It’s probably a good habit to look at the source code when you have any questions :slight_smile:

Basically, reversed changes the direction of the power sent to the motors, while mirroring swaps the left & right power outputs.

image

Reverse = flipping across x-axis
Mirror = flipping across y-axis

1 Like