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

Inconsistent ordering of attributes in XML output #42

Open
Roboterbastler opened this issue Feb 2, 2024 · 3 comments
Open

Inconsistent ordering of attributes in XML output #42

Roboterbastler opened this issue Feb 2, 2024 · 3 comments

Comments

@Roboterbastler
Copy link

Is your feature request related to a problem? Please describe.
This is probably less a bug than a feature request: It seems currently the XML that Groot2 saves has very inconsistent ordering of attributes of XML tags. That means if you save XML with Groot2 and then after some edits save again it mixes up the order of attributes in otherwise unchanged elements. If you track your XML in a versioning system this generates much more than the necessary changes which is very annoying.

I didn't find a real pattern when and where it happens, so I can't give a minimal reproducing example. But with my projects it happens basically with every edit & save.

Describe the solution you'd like
Groot2 should not change XML that has not been modified. It could e.g. preserve the order in which the attributes have been added. Or I would also be okay if it just enforced an ordering in the XML output (e.g. alphabetically).

@corot
Copy link

corot commented Aug 12, 2024

Yes, and the same weird ordering is show in the GUI:

image

i would expect something like grouping IN/OUT keys, or better respect the order provided by the user.

@facontidavide
Copy link
Contributor

Can you provide your TreeNodesModel XML files

@corot
Copy link

corot commented Sep 28, 2024

Can you provide your TreeNodesModel XML files

In my case I create the TreeNodesModel XML file by dumping the bt_factory with writeTreeNodesModelXML. So in the node I showed as example, it looks like:

        <Action ID="SelectNextTarget">
            <output_port name="tightening" type="float"/>
            <input_port name="failures" type="std::map&lt;std::__cxx11::basic_string&lt;char, std::char_traits&lt;char&gt;, std::allocator&lt;char&gt; &gt;, unsigned int, std::less&lt;std::__cxx11::basic_string&lt;char, std::char_traits&lt;char&gt;, std::allocator&lt;char&gt; &gt; &gt;, std::allocator&lt;std::pair&lt;std::__cxx11::basic_string&lt;char, std::char_traits&lt;char&gt;, std::allocator&lt;char&gt; &gt; const, unsigned int&gt; &gt; &gt;"/>
            <output_port name="target_name" type="std::string"/>
            <input_port name="objects" type="std::vector&lt;moveit_msgs::CollisionObject_&lt;std::allocator&lt;void&gt; &gt;, std::allocator&lt;moveit_msgs::CollisionObject_&lt;std::allocator&lt;void&gt; &gt; &gt; &gt;"/>
        </Action>

But in providedPorts I have a different ordering, more meaningful to me:

  static BT::PortsList providedPorts()
  {
    return { BT::InputPort<std::vector<Object>>("objects"),               //
             BT::InputPort<std::map<std::string, uint32_t>>("failures"),  //
             BT::OutputPort<std::string>("target_name"),                  //
             BT::OutputPort<float>("tightening") };
  }

To me the expected behavior is that writeTreeNodesModelXML dumps ports in the same order as listed in providedPorts.

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

No branches or pull requests

3 participants