Loading robot_description dependent on rosparams
There are a few dimensions of my robot model that are subject to change at runtime, and so I would like to use the param server to set and get those values. It was easy enough to set the values, but now I am unsure as to the best way to pass them to xacro when uploading the robot description:
Am I right that there isn't a way to query a parameter from the server within a launch file? Otherwise I would do something like:
<param name="robot_description" command="$(find xacro)/xacro.py $(arg model) my_var:=$(rosparam get my_var)">
I can instead query the parameters within a python script, but how do I invoke xacro from within that script? Should I use
xacro.main(['arg1', 'arg2', ...])
? Edit: Scratch this asmain()
doesn't take any arguments. I'd prefer a solution that doesn't necessitate forking/modifying core code.- Presumably python would allow me to go the "hacky" route and just run the xacro command in a shell and get the result from stdout?
Any suggestions welcome. Thanks!
Btw: after seeing your own answer, the bit about "a few dimensions of my robot model that are subject to change at runtime" was rather confusing. "At runtime" typically means "at any point in time after a program has been started". That would not seem to be what your Python script allows.