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

mherrmann's profile - activity

2023-07-06 23:21:58 -0500 received badge  Famous Question (source)
2023-07-06 23:21:58 -0500 received badge  Notable Question (source)
2020-09-16 21:06:23 -0500 marked best answer Proper Shutdown handling of node

I have problems shutting down my nodes correctly. Se the following minimal example:

int  main(int argc, char **argv)
{
    ros::init(argc, argv, "mec_sensor_node");
    ros::NodeHandle _oNH;
    while (ros::ok()) {}
    ROS_WARN("Test");
    return 0;
}

If I kill the node (CTRL+C or rosnode kill) the node quits immediately without giving me the chance to do any cleanup. So my question is, how can I achieve this functionality? Using signals is a problem, because I need a function callback. So I thought killing the node makes ros::ok() to fail, such that the node finishes, but that isn't the case, as can be seen via the ROS_WARN command. Any odeas?

EDIT 1:

    int  main(int argc, char **argv)
    {
        ros::init(argc, argv, "mec_sensor_node");
        ros::NodeHandle _oNH;
        ros::spinOnce();
        ros::Rate _oLoopRate(10);
        while (ros::ok()) 
        {
                _oLoopRate.sleep();
        }
        ROS_WARN("Test");
        return 0;
    }
2020-07-29 02:28:07 -0500 received badge  Notable Question (source)
2020-07-29 02:28:07 -0500 received badge  Popular Question (source)
2020-01-17 07:07:11 -0500 received badge  Favorite Question (source)
2019-12-18 15:47:41 -0500 received badge  Famous Question (source)
2019-12-18 15:47:41 -0500 received badge  Notable Question (source)
2019-05-23 02:41:41 -0500 received badge  Famous Question (source)
2019-05-23 02:41:41 -0500 received badge  Notable Question (source)
2019-05-23 02:41:41 -0500 received badge  Popular Question (source)
2019-04-05 15:53:39 -0500 received badge  Popular Question (source)
2019-02-28 07:47:17 -0500 received badge  Famous Question (source)
2019-02-04 03:00:34 -0500 received badge  Famous Question (source)
2019-01-22 08:55:27 -0500 received badge  Notable Question (source)
2018-10-19 19:07:35 -0500 received badge  Notable Question (source)
2018-10-19 19:07:35 -0500 received badge  Popular Question (source)
2018-08-30 11:36:17 -0500 asked a question Erroneous stereo reprojection

Erroneous stereo reprojection I am using a camera pair from Aptina, producing 1920x1092 px images. I created a ROS node

2018-08-29 04:47:03 -0500 commented question Stereo Calibration - Export from Matlab to ROS

Hi, did you find an answer by now? I'm facing the same problem, but can't translate the matlab stereoParams to the ROS p

2018-08-23 07:54:36 -0500 asked a question image_view/disparity freezes

image_view/disparity freezes I have a stereo_msgs/DisparityImage streamed on /disparity and a rectified sensor_msgs/Imag

2018-08-06 01:44:33 -0500 commented question Could not find or load the Qt platform plugin "xcb".

@allenh1 Thanks for your reply, my problem can be traced back to an installation of a camera driver, which installed a s

2018-07-25 03:27:21 -0500 commented answer TF Listener for static transforms exclusively

Additional question: I have a tf2_ros::Buffer tf_buffer_ and ask for trafos with tf_buffer_.lookupTransform(). How can I

2018-07-23 01:22:22 -0500 marked best answer camera_info_manager error: type argument given to delete

I downloaded the image_common package from https://github.com/ros-perception/ima... and tried to build. The problem is, it fails with

Errors     << camera_info_manager:make /home/.../catkin/Catkin_test/logs/camera_info_manager/build.make.002.log                            
In file included from /usr/src/gtest/src/gtest-all.cc:42:0:
/usr/src/gtest/src/gtest.cc: In destructor ‘virtual testing::Test::~Test()’:
/usr/src/gtest/src/gtest.cc:1897:10: error: type ‘const class testing::internal::scoped_ptr<testing::internal::GTestFlagSaver>’ argument given to ‘delete’, expected pointer
   delete gtest_flag_saver_;
          ^
