寫在前面
我在CSDN上寫了一套關于ros基礎的圖文教程发侵,歡迎關注!!!
移植自己的node到nodelet的流程:
add the necessary #includes: 添加必要頭文件
get rid of int main(): 刪除main函數(shù)
subclass nodelet::Nodelet: 繼承Nodelet class
move code from constructor to onInit(): 把原來的node類中的構造函數(shù)移植到nodelet的初始化函數(shù)中交掏,因為nodelet的構造函數(shù)無參
add the PLUGINLIB_EXPORT_CLASS macro: 使用pluginlib的宏來注冊插件
add <build_depend> and <run_depend> dependencies on nodelet in the package manifest.:添加build_depend 和 run_depend到package.xml文件中
create the .xml file to define the nodelet as a plugin: 創(chuàng)建對應插件的.xml描述文件
add the <nodelet> item in the <export> part of the package manifest:將7中寫好的xml放在package.xml文件的export部分
make the necessary changes to CMakeLists.txt (comment out a rosbuild_add_executable, add a rosbuild_add_library) : 在cmakelist中做對應修改