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

Replace linear node list with tree representation #34

Merged
merged 12 commits into from
Feb 9, 2024
Merged

Conversation

authaldo
Copy link
Member

@authaldo authaldo commented Feb 3, 2024

Changes:

  • restructured code (attempting to reduce the number of lines in the main file)
  • replaced linear node list with tree representation (helps with large numbers of nodes)

Requires a bit more testing before it can be merged

@ottojo
Copy link
Member

ottojo commented Feb 5, 2024

testing notes:

  • "expand all" button/context-menu would be nice
  • dead nodes seem to persist in node-tree for a long time. is this a new problem? edit: i think this only occurs with the currently selected node!
  • some indication of currently selected node (personal preference: including parents) would be nice
  • bug: crash if a node fqn is namespace of another node (node /control/planning/local_trajectory_planner and /control/planning/local_trajectory_planner/preprocessing):
details
terminate called after throwing an instance of 'std::out_of_range'
  what():  basic_string::substr: __pos (which is 25) > this->size() (which is 24)

Process finished with exit code 134 (interrupted by signal 6:SIGABRT)

backtrace:

(gdb) bt
#0  __pthread_kill_implementation (no_tid=0, signo=6, threadid=140737330390656) at ./nptl/pthread_kill.c:44
#1  __pthread_kill_internal (signo=6, threadid=140737330390656) at ./nptl/pthread_kill.c:78
#2  __GI___pthread_kill (threadid=140737330390656, signo=signo@entry=6) at ./nptl/pthread_kill.c:89
#3  0x00007ffff6d3f476 in __GI_raise (sig=sig@entry=6) at ../sysdeps/posix/raise.c:26
#4  0x00007ffff6d257f3 in __GI_abort () at ./stdlib/abort.c:79
#5  0x00007ffff70d1b9e in ?? () from /lib/x86_64-linux-gnu/libstdc++.so.6
#6  0x00007ffff70dd20c in ?? () from /lib/x86_64-linux-gnu/libstdc++.so.6
#7  0x00007ffff70dd277 in std::terminate() () from /lib/x86_64-linux-gnu/libstdc++.so.6
#8  0x00007ffff70dd4d8 in __cxa_throw () from /lib/x86_64-linux-gnu/libstdc++.so.6
#9  0x00007ffff70d44cd in ?? () from /lib/x86_64-linux-gnu/libstdc++.so.6
#10 0x00005555556a128b in std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >::_M_check (this=0x5555562f5530, __pos=25, __s=0x5555557fbd13 "basic_string::substr") at /usr/bin/../lib/gcc/x86_64-linux-gnu/12/../../../../include/c++/12/bits/basic_string.h:390
#11 0x00005555556a9d7b in std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >::substr (this=0x5555562f5530, __pos=25, __n=18446744073709551615) at /usr/bin/../lib/gcc/x86_64-linux-gnu/12/../../../../include/c++/12/bits/basic_string.h:3132
#12 0x000055555570c0ef in NodeTree::addNode (this=0x7fffffffd2f8, curNode=std::shared_ptr<TreeNode> (use count 2, weak count 0) = {...}, name="local_trajectory_planner/preprocessing", fullName="/control/planning/local_trajectory_planner/preprocessing")
    at /home/jonas/workspace/rig_reconfigure/src/node_window.cpp:138
#13 0x000055555570c2e7 in NodeTree::addNode (this=0x7fffffffd2f8, curNode=std::shared_ptr<TreeNode> (use count 2, weak count 0) = {...}, name="planning/local_trajectory_planner/preprocessing", fullName="/control/planning/local_trajectory_planner/preprocessing")
    at /home/jonas/workspace/rig_reconfigure/src/node_window.cpp:146
#14 0x000055555570c2e7 in NodeTree::addNode (this=0x7fffffffd2f8, curNode=std::shared_ptr<TreeNode> (use count 1, weak count 0) = {...}, name="control/planning/local_trajectory_planner/preprocessing", fullName="/control/planning/local_trajectory_planner/preprocessing")
    at /home/jonas/workspace/rig_reconfigure/src/node_window.cpp:146
#15 0x000055555570bbf6 in NodeTree::NodeTree (this=0x7fffffffd2f8, nodes=std::vector of length 9, capacity 9 = {...}) at /home/jonas/workspace/rig_reconfigure/src/node_window.cpp:91
#16 0x000055555570b6d2 in renderNodeWindow (windowName=0x5555557fda83 "Nodes", nodeNames=std::vector of length 9, capacity 9 = {...}, serviceWrapper=..., selectedNode="", status=...) at /home/jonas/workspace/rig_reconfigure/src/node_window.cpp:66
#17 0x0000555555698a3d in main (argc=1, argv=0x7fffffffe048) at /home/jonas/workspace/rig_reconfigure/src/rig_reconfigure.cpp:293

also happens if node name is only part of namespace of other node (node /control/planning/local_trajectory_planner and /control/planning/local_trajectory_planner/utilities/preprocessing):

