Switch from Pathfinder to Squiggles for path generation#461
Conversation
Codecov Report
@@ Coverage Diff @@
## develop #461 +/- ##
===========================================
+ Coverage 88.72% 88.91% +0.18%
===========================================
Files 140 139 -1
Lines 5880 5841 -39
===========================================
- Hits 5217 5193 -24
+ Misses 663 648 -15 |
well i was wrong but this should work squiggles version back to c++17 this is a hack but it seems to work trying to remove the cmake build step since this is working on my machine... i guess rsync isn't included with github actions container remove the use of rsync forgot to undo the installation of rsync cmake-build-debug already exists at that step fix valgrind errors
e12d1cd to
2662a5a
Compare
|
It's looking like the easiest way to get that test to compile would be to open a PR in your Okapilib Docker image to bump to Ubuntu 20.04 and GCC9 to get the filesystem support. GCC8 has issues with LCOV that prevent it from being a valid option but I've got GCC9 working well for the Squiggles CI. Does that work for you @Octogonapus ? |
Not really, I would like to keep the same toolchain. Just use a different solution instead of |
|
Sounds good, switched to using the C API to get the path. It's a bit clunkier but should work. |
need to bump g++ version to get filesystem header trying to get gcc9 switch to using C functions for filesystem interaction revert the CI script
3d908e8 to
3f3cae6
Compare
|
I just remembered that I'll probably want to pin the squiggles version at a specific number rather than using the latest from the |
|
Looks good. Just need to run some tests on a real robot now. It would be great if we could see videos of these tests. Not sure if you can do this @baylessj. I can't. Maybe @theol0403 or @dcieslak19973? |
|
I could physically test; do you have an example path in mind? Would you want to demonstrate that paths can have negative wheel velocities? Adding documentation about how to pair this with the OkapiLib velocity PID controller would be nice. |
|
I cannot physically test this, @dcieslak19973 's help would be great. I would like to get verification that a path with negative velocities works fine. The exact parameters to make that happen would depend on the track width of your robot, but something where the robot is moving horizontally should work. The points I used to generate the path with negative velocities in the Squiggles README were {0, 0, 10_deg}->{0, 2_m, 20_deg} and a track width of 0.4_m. A similar set of points should get you a nice path; you can also verify the output path with the python visualizer in the Squiggles repo if you'd like. Besides that, I would recommend testing with any existing paths you have using the current version of Okapilib (if any) or just making some mock auton movements. |
|
The testing should work fine without integrating the AMPC with a velocity PID but I can look into writing a tutorial for that. There's similar content in the Squiggles docs but it might be nice to have a similar tutorial in the Okapi docs. |
|
It's certainly possible I've built your branch incorrectly, but I am getting: To get to this point, I changed the version in the Makefile to 4.2.0-dev, got the .zip artifact into my test project, ran |
I'm a bit confused by the error message you've shown, I haven't seen it before. I'll write out the steps I would recommend taking to incorporate my fork into your PROS project; hopefully this will be a good checklist to follow.
This builds on my machine and hopefully should for yours as well. If it does not, there's a chance that you could be missing a dependency or have a different compiler version. If this fails, please list your gcc version ( |
|
@baylessj - I agree, the co-ordinate transformations are not pleasant. I'll try what you propose above later tonight, namely: I may also change my test program to to switch to It's possible that the |
|
I switched my test program to use OkapiLib CARTESIAN and changed my path-points passed into the motionprofiler to correspond with those. The different co-ordinate conventions are making my head spin. In Produces the desired movement. I did try During the movements, I had a separate thread output the OkapiLib (Cartesian) co-ordinates/heading which matched expectation. My hope is that this work now will allow for an easier time should one decide to try to implement a pure-pursuit path follower down the road. The change listed above does make the unit tests on the AsyncMotionProfileControllerTest.FollowPath* fail. I did not physically test reversed and mirrored paths. |
|
@dcieslak19973 The transform you listed above differs slightly from the one that you posted before, you had x and y flipped originally but not in the second example. I think your first transformation should work. For reference I'm going to compare a vector in each coordinate system: ^ 60 / ^ ^ Yaw is measured from X to Y in both frames. Using the above point as an example, we should have {1, 2, 60} in the Okapilib This looks to me like your first transformation would work then. Can you try that for an end point in each quadrant and verify that it works? (Like {2, 1, 30}, {-2, 1, -30}, {2, -1, 120}, {-2, -1, -120}, for example) |
|
@baylessj - that's correct. The first transform which flips I think the "correct" solution would be for the motion profiler to handle both cases. However, I think that could be done as a follow on PR, as I think it would potentially change the method signature (to accept the new parameter defaulted to FRAME_TRANSFORMATION), or to infer it based on the chassis controller. But the motion profilers seem to take TL;DR - in the short term it's probably sufficient to implement: With the suggestion that the comments make clear that the waypoints passed in are expected to be OkapiLib.FRAME_TRANSFORMATION format. |
|
That makes sense to me, thanks for the clarification. I'll implement the transformation that you have listed above and specify the frame transformation in the docs. This will match with the current behavior like I'm intending; the goal is to not create any breaking changes here. |
|
Nice. Thanks @baylessj @theol0403 / @Octogonapus - I'm a +1 |
|
@theol0403 / @Octogonapus - bump |
|
So the last details have been worked out and tested on a real robot then? Thank you for your work on this @dcieslak19973 and @baylessj |
|
Yes; physically tested on a real robot |
|
@dcieslak19973 Update: @baylessj and I talked offline and we are going to wait on this PR until @baylessj finishes some changes in Squiggles. |
|
The issues blocking the PR mentioned above have been resolved. I'd like the code to be retested but then it should be good to go. @dcieslak19973 Would you be able to repeat the test cases you had run before but with the latest changes to this PR? |
|
@baylessj - I should be able to take a look at it sometime in the next week |
|
I've confirmed that it works as it did before. I did throw one potential edge case at it which looks to generate a runtime exception (I think it was an impossible path exception): |
|
Thank you for testing this! I'm not surprised that the point turn fails, although now that you bring it up it might be a nice option to support point turns in the future. I'll open an issue for that on the squiggles repo and look into supporting it in the future. |
… feature/squiggles
* Switch from Pathfinder to Squiggles for path generation (#461) * add squiggles as a cmake dependency * building * tests passing again * tests are passing * remove pathfinder and switch to squiggles in lmpc * i think i fixed the PROS build * Various CI fixes well i was wrong but this should work squiggles version back to c++17 this is a hack but it seems to work trying to remove the cmake build step since this is working on my machine... i guess rsync isn't included with github actions container remove the use of rsync forgot to undo the installation of rsync cmake-build-debug already exists at that step fix valgrind errors * resolving the minor review comments * resolve review comments * Resolve review comments for tests need to bump g++ version to get filesystem header trying to get gcc9 switch to using C functions for filesystem interaction revert the CI script * pin squiggles version at 1.0.0 * copy the squiggles headers into the templates' inc dir too * on second thought, better to have squiggles inside okapi dir * resolve the issue with the executeSinglePath delay * invert the Y axis for the squiggles generation to match with ROS coords * fix the frame transformation and tests * squiggles to 1.1.0 * update squiggles again to fix tests * Fix segfault due to undefined use of front() * ensure that the PROS build uses the latest squiggles files * Adjust motion profiling documentation to mention Squiggles instead of Pathfinder. * fix issue where build fails when squiggles doesn't yet exist * Fix tutorials to use "wheel track" instead of "wheelbase" (#469) Co-authored-by: Octogonapus <firey45@gmail.com> Co-authored-by: Shawn Phelps <30736878+shawnphelps@users.noreply.github.com> * Add getSize() to MotorGroup (#472) * Fix tutorials to use "wheel track" instead of "wheelbase" (#469) * Add getSize() to MotorGroup Co-authored-by: Shawn Phelps <30736878+shawnphelps@users.noreply.github.com> Co-authored-by: Octogonapus <firey45@gmail.com> * Version bump * Add tile unit to docs Co-authored-by: Jonathan Bayless <16109996+baylessj@users.noreply.github.com> Co-authored-by: Shawn Phelps <30736878+shawnphelps@users.noreply.github.com> Co-authored-by: Brendan McGuire <brendan@bren.app>
Description of the Change
This PR replaces the dependency on Pathfinder with the Squiggles path generation library.
Motivation
Possible Drawbacks
The Squiggles library has not yet been tested on a real robot. The library has good test coverage and the paths look correct with its visualization tool but this verification has not been done on a physical robot.
Verification Process