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

NickDP's profile - activity

2023-06-14 11:27:31 -0500 received badge  Good Question (source)
2022-01-19 12:59:06 -0500 marked best answer CMake custom command that depends on message generation

I have a catkin package that contains a bunch of custom messages. In that same package I have a python script that generates a file based on the custom message definitions. The python script imports the messages in question to generate its output file.

I am having trouble getting this to work from a clean workspace.

Here is how I have added my custom command:

set(COMPARATOR_MESSAGES
  msg/Foo.msg
  msg/Bar.msg
  msg/Baz.msg)

add_custom_command(
  OUTPUT include/message_comparators.hpp
  COMMAND scripts/generate_message_comparators.py
      --msg ${COMPARATOR_MESSAGES}
      --out include/message_comparators.hpp
  DEPENDS ${COMPARATOR_MESSAGES} ${${PROJECT_NAME}_EXPORTED_TARGETS} ${catkin_EXPORTED_TARGETS} ${PROJECT_NAME}_genpy
  WORKING_DIRECTORY ${PROJECT_SOURCE_DIR}
  COMMENT "Generating message comparators"
  )

add_custom_target(part_out ALL DEPENDS include/message_comparators.hpp)

This works fine if this catkin package has already been build once. The problem I have is that when I run catkin clean --yes; catkin build my_msgs, it fails with the following error:

Traceback (most recent call last):
  File "scripts/generate_message_comparators.py", line 65, in <module>
    generate_comparator(message)
  File "scripts/generate_message_comparators.py", line 22, in generate_comparator
    i = importlib.import_module(message_namespace + ".msg")
  File "/usr/lib/python2.7/importlib/__init__.py", line 37, in import_module
    __import__(name)
ImportError: No module named my_msgs.msg
make[2]: *** [include/message_comparators.hpp] Error 1
make[1]: *** [CMakeFiles/part_out.dir/all] Error 2
make: *** [all] Error 2

I thought I fixed the dependency problems with all the DEPENDS I added. I used to have the problem that, when I e.g. added a field to Foo.msg, the output of my custom command would not reflect that the first time I ran catkin build my_package because my command apparently ran before the messages were generated. catkin build-ing a second time would generate the correct result. Since adding ${${PROJECT_NAME}_EXPORTED_TARGETS} (I think that's the only important one), this problem has been solved.

However, for some reason I still can't import the messages during the initial build.

How can I fix that?

Thanks!

2021-11-12 02:22:52 -0500 received badge  Popular Question (source)
2021-11-10 10:51:19 -0500 commented question catkin build with install fails after changes in a header file

I noticed that MyLib.hpp never gets updated in the install/ space if I make a non-breaking change and re-build.

2021-11-10 08:48:12 -0500 asked a question catkin build with install fails after changes in a header file

catkin build with install fails after changes in a header file I have a ROS melodic workspace where I'm compiling with c

2021-03-04 10:01:33 -0500 received badge  Famous Question (source)
2021-03-04 10:01:33 -0500 received badge  Notable Question (source)
2021-03-04 10:01:33 -0500 received badge  Popular Question (source)
2020-06-12 09:47:46 -0500 received badge  Nice Answer (source)
2020-05-07 21:48:30 -0500 received badge  Nice Question (source)
2020-04-20 11:11:01 -0500 asked a question CMake custom command that depends on message generation

CMake custom command that depends on message generation I have a catkin package that contains a bunch of custom messages

2020-04-20 11:06:56 -0500 asked a question Custom command that depends on python message generation

Custom command that depends on python message generation I have a catkin package (ROS kinetic) that contains a bunch of

2019-05-20 01:35:03 -0500 marked best answer Understanding actions

I've been using ROS services to ask a node to perform a long running (a few seconds) task and I want to switch to using ROS actions as recommended on http://wiki.ros.org/actionlib . The task is a call to a path-planning library that blocks until a path is found.

The documentation has me confused when it comes to blocking on the action server side in the goal callback. The fibonnacti example stays in the callback until the action is complete.

The under-the-hood description says:

Any actions taken in a callback received for a new goal should not be long running. The user may, of course, signal another thread to do work, but should not block.

1) Isn't that exactly the point of actions, that they are long running? Does that mean that the fibonnaci example is actually bad practice?

The under-the-hood description continues to say:

Upon construction of the simple action server, the user decides whether or not to spin up an extra thread to allow for taking long running actions in a goal callback.

2) I don't see this in the SimpleActionServer constructor. It has a boolean to choose autostarting, but nothing about spinning a separate thread.

This is an option in the SimpleActionClient, but its use is discouraged anyway.

3) So what is the recommended approach?

Should I only check for the legality of the goal and then setAccepted in the goal callback and then do the real work in my main thread (while(ros::ok() { ... }))? *

Or should/can I do the work in the goal callback (as the fibonnaci example does)? If I do that, will my feedback be sent and will I receive preemptions?

Thanks

EDIT: * I just noticed that setAccepted is not a member function of SimpleActionServer. This raises the question: Can I and do I have to mark a goal as accepted or is this done automatically when entering the goal callback with that goal?

