Quantcast
Channel: ROS Answers: Open Source Q&A Forum - RSS feed
Viewing all articles
Browse latest Browse all 126

dynamic_reconfigure tutorial problems

$
0
0
Hi everyone i am stilll new here so please assist me. So i have been trying to make a gui to change the modes(manual, teleoperation) of an vehicle from a control station. I initially tried to do qt and tried to integrate into ROS, but i failed ;(. I came across these rqt plugin, dynamic_reconfigure, which would able to do the same thing as my gui. When i created the following files according to the tutorial: http://wiki.ros.org/dynamic_reconfigure/Tutorials. These are the following problems/enquiry i have: 1) In the section "How to Write Your First .cfg File" --> "Use the cfg File" #add dynamic reconfigure api #find_package(catkin REQUIRED dynamic_reconfigure) generate_dynamic_reconfigure_options( cfg/Tutorials.cfg #... ) # make sure configure headers are built before any node using them add_dependencies(example_node ${PROJECT_NAME}_gencfg) What does the example_node refers to? should i change the example_node to the node which i want to change parameters/send signals? For example, if i want to send commands to turtlesim_node, should i replace the example_node with turtlesim_node? 2) When i compile after creating the files according to the tutorial, i get the following error. CMake Error at dynamic_tutorials/CMakeLists.txt:59 (add_dependencies): Cannot add target-level dependencies to non-existent target "example_node". The add_dependencies works for top-level logical targets created by the add_executable, add_library, or add_custom_target commands. If you want to add file-level dependencies see the DEPENDS option of the add_custom_target and add_custom_command commands. -- Configuring incomplete, errors occurred! See also "/home/azhar/catkin_ws/build/CMakeFiles/CMakeOutput.log". See also "/home/azhar/catkin_ws/build/CMakeFiles/CMakeError.log". make: *** [cmake_check_build_system] Error 1 Invoking "make cmake_check_build_system" failed Please refer below for my following folders and let me know if i am missing something CMakeLists.txt cmake_minimum_required(VERSION 2.8.3) project(dynamic_tutorials) find_package(catkin REQUIRED COMPONENTS dynamic_reconfigure roscpp rospy ) #add dynamic reconfigure api ## Generate dynamic reconfigure parameters in the 'cfg' folder generate_dynamic_reconfigure_options( cfg/Tutorials.cfg ) ################################### ## catkin specific configuration ## ################################### catkin_package( INCLUDE_DIRS include LIBRARIES dynamic_tutorials CATKIN_DEPENDS dynamic_reconfigure roscpp rospy DEPENDS system_lib ) ########### ## Build ## ########### include_directories( ${catkin_INCLUDE_DIRS} ) ## Declare a C++ library # add_library(dynamic_tutorials # src/${PROJECT_NAME}/dynamic_tutorials.cpp # ) ## Add cmake target dependencies of the library ## as an example, code may need to be generated before libraries ## either from message generation or dynamic reconfigure #add_dependencies(dynamic_tutorials ${${PROJECT_NAME}_EXPORTED_TARGETS} ${catkin_EXPORTED_TARGETS}) ## Declare a C++ executable # add_executable(dynamic_tutorials_node src/dynamic_tutorials_node.cpp) ## Add cmake target dependencies of the executable ## same as for the library above # add_dependencies(dynamic_tutorials_node ${${PROJECT_NAME}_EXPORTED_TARGETS} ${catkin_EXPORTED_TARGETS}) ## Specify libraries to link a library or executable target against # target_link_libraries(dynamic_tutorials_node # ${catkin_LIBRARIES} ## ) # make sure configure headers are built before any node using them add_dependencies(example_node ${PROJECT_NAME}_gencfg) Tutorials.cfg #!/usr/bin/env python PACKAGE = "dynamic_tutorials" from dynamic_reconfigure.parameter_generator_catkin import * gen = ParameterGenerator() gen.add("int_param", int_t, 0, "An Integer parameter", 50, 0, 100) gen.add("double_param", double_t, 0, "A double parameter", .5, 0, 1) gen.add("str_param", str_t, 0, "A string parameter", "Hello World") gen.add("bool_param", bool_t, 0, "A Boolean parameter", True) size_enum = gen.enum([ gen.const("Small", int_t, 0, "A small constant"), gen.const("Medium", int_t, 1, "A medium constant"), gen.const("Large", int_t, 2, "A large constant"), gen.const("ExtraLarge", int_t, 3, "An extra large constant")], "An enum to set size") gen.add("size", int_t, 0, "A size parameter which is edited via an enum", 1, 0, 3, edit_method=size_enum) exit(gen.generate(PACKAGE, "dynamic_tutorials", "Tutorials")) Server.py #!/usr/bin/env python import rospy from dynamic_reconfigure.server import Server from dynamic_tutorials.cfg import TutorialsConfig def callback(config, level): rospy.loginfo("""Reconfigure Request: {int_param}, {double_param},\ {str_param}, {bool_param}, {size}""".format(**config)) return config if __name__ == "__main__": rospy.init_node("dynamic_tutorials", anonymous = True) srv = Server(TutorialsConfig, callback) rospy.spin() package.xml dynamic_tutorials0.0.0The dynamic_tutorials packageazharTODOcatkindynamic_reconfigureroscpprospydynamic_reconfigureroscpprospy Any help would be greatly appreciated. I am using ubuntu 14.04 LTS and ROS indigo . :)

Viewing all articles
Browse latest Browse all 126

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>