ROS Resources: Documentation | Support | Discussion Forum | Index | Service Status | ros @ Robotics Stack Exchange |
1 | initial version |
Is it not possible to construct the topicnames like this, or am I doing something wrong?
Raw char
arrays are not std::string
s, so that's why you get that error.
If you really must use char
, you could wrap it in a std::string(..)
ctor.
But I don't understand why you are using char
in the first place: std::string
is a type 'natively' supported by the ros::param
API.
And an observation:
My Topic names are supposed to change, when I use different sensors. Therefor I want my node to subscribe to different topics depending on parameters on the parameter server.
Unless you are creating and destroying subscriptions at runtime (so have to change these during the entire runtime of your program, not just in the initialisation phase), don't do this. Don't parameterise topic names like this.
I would suggest to use remapping. See #q303611 for a (very) high-level overview of what that does.