-
Notifications
You must be signed in to change notification settings - Fork 195
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
robotinterface: Allow replacing values from command line #2608
Conversation
SonarCloud Quality Gate failed. |
It seems quite cool, thanks! Do you have any example on how to do overload a parameter via the |
In the future (but this is more complex, so for the moment not need to block this PR) it would be cool to be able to overload parameters without manually specifying the |
There is one test hiddend inside the
There is also an unit test in |
I agree that using XPath or similar would be cool, but this probably means re-write the whole parsing with a different library, since I doubt that I think this is somehow different, because in order to replace 2 parameters with the same value, you don't have to pass 2 different paths, you just need to "export" them externally with the same name (but I don't know much about XPath, perhaps you can have wildcards or similar, that would make them equivalent, assuming that you write the path properly) |
Yes, I totally agree!
In SDF they are using tinyxml2, and they are doing something similar (even if perhaps they are not doing exactly XPath), I will check it more in detail in the future. |
This comment has been minimized.
This comment has been minimized.
… getRobotFromString This is used to replace params with the attribute "extern-name". DTD version is now 3.1. The signatures are now: XMLReaderResult getRobotFromFile(const std::string& filename, const yarp::os::Searchable& config = yarp::os::Property()); XMLReaderResult getRobotFromString(const std::string& filename, const yarp::os::Searchable& config = yarp::os::Property());
c24a5e6
to
a24fa00
Compare
The goal of this patch is to allow us to replace some of the values of the parameters passed to the devices, with arguments passed from the command line. This saves us from having hundreds of identical files, with just one different parameter.
On the other hand we want to avoid the complexity of
xacro
and similar, and we want to have a validxml
that can be started even if these parameter are not set, and that are compatible with the oldyarprobotinterface
As a result, we decided to add a new
extern-name
attribute to theparam
tag (suggestions for a better name are welcome), that contains a global name, that is compared and eventually replaced with a value taken from aSearchable
that can now be optionally passed to thegetRobotFromFile
andgetRobotFromString
methods.Libraries
robotinterface
XMLReader
The
getRobotFromFile
andgetRobotFromString
now accept aSearchable
thatis used to replace params with the attribute
extern-name
.The signatures are now:
DTD version is now 3.1.
Tools
yarprobotinterface
parameters marked with the attribute
extern-name
.