## For instruction on writing tutorials ## http://www.ros.org/wiki/WritingTutorials #################################### ##FILL ME IN #################################### ## for a custom note with links: ## note = This tutorial assumes that you have completed the previous tutorials:[[nodelet/Tutorials/Running a nodelet]] ## for the canned note of "This tutorial assumes that you have completed the previous tutorials:" just add the links ## note.0= ## descriptive title for the tutorial ## title = Porting nodes to nodelets ## multi-line description to be displayed in search ## description = ## the next tutorial description (optional) ## next = ## links to next tutorial (optional) ## next.0.link= ## next.1.link= ## what level user is this tutorial for ## level= BeginnerCategory ## keywords = #################################### <> <> Work in progress...(see nodelet_tutorial_math for an example) * add the necessary #includes * get rid of int main() * subclass nodelet::Nodelet * move code from constructor to onInit() * add the PLUGINLIB_EXPORT_CLASS macro * add and dependencies on nodelet in the package manifest. * add the item in the part of the package manifest * create the .xml file to define the nodelet as a plugin * make the necessary changes to CMakeLists.txt (comment out a rosbuild_add_executable, add a rosbuild_add_library) == Minimal Nodelet == !MyNodeletClass.h Here we define the Class of our Nodelet. It's a good practice to place the header file under include/''package_name''/. ''NB: The usage of the namespace is a good practice but not mandatory, in the following example we will proceed with the namespace example_pkg'' {{{ #include namespace example_pkg { class MyNodeletClass : public nodelet::Nodelet { public: virtual void onInit(); }; } }}} !MyNodeletClass.cpp This file should be placed under the src/ folder of your actual package {{{ // this should really be in the implementation (.cpp file) #include // Include your header #include // watch the capitalization carefully PLUGINLIB_EXPORT_CLASS(example_pkg::MyNodeletClass, nodelet::Nodelet) namespace example_pkg { void MyNodeletClass::onInit() { NODELET_DEBUG("Initializing nodelet..."); } } }}} nodelet_plugins.xml This file should be placed along with the package.xml file {{{ This is my nodelet. }}} package.xml {{{ ... nodelet nodelet ... }}} mynodelet.launch Launch file should be placed under the launch/ repertory of your package, you can create it if it does not exist. {{{ }}} ## AUTOGENERATED DO NOT DELETE ## TutorialCategory ## FILL IN THE STACK TUTORIAL CATEGORY HERE