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

Revision history [back]

I got it to work now. It turned out that I forgot to change the call to wxFrame, so the Frame that was supposed to be a class variable was actually a local variable. :-( I'm so mad at myself that I didn't see that sooner...

Anyway, if someone else wants to connect ROS and wxWidgets, this is how I did it:

In wxApp:

  • In OnInit(): call ros::init() (convert wxString in argv to char**)
  • In Onrun(): create a nodehandle and call subscribe with a reference to the wxFrame object. End OnRun with return wxApp::OnRun();

In wxFrame:

  • Create a timer event that calls ros::spinonce() in its callback method.
  • Create a callback method for the ROS message and do some exciting stuff in it :-)