Why is 'ros::Publisher': no appropriate default constructor available ?
Hi,
I want to send some IMU-data form my application ( vb.net ) to Ros on another pc. Therefore I use rosserial_windows. In my application you can choose which data you want to send. The best way is to build a dll. So I can publish the data I wish to. Unfortunately I get two errors with ros::Publisher. Here is piece of my code:
class Connect2ROS {
public:
ros::NodeHandle nh;
powerball_msgs::ExtPoseInput extPoseInput_msg;
//ros::Publisher cmd_vel_pub("cmd_vel", extPoseInput_msg);
ros::Publisher cmd_vel_pub ;//
char *ros_master;
Connect2ROS() {//here an error appears C2512 'ros::Publisher': no appropriate default constructor avialable
ros::Publisher cmd_vel_pub("cmd_vel", &extPoseInput_msg);
}
void InitRosPublish(char *ros_master, std::string topic) {
this->ros_master = ros_master;
printf("Connecting to server at %s\n", ros_master);
nh.initNode(ros_master);
printf("Advertising cmd_vel message\n");
this->cmd_vel_pub = this->nh.advertise< powerball_msgs::ExtPoseInput>("cmd_vel", 1);
//here an error appears C2275 'powerball_msgs::ExtPoseInput':illegal use of this type in expression
//ros::Publisher cmd_vel_pub("cmd_vel", &extPoseInput_msg);
/*this->cmd_vel_pub = cmd_vel_pub;*/
nh.advertise(this->cmd_vel_pub);
}
void PublishImuData_Rotation(double rel_vx, double rel_vy, double rel_vz, double x, double y, double z){...}
};
What is wrong? The error appears also when I use e.g. geometry_msgs::Twist as a message. I didn't find any help in the internet. I hope somebody can help me.
Thanks in advance!