I've been writing a conversion 'script' between two robot description formats and thought I would try out Mathematica as I thought it sounded pretty awesome. Although by this point I should have done it manually!
I'm sure there's a much better way to do the entire mapping process. I had trouble trying to apply the mappings from the elements between the joints and the links.
I had tried using variations on Rule @@ ConnectionsOrder
, with various operators /., //, @@, @@@ /@
- Is there a more idiomatic implementation of the below?
Since Mathematica is symbolically based, I thought something may exists where you can define a format, and then specifying another and some rules to convert and having everything work nicely. Does such a thing exist? - I have been text wrangling to basically manually convert the files.
jointsOrder = {"HAA", "HFE", "KFE", "WHEEL"};
linksOrder = {"BASE", "HIP", "THIGH", "shank_fixed", "WHEEL_L"};
connectionsOrder = Riffle[linksOrder, jointsOrder];
connections =
BlockMap[Apply[Rule], Flatten[Subsequences[connectionsOrder, {2}]],
2]
Thread[LinksOrder[[1 ;; Length[JointsOrder]]] -> JointsOrder]
$\endgroup$