JaciBrunning / Pathfinder

Cross-Platform, Multi-Use Motion Profiling and Trajectory Generation
MIT License
255 stars 78 forks source link

robotsquiggles's Difference to JaciBrunning's Pathfinder #70

Open vex-lq opened 3 months ago

vex-lq commented 3 months ago

hi, I tried baylessj's robotsquiggles at baylessj/robotsquiggles, and with the same parameters:

(1)squiggles: const double MAX_VEL = 2; // in meters per second const double MAX_ACCEL = 3.0; // in meters per second per second const double MAX_JERK = 6.0; // in meters per second per second per second const double ROBOT_WIDTH = 0.4; // in meters squiggles::Constraints constraints_3 = squiggles::Constraints(MAX_VEL, MAX_ACCEL, MAX_JERK); squiggles::SplineGenerator generator = squiggles::SplineGenerator( constraints_3, std::make_sharedsquiggles::TankModel(ROBOT_WIDTH, constraints_3),0.01); std::vectorsquiggles::ProfilePoint path_3 = generator.generate({ squiggles::Pose(0.5, 0.2, 1), squiggles::Pose(0.5, 0.5, 1)});

(2) Pathfinder : int POINT_LENGTH = 2; Waypoint points = (Waypoint)malloc(sizeof(Waypoint) POINT_LENGTH); Waypoint p1 = { 0.5, 0.2, 1 }; // Waypoint @ x=-4, y=-1, exit angle=45 degrees Waypoint p2 = { 0.5, 0.5, 1 }; // Waypoint @ x=-1, y= 2, exit angle= 0 radians points[0] = p1; points[1] = p2; TrajectoryCandidate candidate; pathfinder_prepare(points, POINT_LENGTH, FIT_HERMITE_QUINTIC, PATHFINDER_SAMPLES_HIGH, 0.01, 2, 3, 6, &candidate); free(points); int length = candidate.length; Segment trajectory = (Segment )malloc(length sizeof(Segment)); pathfinder_generate(&candidate, trajectory);

and I get different trajectory,as below, red line for left wheel,cyan line for left wheel, and green line for squiggles trajectory, and blue line for Pathfinder trajectory。 image

it seems that squiggles trajectory is more complicated, but on the other hand, squiggles use cpp, costing 100ms to generate, while Pathfinder use c, and costs 2000ms+...

can you explain to me the difference?

vex-lq commented 3 months ago
    Pose(0.2, 0.7, 0),
    Pose(1.1, 2.0, deg2rad(135))

now, pathfinder trajectory is more complicated.. image