Skip to content

Conversation

@rjoomen
Copy link
Contributor

@rjoomen rjoomen commented Dec 2, 2024

With the new toleranced waypoints, the tolerance variable type was introduced as a fixed Matrix (effectively Vector6d), always requiring 6 values. Here and here, however, a resize was still attempted, leading to silent errors, except for debug builds, where Eigen asserted an error.

This PR changes the types to a VectorXd, bringing the behavior in line with the coefs, allowing either 1 or 6 values, and fixing the resize() assert.

@codecov
Copy link

codecov bot commented Dec 2, 2024

Codecov Report

Attention: Patch coverage is 9.09091% with 20 lines in your changes missing coverage. Please review.

Project coverage is 79.87%. Comparing base (09c3f78) to head (03c699d).

Files with missing lines Patch % Lines
...ract_motion_planners/trajopt/src/trajopt_utils.cpp 9.09% 20 Missing ⚠️
Additional details and impacted files

Impacted file tree graph

@@            Coverage Diff             @@
##           master     #535      +/-   ##
==========================================
- Coverage   79.96%   79.87%   -0.10%     
==========================================
  Files         248      248              
  Lines       16349    16369      +20     
==========================================
  Hits        13074    13074              
- Misses       3275     3295      +20     
Files with missing lines Coverage Δ
..._motion_planners/trajopt/trajopt_waypoint_config.h 100.00% <ø> (ø)
...ract_motion_planners/trajopt/src/trajopt_utils.cpp 35.37% <9.09%> (-3.39%) ⬇️
🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@Levi-Armstrong
Copy link
Contributor

@rjoomen What about just fixing the xml parsing code to check if the token size is 1 then create fixed size vector of 6 and if not 1 it must be of length 6 otherwise throw an exceptions? @marip8 Interested to hear your thoughts on this change?

@rjoomen rjoomen force-pushed the fix_tolerance_sizes branch from 4d4f3b7 to d06cf98 Compare March 14, 2025 17:43
@rjoomen rjoomen force-pushed the fix_tolerance_sizes branch from d06cf98 to be2e055 Compare March 26, 2025 10:51
@marip8
Copy link
Contributor

marip8 commented Mar 26, 2025

I think we should probably add an else case and throw an exception if the vector is not size 1 or 6. I think it's valuable to communicate that error rather than silently ignoring whatever incorrect tolerance is provided by the user

@rjoomen rjoomen force-pushed the fix_tolerance_sizes branch from be2e055 to 8748738 Compare April 1, 2025 05:18
@Levi-Armstrong
Copy link
Contributor

@rjoomen What about just fixing the xml parsing code to check if the token size is 1 then create fixed size vector of 6 and if not 1 it must be of length 6 otherwise throw an exception?

@rjoomen Thoughts on the this question?

@rjoomen rjoomen force-pushed the fix_tolerance_sizes branch from 8748738 to 3658303 Compare April 11, 2025 20:04
@rjoomen
Copy link
Contributor Author

rjoomen commented Apr 11, 2025

@rjoomen What about just fixing the xml parsing code to check if the token size is 1 then create fixed size vector of 6 and if not 1 it must be of length 6 otherwise throw an exception?

@rjoomen Thoughts on the this question?

An exception if not size 1 or 6 sounds like a good idea. This also has to be implemented for multiple coeffs, I'll look into that. I'm not sure the xml parsing code is the best location for this, though, as currently all handling of (coeffs.size() == 1) (search for it) is already done in trajopt_utils already, and wrong sizes are ignored silently everywhere.

@rjoomen rjoomen force-pushed the fix_tolerance_sizes branch 2 times, most recently from fb4d2d1 to 129f95f Compare April 25, 2025 08:57
@rjoomen
Copy link
Contributor Author

rjoomen commented Apr 25, 2025

Done.

@rjoomen rjoomen requested review from Levi-Armstrong and marip8 and removed request for Levi-Armstrong April 25, 2025 13:34
@rjoomen
Copy link
Contributor Author

rjoomen commented Apr 30, 2025

This is ready for review/merger, @Levi-Armstrong

@Levi-Armstrong
Copy link
Contributor

Levi-Armstrong commented Apr 30, 2025

Can you make the same change to the trajopt ifopt one also? I

@rjoomen rjoomen force-pushed the fix_tolerance_sizes branch from 6822209 to 758965b Compare April 30, 2025 13:26
@Levi-Armstrong
Copy link
Contributor

Once the changes are also made to TrajOpt IFOPT this will be ready to merge.

@rjoomen
Copy link
Contributor Author

rjoomen commented May 2, 2025

Once the changes are also made to TrajOpt IFOPT this will be ready to merge.

I believe this is already correctly handled in Trajopt-Ifopt, see here, for example.

@Levi-Armstrong
Copy link
Contributor

Once the changes are also made to TrajOpt IFOPT this will be ready to merge.

I believe this is already correctly handled in Trajopt-Ifopt, see here, for example.

Sorry, I should have been more specific. I think we should also update the TrajOptIfoptCartesianWaypointConfig to leverage Eigen::VectorXd to align with your changes to the TrajOpt changes you made.

@rjoomen rjoomen force-pushed the fix_tolerance_sizes branch from 758965b to b5d64da Compare May 14, 2025 09:23
@rjoomen rjoomen force-pushed the fix_tolerance_sizes branch from b5d64da to 03c699d Compare July 21, 2025 06:00
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants