Last active
August 29, 2015 14:11
-
-
Save jbohren/dc33acf4d3727e83ab7f to your computer and use it in GitHub Desktop.
interesting rosparam behavior...
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <ros/ros.h> | |
/** | |
> rosparam set /some_abs_param 1337 | |
> rosparam set /test/foo 16 | |
> ./test | |
struct! | |
has member foo: 1 | |
foo: 16 | |
abs: 1337 | |
**/ | |
int main(int argc, char** argv) { | |
ros::init(argc, argv, "test"); | |
ros::NodeHandle nh("~"); | |
XmlRpc::XmlRpcValue v; | |
nh.getParam("/",v); | |
if(v.getType() == XmlRpc::XmlRpcValue::TypeStruct) { | |
std::cout << "struct!" << std::endl; | |
std::cout << "has member foo: " << v.hasMember("foo") << std::endl; | |
std::cout << "foo: " << (int)v["foo"] << std::endl; | |
} | |
if(nh.getParam("/some_abs_param",v)) { | |
std::cout << "abs: " << (int)v << std::endl; | |
} else { | |
std::cerr << "/some_abs_param not found" << std::endl; | |
} | |
return 0; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment