I am trying to write a Player driver that will publish messages on ROS.
Player driver does not create an executable file and hence I am not sure how to call ROS initialize within the player driver.
The main function of player driver looks like this...
void PlayerDriver::Main()
{
int argc; // Player Main() method does not take argument
char **argv; // What to do with argc and argv??
geometry_msgs::Point commandInput;
ros::init(argc, argv, "Command");
ros::NodeHandle n;
ros::Publisher command_pub = n.advertise<geometry_msgs::Point>("servocommand", 1000);
ros::Rate loop_rate(1);
while (ros::ok())
{
ros::spinOnce();
ProcessMessages();
//Do some stuff
commandInput.x = globalVel.v;
commandInput.y = globalVel.w;
commandInput.z = 0.0;
command_pub.publish(commandInput);
//Do some stuff
loop_rate.sleep();
}
}
The Player driver compiles and creates a shared library and I have a cfg file. It is called by "player playerdriver.cfg" and works fine, gets connected to a Player Client but it does not publish messages on ROS.
As the Player Main() method does not take arguments, I believe this is where I am doing some mistake. Any suggestions are welcome.