backtrace
(gdb) bt
#0  __pthread_kill_implementation (no_tid=0, signo=6, threadid=140737330390656) at ./nptl/pthread_kill.c:44
#1  __pthread_kill_internal (signo=6, threadid=140737330390656) at ./nptl/pthread_kill.c:78
#2  __GI___pthread_kill (threadid=140737330390656, signo=signo@entry=6) at ./nptl/pthread_kill.c:89
#3  0x00007ffff6d3f476 in __GI_raise (sig=sig@entry=6) at ../sysdeps/posix/raise.c:26
#4  0x00007ffff6d257f3 in __GI_abort () at ./stdlib/abort.c:79
#5  0x00007ffff70d1b9e in ?? () from /lib/x86_64-linux-gnu/libstdc++.so.6
#6  0x00007ffff70dd20c in ?? () from /lib/x86_64-linux-gnu/libstdc++.so.6
#7  0x00007ffff70dd277 in std::terminate() () from /lib/x86_64-linux-gnu/libstdc++.so.6
#8  0x00007ffff70dd4d8 in __cxa_throw () from /lib/x86_64-linux-gnu/libstdc++.so.6
#9  0x00007ffff70d44cd in ?? () from /lib/x86_64-linux-gnu/libstdc++.so.6
#10 0x00005555556a128b in std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >::_M_check (this=0x555556321ba0, __pos=25, __s=0x5555557fbd13 "basic_string::substr") at /usr/bin/../lib/gcc/x86_64-linux-gnu/12/../../../../include/c++/12/bits/basic_string.h:390
#11 0x00005555556a9d7b in std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >::substr (this=0x555556321ba0, __pos=25, __n=18446744073709551615) at /usr/bin/../lib/gcc/x86_64-linux-gnu/12/../../../../include/c++/12/bits/basic_string.h:3132
#12 0x000055555570c0ef in NodeTree::addNode (this=0x7fffffffd348, curNode=std::shared_ptr<TreeNode> (use count 2, weak count 0) = {...}, name="local_trajectory_planner/utilities/preprocessing", fullName="/control/planning/local_trajectory_planner/utilities/preprocessing") at /home/jonas/workspace/rig_reconfigure/src/node_window.cpp:138
#13 0x000055555570c2e7 in NodeTree::addNode (this=0x7fffffffd348, curNode=std::shared_ptr<TreeNode> (use count 2, weak count 0) = {...}, name="planning/local_trajectory_planner/utilities/preprocessing", fullName="/control/planning/local_trajectory_planner/utilities/preprocessing") at /home/jonas/workspace/rig_reconfigure/src/node_window.cpp:146
#14 0x000055555570c2e7 in NodeTree::addNode (this=0x7fffffffd348, curNode=std::shared_ptr<TreeNode> (use count 1, weak count 0) = {...}, name="control/planning/local_trajectory_planner/utilities/preprocessing", fullName="/control/planning/local_trajectory_planner/utilities/preprocessing") at /home/jonas/workspace/rig_reconfigure/src/node_window.cpp:146
#15 0x000055555570bbf6 in NodeTree::NodeTree (this=0x7fffffffd348, nodes=std::vector of length 9, capacity 9 = {...}) at /home/jonas/workspace/rig_reconfigure/src/node_window.cpp:91
#16 0x000055555570b6d2 in renderNodeWindow (windowName=0x5555557fda83 "Nodes", nodeNames=std::vector of length 9, capacity 9 = {...}, serviceWrapper=..., selectedNode="", status=...) at /home/jonas/workspace/rig_reconfigure/src/node_window.cpp:66
#17 0x0000555555698a3d in main (argc=1, argv=0x7fffffffe098) at /home/jonas/workspace/rig_reconfigure/src/rig_reconfigure.cpp:293
#18 0x00007ffff6d26d90 in __libc_start_call_main (main=main@entry=0x555555697180 <main(int, char**)>, argc=argc@entry=1, argv=argv@entry=0x7fffffffe098) at ../sysdeps/nptl/libc_start_call_main.h:58
#19 0x00007ffff6d26e40 in __libc_start_main_impl (main=0x555555697180 <main(int, char**)>, argc=1, argv=0x7fffffffe098, init=<optimized out>, fini=<optimized out>, rtld_fini=<optimized out>, stack_end=0x7fffffffe088) at ../csu/libc-start.c:392
#20 0x00005555556970b5 in _start ()

src/node_window.cpp Outdated Show resolved Hide resolved
@ottojo

This comment was marked as duplicate.

@ottojo
Copy link
Member

ottojo commented Feb 5, 2024

proposed fix for name prefix crash in #35

@authaldo
Copy link
Member Author

authaldo commented Feb 8, 2024

I like the highlighting and service availability checking, thanks for that!

Everything seems to be working in my small test example, thus, I'll remove the draft state of the MR.

I would opt for adding additional functionality like "expand" / "collapse all" buttons in separate MRs.

@authaldo authaldo changed the title Draft: Replace linear node list with tree representation Replace linear node list with tree representation Feb 8, 2024
@authaldo authaldo requested a review from ottojo February 8, 2024 17:20
@ottojo ottojo merged commit 1583ff5 into master Feb 9, 2024
4 checks passed
@ottojo ottojo deleted the feat_node_tree branch February 9, 2024 10:43
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.

2 participants