/usr/src/gtest/src/gtest.cc: At global scope:
/usr/src/gtest/src/gtest.cc:2177:1: error: prototype for ‘testing::TestInfo::TestInfo(const string&, const string&, const char*, const char*, testing::internal::TypeId, testing::internal::TestFactoryBase*)’ does not match any in class ‘testing::TestInfo’
 TestInfo::TestInfo(const std::string& a_test_case_name,
 ^

Unfortunately I can't interpret the error, since I don't have experience with google tests. Can anyone help?

I am using Ubuntu 16.04 and ROS kinetic

2018-07-21 09:55:49 -0500 received badge  Popular Question (source)
2018-07-20 08:12:41 -0500 commented question camera_info_manager error: type argument given to delete

Good question, obviously I didn't knew that it was available, I did only check here: http://wiki.ros.org/image_common an

2018-07-20 02:35:00 -0500 asked a question camera_info_manager error: type argument given to delete

camera_info_manager error: type argument given to delete I downloaded the image_common package from https://github.com/r

2018-07-19 11:53:51 -0500 received badge  Popular Question (source)
2018-07-19 07:24:55 -0500 marked best answer ROS executable without Boost dependency

Is it possible to create a ROS executable (where the executable is a target of type executable within a CMakeLists.txt which is created with catkin and the c++ files include ros/ros.h) that does not link to boost? If I have an executable program and do ldd program there occurs at least a dependency on: libboost_system.so.1.58.0 libboost_thread.so.1.58.0

Is it possible to avoid these?

2018-07-19 06:48:32 -0500 edited question ROS executable without Boost dependency

ROS executable without Boost dependency Is it possible to create a ROS executable (where the executable is a target of

2018-07-19 06:48:12 -0500 edited question ROS executable without Boost dependency

ROS executable without Boost dependency Is it possible to create a ROS executable (where the executable is a target of

2018-07-19 06:46:59 -0500 asked a question ROS executable without Boost dependency

ROS executable without Boost dependency Is it possible to create a ROS executable that does not link to boost? If I hav

2018-06-25 06:32:57 -0500 commented answer dynamic reconfigure specific directory

Sorry, I did some mistakes creating the package. However, the line from dynamic_reconfigre.parameter_generator_catkin im

2018-06-25 06:31:26 -0500 marked best answer dynamic reconfigure specific directory

Using

generate_dynamic_reconfigure_options(ros/config/params.cfg)

in my CMakeLists.txt of a package, some strange directories within the package are created and I don't know why. Here is my structure before a build (top level is the catkin workspace with the toplevel CMakeLists.txt).

├── CMakeLists.txt -> /opt/ros/kinetic/share/catkin/cmake/toplevel.cmake
└── src
    └── pack_template
        ├── CMakeLists.txt
        ├── library
        │   ├── include
        │   │   └── lib.hpp
        │   └── src
        │       └── lib.cpp
        ├── package.xml
        └── ros
            ├── config
            │   └── params.cfg
            ├── include
            │   └── template
            │       └── template.hpp
            └── src
                └── template.cpp

I then use catkin build with this CMakeLists.txt

cmake_minimum_required(VERSION 2.8.3)
project(pack_template)

add_compile_options(-std=c++11)

find_package(catkin REQUIRED
  roscpp
  rospy
  std_msgs
  dynamic_reconfigure
)

generate_dynamic_reconfigure_options(
  ros/config/params.cfg
)

catkin_package(
  LIBRARIES ${PROJECT_NAME}
  CATKIN_DEPENDS std_msgs
)

include_directories(
  include
  ros/include
  library/include
  ${catkin_INCLUDE_DIRS}
  cfg/cpp
  ${Boost_INCLUDE_DIRS}
)

add_library(${PROJECT_NAME} STATIC
  library/src/lib.cpp
)

add_executable(${PROJECT_NAME}_node
  ros/src/template.cpp
)

set_target_properties(${PROJECT_NAME}_node PROPERTIES OUTPUT_NAME "example_node" PREFIX "")

add_dependencies(${PROJECT_NAME}_node 
  ${${PROJECT_NAME}_EXPORTED_TARGETS}
  ${catkin_EXPORTED_TARGETS}
)

target_link_libraries(${PROJECT_NAME}
  ${catkin_LIBRARIES}
)

target_link_libraries(${PROJECT_NAME}_node
  ${PROJECT_NAME}
  ${catkin_LIBRARIES}
  ${Boost_LIBRARY_DIR}
)

and my folder structure after a build looks (deleted some hopefully uninteresting things)

├── build
│   ├── (...)
├── CMakeLists.txt -> /opt/ros/kinetic/share/catkin/cmake/toplevel.cmake
├── devel
│   ├── env.sh -> ~/catkin/dynamic_reconfigure_test/devel/.private/catkin_tools_prebuild/env.sh
│   ├── etc
│   │   └── (...)
│   ├── include
│   ├── lib
│   │   ├── libpack_template.a -> ~/catkin/dynamic_reconfigure_test/devel/.private/pack_template/lib/libpack_template.a
│   │   ├── pack_template
│   │   │   └── example_node -> ~/catkin/dynamic_reconfigure_test/devel/.private/pack_template/lib/pack_template/example_node
│   │   ├── pkgconfig
│   │   │   ├── catkin_tools_prebuild.pc -> ~/catkin/dynamic_reconfigure_test/devel/.private/catkin_tools_prebuild/lib/pkgconfig/catkin_tools_prebuild.pc
│   │   │   └── pack_template.pc -> ~/catkin/dynamic_reconfigure_test/devel/.private/pack_template/lib/pkgconfig/pack_template.pc
│   │   └── python2.7
│   │       └── dist-packages
│   │           └── pack_template
│   │               ├── cfg
│   │               │   └── __init__.py -> ~/catkin/dynamic_reconfigure_test/devel/.private/pack_template/lib/python2.7/dist-packages/pack_template/cfg/__init__.py
│   │               └── __init__.py -> ~/catkin/dynamic_reconfigure_test/devel/.private/pack_template/lib/python2.7/dist-packages/pack_template/__init__.py
│   ├── setup.bash -> ~/catkin/dynamic_reconfigure_test/devel/.private/catkin_tools_prebuild/setup.bash
│   ├── setup.sh -> ~/catkin/dynamic_reconfigure_test/devel/.private/catkin_tools_prebuild/setup.sh
│   ├── _setup_util.py -> ~/catkin/dynamic_reconfigure_test/devel/.private/catkin_tools_prebuild/_setup_util.py
│   ├── setup.zsh -> ~/catkin/dynamic_reconfigure_test/devel/.private/catkin_tools_prebuild/setup.zsh
│   └── share
│       ├── catkin_tools_prebuild
│       │   └── cmake
│       │       ├── catkin_tools_prebuildConfig.cmake -> ~/catkin/dynamic_reconfigure_test/devel/.private/catkin_tools_prebuild/share/catkin_tools_prebuild/cmake/catkin_tools_prebuildConfig.cmake
│       │       └── catkin_tools_prebuildConfig-version.cmake -> ~/catkin/dynamic_reconfigure_test/devel/.private/catkin_tools_prebuild/share/catkin_tools_prebuild/cmake/catkin_tools_prebuildConfig-version.cmake
│       └── pack_template
│           └── cmake
│               ├── pack_templateConfig.cmake -> ~/catkin/dynamic_reconfigure_test/devel/.private/pack_template/share/pack_template/cmake/pack_templateConfig.cmake
│               └── pack_templateConfig-version.cmake -> ~/catkin/dynamic_reconfigure_test/devel/.private/pack_template/share/pack_template/cmake/pack_templateConfig-version.cmake
├── logs
│   ├── (...)
└── src
    └── pack_template
        ├── cfg
        │   └── cpp
        │       └── pack_template
        │           └── templateConfig.h
        ├── CMakeLists.txt
        ├── docs
        │   ├── templateConfig.dox
        │   ├── templateConfig-usage.dox
        │   └── templateConfig.wikidoc
        ├── library
        │   ├── include
        │   │   └── lib.hpp
        │   └── src
        │       └── lib.cpp
        ├── package.xml
        ├── ros
        │   ├── config
        │   │   └── params.cfg
        │   ├── include
        │   │   └── template
        │   │       └── template.hpp
        │   └── src
        │       └── template.cpp
        └── src
            └── pack_template
                ├── cfg
                │   ├── __init__.py
                │   └── templateConfig.py
                └── __init__.py

Is there a way to define a target location to create these directories? I want them

  1. to be created in the subfolder ros, where all my ros dependent things are.
  2. the paramsConfig.h should go to ros/include not in src

Edit: There was a mistake in my original post, I edited the package structure. My plan was to put all ros-dependent stuff in package_main/ros/, hence there are an include and src directory. Second my ros-independent code should go to package_main/library src and include. Unfortunately by using ... (more)

2018-06-25 01:59:52 -0500 commented answer dynamic reconfigure specific directory

I did so: pack_template.tar.gz

2018-06-25 01:59:05 -0500 commented answer dynamic reconfigure specific directory

I did so: https://wetransfer.com/downloads/522aa332916be5353edd4726f077f9f820180625065805/d5b8145fef639d8632afff40c88880

2018-06-25 01:16:30 -0500 commented answer dynamic reconfigure specific directory

@destogl Thank you for your offer, how can I send the project to you?

2018-06-22 10:25:17 -0500 received badge  Famous Question (source)
2018-06-22 08:13:09 -0500 commented answer dynamic reconfigure specific directory

@destogl What do you mean with update ROS packages? apt-get update and upgrade or something else? I tried that already,

2018-06-22 07:09:04 -0500 commented answer dynamic reconfigure specific directory

@gvdhoorn Sorry, for being unspecific. Yes I moved the params.cfg file into the cfg dir, nothing changed. @destogl I tri

2018-06-22 04:38:00 -0500 commented answer dynamic reconfigure specific directory

I tried so (deleting everything before), unfortunately its still generating these files. May the problem be with the cat

2018-06-22 04:27:06 -0500 commented answer dynamic reconfigure specific directory

Okay, I tried to do so, got it working, but my problem remains the same with the files being generated within my source

2018-06-22 04:27:06 -0500 received badge  Commentator
2018-06-22 04:20:06 -0500 commented answer dynamic reconfigure specific directory

@gvdhoorn the pack_template/cfg/cpp is autogenerated and the reason why I created that thread. I don't want it, but it i

2018-06-22 03:37:12 -0500 commented answer dynamic reconfigure specific directory

I edited my original post again and tried to post the questioned parts. I had to delete a lot of generated files, hopefu

2018-06-22 03:36:08 -0500 edited question dynamic reconfigure specific directory

dynamic reconfigure specific directory Using generate_dynamic_reconfigure_options(ros/config/params.cfg) in my CMake

2018-06-22 02:11:27 -0500 received badge  Notable Question (source)