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

answered 2012-04-24 16:53:08 -0500

joq gravatar image

If you want to control when the constructor for Z runs, you can make it a boost::shared_ptr (even a global one) and then wait until after the ros::init() before allocating it.

boost::shared_ptr<Z> z;
main()
{
  ros::init(...);
  z.reset(new Z());
  ...
}