2018-10-06 15:51:14 -0500 received badge  Good Question (source)
2018-07-25 18:15:12 -0500 received badge  Good Question (source)
2018-06-24 10:07:42 -0500 received badge  Self-Learner (source)
2018-06-24 10:07:42 -0500 received badge  Teacher (source)
2018-06-19 02:24:06 -0500 received badge  Nice Question (source)
2018-03-08 20:55:43 -0500 received badge  Famous Question (source)
2018-03-01 04:17:56 -0500 commented answer Understanding actions

My long running task does not need external stimuli while in the callback and I don't need concurrent ones, but I do wan

2018-03-01 04:14:28 -0500 edited question Understanding actions

Understanding actions I've been using ROS services to ask a node to perform a long running (a few seconds) task and I wa

2018-03-01 02:47:34 -0500 received badge  Notable Question (source)
2018-02-28 17:34:54 -0500 received badge  Nice Question (source)
2018-02-28 15:04:00 -0500 received badge  Popular Question (source)
2018-02-28 11:12:01 -0500 edited question Understanding actions

Understanding actions I've been using ROS services to ask a node to perform a long running (a few seconds) task and I wa

2018-02-28 11:12:01 -0500 received badge  Editor (source)
2018-02-28 09:44:38 -0500 asked a question Understanding actions

Understanding actions I've been using ROS services to ask a node to perform a long running (a few seconds) task and I wa

2017-10-31 09:20:21 -0500 received badge  Taxonomist
2017-07-08 14:01:33 -0500 received badge  Nice Question (source)
2017-07-08 14:01:28 -0500 marked best answer Rviz: Display image in 3D scene

Hi

For a visual odometry project I'm using Rviz to display what my filter is doing. I.e. I'm displaying the current camera pose, the path the camera has taken and the features it is tracking as a point cloud. I would also like to show the current camera image in the scene, attached to the cameras pose as it moves through around.

So far I have not been able to accomplish this. I can show the image in an Image display in Rviz, which is just a separate view/window, similar to what I would get with cv::imshow(). I also played around with creating a point cloud of all my pixels and assigning grayscale intensity values to it. This technically works, but it does not look very nice and is very slow, as is to be expected.

Is there a way to do what I'm trying to accomplish?

Any help is much appreciated

2016-09-22 04:53:18 -0500 received badge  Famous Question (source)
2016-06-20 12:17:43 -0500 received badge  Famous Question (source)
2016-06-20 12:03:13 -0500 received badge  Notable Question (source)
2016-05-08 15:41:31 -0500 marked best answer URDF parser: How to get a cylinder's dimensions

Hi

I have a question that is probably fairly basic. I am parsing a .urdf robot model with the URDF parser. I am able to use this object to get info about my joints and links (masses, inertias etc).

I am now trying to get the length of a cylindrical link. I have a pointer to the link in question:

boost::shared_ptr<const urdf::Link> link;

This link has a cylindrical collision element. I can confirm this by checking that

link->collision->geometry->type == urdf::Geometry::CYLINDER

In the URDF documentation, I see a Cylinder class that inherits from the Geometry class. This Cylinder class has the member data length that I am looking for.

The problem is that I don't know how to access it.

 link->collision->geometry->length

won't compile, as link->collision->geometry is of type Geometry and not Cylinder.

I tried casting the boost::shared_ptr<urdf::Geometry> to boost::shared_ptr<urdf::Cylinder>, but that, too, won't compile.

How can I access the length member?

2016-04-11 11:00:08 -0500 edited answer Optionally build a package with catkin

I'm achieving this by checking if CATKIN_DEVEL_PREFIX is set. With this, I can detect if the package is being built with catkin even if ROS is installed on the machine and the catkin workspace is sourced (which happens in my .bashrc, so it's always sourced)

Alternative solution:

If it doesn't have to work if the catkin workspace is sourced you can also check for catkin_FOUND, as suggested by @gvdhoorn. This is a bit nicer, but it doesn't work for my needs.

2016-04-11 10:37:00 -0500 marked best answer Optionally build a package with catkin

I have a package that provides a library. This library performs functions that do not explicitly rely on ROS and I want to be able to use this library in non-ROS contexts, i.e. in c++ programs I build with pure CMake.

I am looking for a way to set up my package, specifically the CMakeLists.txt, such that this package builds both as a catkin package and stand alone. When building with catkin, I want to declare the library s.t. other ROS packages can find and use it. In the pure CMake case I want to just build the library and have other packages find it themselves, e.g. with a FindMYPACKAGE.cmake.

I can already do this by manually defining my own variable in CMakeLists.txt, set(ROS 1), and then only doing catkiny stuff if that's defined. I tried using catkin_FOUND for this, but I have two problems: Even when the package is not actually in a catkin workspace and I'm not building with the catkin command, catkin_FOUND is true (on systems with ROS installed). On systems without ROS, find_package(catkin ...) naturally causes an error, so I can't check for catkin that way.

What variables exist that are already set at the top of a packages CMakeLists.txt with which I can check if catkin is the build tool in use?

Thank you for your help