[WIP] Quick access of stages by id/index#626
[WIP] Quick access of stages by id/index#626captain-yoshi wants to merge 1 commit intomoveit:masterfrom
Conversation
|
Codecov ReportAttention: Patch coverage is
❗ Your organization needs to install the Codecov GitHub app to enable full functionality. Additional details and impacted files@@ Coverage Diff @@
## master #626 +/- ##
==========================================
- Coverage 58.82% 57.91% -0.90%
==========================================
Files 91 132 +41
Lines 8623 11119 +2496
Branches 0 957 +957
==========================================
+ Hits 5072 6439 +1367
- Misses 3551 4633 +1082
- Partials 0 47 +47 ☔ View full report in Codecov by Sentry. |
|
As far as I can see, this PR attempts to provide access to a |
|
Agreed that the current approach is best. But I think it cannot serialise complex objects stored in a property, e.x. std::function ? Even though I could change my properties to be serialisable, is there a way to loop through the solution internally without even needing the lookup vector ? Or it would be too complicated. // 1- current way using Msg
moveit_task_constructor_msgs::Solution solution_msg;
task.solutions().front()->toMsg(solution_msg, &task.introspection());
// 2- using directly the SolutionBase
auto solution = task.solutions().front();
// example
for(sub_solution : solution) {
stage = sub_solution.stage;
sub_trajectory = sub_solution.sub_trajectory;
}
|
In principle, you could inspect the SolutionBase directly. However, you need to use dynamic casts to determine the actual type. Message generation relies on virtual functions. |
|
Will probably just change my approach with post-planning. It will scale better. Thanks for the answers. |
This is somewhat related to #194. For pre-execution purposes.
We can already achieve this without any modification to the current code. This PR is just for demonstration.
1- Create a flat buffer of stages in BFS/DFS order
2- The indexes represents (minus 1) the given
stage_idfrom SolutionInfo.msg3- Use the stage_id to get the stage from the vector directly in O(1) complexity
4- You can retrieve your properties
I think the
stage_idis primarily used for RViz, thus instropection must be enabled.Would there be any interest in adding this sort of behavior inside MTC ?
If yes then:
If no: