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

dynamic_reconfigure tutorial problems

asked 2017-01-15 04:49:06 -0600

Azhar gravatar image

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_reconfigu... .

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 ...
(more)
edit retag flag offensive close merge delete

1 Answer

Sort by ยป oldest newest most voted
1

answered 2017-01-21 04:34:57 -0600

Azhar gravatar image

i have solved this.

1) example_node refers to the node, whose parameter you want to change. Ensure the name of your node and package is consistent throughout the package.

2) latest update: https://github.com/azhar92/scooter-mo...

edit flag offensive delete link more

Question Tools

1 follower

Stats

Asked: 2017-01-15 04:49:06 -0600

Seen: 3,119 times

Last updated: Jan 21 '17