Simple URDF-Controller Example
Hi, I have been trying to figure it out "Simple URDF-Controller Example" in the following link, http://www.ros.org/wiki/pr2_mechanism/Tutorials/SImple%20URDF-Controller%20Example. If there is anyone who know the details to follow the above example, could you let me know it? I followed all the required recommendation, but could not complete the tutorial.
Before describing what problems I have in following the "Simple URDF-Controller Example", I want to say that my overall goal is that making robot model, putting state feedback controller, and simulating using ROS. Eventually the final goal will be implementing on Gumstix.
About following the above tutorial, "Simple URDF-Controller Example", I followed the recommended tutorial, "Writing a realtime joint controller", which is on the link, http://www.ros.org/wiki/pr2_mechanism/Tutorials/Writing%20a%20realtime%20joint%20controller . I have no problem in this tutorial. Based on this tutorial, to follow the tutorials of "Simple URDF-Controller Example", the procedures I have taken are:
$ roscreate-pkg my_controller_pkg pr2_controller_interface pr2_mechanism_model pluginlib $ roscd my_controller_pkg $ rosmake And I put robot.xml (which is in the also create a directory src and a file called src/my_controller_file.cpp ) inside the new package and create the directory include, then include/my_controller_pkg/my_controller_file.h, where this .h file is in "Writing a realtime joint controller". And also create a directory src and a file called src/my_controller_file.cpp, where this .cpp file is made according to "Simple URDF-Controller Example" and "Writing a realtime joint controller". And Open the CMakeLists.txt file, and add the following line on the bottom: rosbuild_add_library(my_controller_lib src/my_controller_file.cpp) and $ make
Then the following error messages are shown:
/home/username/ros_workspace/my_controller_pkg/src/my_controller_file.cpp: In member function ‘virtual bool my_controller_ns::MyControllerClass::init(pr2_mechanism_model::RobotState*, ros::NodeHandle&)’: /home/username/ros_workspace/my_controller_pkg/src/my_controller_file.cpp:22: error: ‘wheel1_state’ was not declared in this scope
/home/username/ros_workspace/my_controller_pkg/src/my_controller_file.cpp:38: error: ‘wheel2_state’ was not declared in this scope
/home/username/ros_workspace/my_controller_pkg/src/my_controller_file.cpp:50: error: a function-definition is not allowed here before ‘{’ token
/home/username/ros_workspace/my_controller_pkg/src/my_controller_file.cpp:57: error: a function-definition is not allowed here before ‘{’ token
/home/username/ros_workspace/my_controller_pkg/src/my_controller_file.cpp:66: error: a function-definition is not allowed here before ‘{’ token
/home/username/ros_workspace/my_controller_pkg/src/my_controller_file.cpp: At global scope:
/home/username/ros_workspace/my_controller_pkg/src/my_controller_file.cpp:67: error: expected ‘}’ at end of input
make[3]: * [CMakeFiles/my_controller_lib.dir/src/my_controller_file.o] Error 1
make[3]: Leaving directory `/home/username/ros_workspace/my_controller_pkg/build'
make[2]: * [CMakeFiles/my_controller_lib.dir/all] Error 2
make[2]: Leaving directory `/home/username/ros_workspace/my_controller_pkg/build'
make[1]: * [all] Error 2
make[1]: Leaving directory `/home/username/ros_workspace/my_controller_pkg/build'
make: * [all] Error 2
That is why I can not proceed on the tutorial, "Simple URDF-Controller Example".
Here is my_controller_file.cpp: include "my_controller_pkg/my_controller_file.h" include <pluginlib class_list_macros.h="">
namespace my_controller_ns {
/// Controller initialization in non-realtime bool MyControllerClass::init(pr2_mechanism_model::RobotState *robot, ros::NodeHandle &n) { std::string wheel1, wheel2;
///Link all Joints //////////////////////////////////////////////////////////////////////// if (!n ...