ROS Resources: Documentation | Support | Discussion Forum | Index | Service Status | ros @ Robotics Stack Exchange
Ask Your Question

Revision history [back]

click to hide/show revision 1
initial version

I've never had a problem running ROS with threads. Are you calling ros::spinOnce() to poll for updates?

I've never had a problem running ROS with threads. Are you calling ros::spinOnce() to poll for updates?

I've never used pthread, but I know for a fact that it works with boost::thread. I know that doesn't solve your issue, but it's something to consider. But since it's really just a nice wrapper for pthreads on *Nix systems, it doesn't really explain the problem.

I've never had a problem running ROS with threads. Are you calling ros::spinOnce() to poll for updates?

I've never used pthread, but I know for a fact that it works with boost::thread. I know that doesn't solve your issue, but it's something to consider. But since it's really just a nice wrapper for pthreads on *Nix systems, it doesn't really explain the problem.

EDIT:

Try passing a this pointer to pthread_create(). Since the ros::init() is called in the parent class, you need to have access to the ROS variables in your thread.