How do I dynamically link an SimpleActionClient to a SimpleActionServer?
I have a node that needs to dynamically discover and link to multiple servers. Each of my action servers are publishing/subscribing to the below topics...
/{link_name}/{node_name}/goal , /{link_name}/{node_name}/result , etc...
By inquires to the ROS Parameter Server, I can determine what strings to plug in for {link_name} and {node_name}. But, my client is having trouble dynamically opening the servers. ServerConnection is a Class that represents a connection to a server. Its header file looks like...
ServerConnection class {
public:
ServerConnection( );
~ServerConnection();
bool openActionClient(std::string linkNode);
protected:
actionlib::SimpleActionClient<mot_ctl_dvr::calibrateaction> *actionClient;
...
The connection is opened in the openActionClient() method. In the .cpp file...
bool ServerConnection::openActionClient(std::string linkNode) {
// linkNode = "{link_name}/{node_name}"
// <mot_ctl_dvr::CalibrateAction> is the namesace::action name that the servers use.
actionClient = new actionlib::SimpleActionClient<mot_ctl_dvr::CalibrateAction>::SimpleActionClient
(linkNode, true);
...
The compile error is...
/home/bob/Qt4Projects/robot_calibrator/serverconnection.cpp:40: error: expected type-specifier
new actionlib::SimpleActionClient<mot_ctl_dvr::CalibrateAction>::SimpleActionClient
^
I haven't found any example code that invokes the SimpleActionClient constructor dynamically (using new).
Has anyone tried to invoke the constructor using this dynamic form?
What is the secret to coding it?