Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add planner name to trajectory info #5

Merged

Conversation

sjahr
Copy link
Collaborator

@sjahr sjahr commented Jul 12, 2023

Add planner id to SubTrajectory SolutionInfo.

@codecov
Copy link

codecov bot commented Jul 12, 2023

Codecov Report

Merging #5 (b16b438) into ros2 (5ea2140) will increase coverage by 0.12%.
The diff coverage is 81.67%.

@@            Coverage Diff             @@
##             ros2       #5      +/-   ##
==========================================
+ Coverage   41.53%   41.64%   +0.12%     
==========================================
  Files          81       83       +2     
  Lines        7933     7962      +29     
==========================================
+ Hits         3294     3315      +21     
- Misses       4639     4647       +8     
Files Changed Coverage Δ
...moveit/task_constructor/solvers/pipeline_planner.h 0.00% <ø> (ø)
...oveit/task_constructor/solvers/planner_interface.h 100.00% <ø> (ø)
core/src/solvers/pipeline_planner.cpp 0.00% <0.00%> (ø)
core/src/storage.cpp 50.32% <0.00%> (-0.32%) ⬇️
...tion/motion_planning_tasks/src/task_list_model.cpp 22.83% <0.00%> (ø)
core/src/stages/move_relative.cpp 51.62% <50.00%> (-0.01%) ⬇️
core/include/moveit/task_constructor/storage.h 85.11% <91.67%> (-0.76%) ⬇️
core/src/stages/connect.cpp 87.50% <94.29%> (+1.37%) ⬆️
...e/moveit/task_constructor/solvers/cartesian_path.h 100.00% <100.00%> (ø)
...eit/task_constructor/solvers/joint_interpolation.h 100.00% <100.00%> (ø)
... and 1 more

📣 We’re building smart automated test selection to slash your CI/CD build times. Learn more

@sjahr sjahr marked this pull request as ready for review July 13, 2023 10:03
@sjahr sjahr changed the title WIP: Add planner name to trajectory info Add planner name to trajectory info Jul 13, 2023
@sjahr sjahr requested review from EzraBrooks and noah-wardlow July 13, 2023 10:03
@v4hn
Copy link

v4hn commented Jul 17, 2023

Why not optionally set (or add to) the comment instead of creating a new field?
Also, the pipeline planner already has a property "planner" which is basically what you implement via getPlannerId.
I would propose to implement this one in the other planners as well and use the property from there instead of implementing it again.

I did not review the rest of this patch.

@sjahr
Copy link
Collaborator Author

sjahr commented Jul 19, 2023

Thanks for your review!

Why not optionally set (or add to) the comment instead of creating a new field?

I think it is nicer to have a specifically named field rather than an arbitrary "comment" field for this data

Also, the pipeline planner already has a property "planner" which is basically what you implement via getPlannerId.

The refactored version of the PipelinePlanner we're using here does not. See PR against main mtc repository for details

@sea-bass sea-bass self-requested a review July 20, 2023 15:25
@@ -73,7 +73,13 @@ class Connect : public Connecting
WAYPOINTS = 1
};

using GroupPlannerVector = std::vector<std::pair<std::string, solvers::PlannerInterfacePtr> >;
struct PlannerIdTrajectoryPair

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for doing this!

My comment was less about the struct vs. pair data structure, and the fact that if you ever had to add more data to this it would be challenging. Same still holds here because the struct has Pair in its name. Is there some more generic name we can use like TrajectoryInfo?

... and same with the variable names that use this data type, which are still called vector and pair

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think we should keep it like this for now because the name describes what it is and if we add more to this data structure in the future the name can be updated accordingly. Despite the fact that this could also be of datatype pair, I think making it a struct made the code more readable 👍

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

TrajectoryInfo is very generic and MTC has already a datatype called like this.

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sounds good -- I can't think of anything better anyhow.

core/src/solvers/pipeline_planner.cpp Outdated Show resolved Hide resolved
Copy link

@sea-bass sea-bass left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM!

@sea-bass sea-bass merged commit 788ca80 into PickNikRobotics:ros2 Jul 28, 2023
@rhaschke
Copy link

rhaschke commented Mar 6, 2024

@sjahr: I'm going through all commits PickNik committed to the ros2 branch. For this one, could you please argue why this additional field is actually needed? How do you handle generators, which also generate trajectories but do not have a planner necessarily?

@sjahr
Copy link
Collaborator Author

sjahr commented Mar 6, 2024

I think it is useful to include information about the planner that created a solution into the solution info. We're using it e.g. for debugging and introspection. I did not think about the generator use-case, but I think in that case the field could be left empty or populated with something like "generated" (depending on how it was actually created). Before the parallel planning API, I guess it was possible to infer the planner that was used from the pipeline id but now, the pipeline planner uses multiple algorithms and without this field it would be harder to say which one actually created the best solution. Just out of curiosity: Are there any trajectory generator stage examples in the mtc main repository?

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.

5 participants