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

Toletum's profile - activity

2021-04-27 07:26:58 -0500 received badge  Nice Question (source)
2020-10-13 20:01:53 -0500 received badge  Nice Question (source)
2015-05-29 12:33:35 -0500 received badge  Notable Question (source)
2015-05-29 12:33:35 -0500 received badge  Famous Question (source)
2015-05-28 22:17:54 -0500 marked best answer How to find out if Rosmaster is running yet?

I am trying to debug a node that is supposed to publish a "shutdown message" to a topic. Since I am running rostests on my nodes, this message is supposed to get published fairly early after I launch my nodes.

Unfortunately, sometimes the message-sending happens and sometimes it doesn't. I am even using the "latch" option on my publisher (so that a subscriber can still receive a message that was sent before the subscriber started).

My current suspicion is that the Rosmaster sometimes doesn't have time to initialize. I've been hunting around for a way to check on the Master's status, but I can't seem to find it. Is there a way to make sure the Rosmaster is running?

(as an addendum: I'm not looking for a terminal command. I'm looking for some kind of code that would let my node know that rosmaster is reachable.)

2015-04-13 05:37:21 -0500 received badge  Famous Question (source)
2014-07-05 02:38:40 -0500 received badge  Taxonomist
2014-03-05 01:05:47 -0500 received badge  Nice Question (source)
2014-01-28 17:31:11 -0500 marked best answer Is it possible to share global variables between nodes?

I'm in a situation where I need to track how many messages are in a Subscriber's Queue. Since there's no straightforward size() function for the queue, I need to track both the amount of publishing and the amount of subscribing. In other words, I am tracking how much one node -- let's call it PubNode -- can keep up with another node -- let's call it SubNode. I've tried to create a brand new node that will track both PubNode and SubNode, but in practice it seems to create unnecessary overhead.

To resolve this, I want to create a "PubNode counter" that SubNode can access. Is it possible to create global variables that two separate nodes can access? It seems that PubNode and SubNode would have to be linked, but I'm pretty sure this isn't possible.

2014-01-15 13:49:26 -0500 received badge  Popular Question (source)
2014-01-12 07:42:57 -0500 received badge  Famous Question (source)
2013-12-17 12:31:27 -0500 received badge  Nice Question (source)
2013-12-16 05:36:20 -0500 received badge  Enlightened (source)
2013-11-03 06:51:21 -0500 received badge  Good Answer (source)
2013-11-01 07:01:34 -0500 received badge  Nice Answer (source)
2013-10-26 14:00:57 -0500 received badge  Famous Question (source)
2013-10-16 06:06:14 -0500 received badge  Famous Question (source)
2013-10-10 05:30:26 -0500 received badge  Famous Question (source)
2013-09-26 09:25:32 -0500 received badge  Notable Question (source)
2013-08-28 04:25:33 -0500 received badge  Notable Question (source)
2013-08-17 21:14:51 -0500 received badge  Notable Question (source)
2013-08-05 12:04:42 -0500 asked a question When writing gtests with ROS, why doesn't the FRIEND_TEST macro work?

For unit testing, I need to write gtests that can access at least some private data. The FRIEND_TEST macro doesn't seem to be working however. In the example here, I have my so-called "targetClass" whose privateMap I wish to access. This has not been compiling for me.

Within targetClassTester, I have this:

TEST_F(tester_base, exp) 
{
    myMap = myTargetClass.privateMap;
}

Meanwhile, in the header file for targetClass, I have the following in the private section:

FRIEND_TEST(tester_base, exp);

Finally, the following shows what the relevant parts of CMakeLists.txt would look like: (As a special note, targetClass.cpp contains a main() method and is normally created as its own executable. It's only for testing that I created the "targetClassForTesting" library. For unit testing, the main() method in targetClass.cpp is ignored.)

add_library(targetClassForTesting src/targetClass.cpp include/au_uav_ros/targetClass.h)

add_executable(targetClassTester include/myPackage/test/targetClassTester.h src/test/targetClassTester.cpp include/au_uav_ros/targetClass.h)

target_link_libraries(targetClassTester ${catkin_LIBRARIES} ${GTEST_LIBRARIES} targetClassForTesting)

add_rostest(test/targetClassTester.test)

There don't seem to be any other questions on the internet about FRIEND_TEST malfunctioning, making me think the issue is particular to ROS.

Let me know if you need any more information. Thank you.

2013-08-01 11:47:32 -0500 asked a question Why isn't the FRIEND_TEST macro working?

For unit testing, I need to write gtests that can access at least some private data. The FRIEND_TEST macro doesn't seem to be working however. In the example here, I have my so-called "targetClass" whose privateMap I wish to access. This has not been compiling for me.

Within targetClassTester, I have this:

TEST_F(tester_base, exp) 
{
    myMap = myTargetClass.privateMap;
}

Meanwhile, in the header file for targetClass, I have the following in the private section:

FRIEND_TEST(tester_base, exp);

Finally, the following shows what the relevant parts of CMakeLists.txt would look like: (As a special note, targetClass.cpp contains a main() method and is normally created as its own executable. It's only for testing that I created the "targetClassForTesting" library. For unit testing, the main() method in targetClass.cpp is ignored.)

add_library(targetClassForTesting src/targetClass.cpp include/au_uav_ros/targetClass.h)

add_executable(targetClassTester include/myPackage/test/targetClassTester.h src/test/targetClassTester.cpp include/au_uav_ros/targetClass.h)

target_link_libraries(targetClassTester ${catkin_LIBRARIES} ${GTEST_LIBRARIES} targetClassForTesting)

add_rostest(test/targetClassTester.test)

There don't seem to be any other questions on the internet about FRIEND_TEST malfunctioning, making me think the issue is particular to ROS.

Let me know if you need any more information. Thank you.

2013-07-31 17:53:45 -0500 received badge  Popular Question (source)
2013-07-29 11:49:29 -0500 commented question Why isn't Rostest running my gtests in catkin?

Are gtests still intended to be used with rostests? Otherwise, what IS the point of rostest?

2013-07-28 17:00:38 -0500 asked a question Why isn't Rostest running my gtests in catkin?

I am trying to run a rostest that subscribes to topics of the node it tests. It is made with gtests. Currently, I'm trying to make the rostest deliberately fail using assert_true(false), etc.

However, no matter what I do, running rostest my_package CLASStester.test returns success with absolutely no information. I've checked the xml log files and there's also no trace of test information (also, I can never seem to get "cout" statements in the CLASStester.cpp file to print anything in the terminal).

The following shows...roughly...what I believe are the relevant sections from my CMakeLists.txt.

add_library(CLASSForTesting src/CLASS.cpp include/mypackage/CLASS.h)

target_link_libraries(CLASS ${catkin_LIBRARIES})

catkin_add_gtest(CLASSTester include/mypackage/test/CLASSTester.h src/test/CLASSTester.cpp include/mypackage/CLASS.h include/mypackage/CLASS.h)

target_link_libraries(CLASSTester ${catkin_LIBRARIES} CLASSForTesting)

set_target_properties(CLASSTester PROPERTIES OUTPUT_NAME CLASSTester)

add_rostest(test/CLASSTester.test)

add_dependencies(CLASSTester ${PROJECT_NAME}_gencpp)

There doesn't seem to be much documentation on using rostest with catkin. Let me know if there's anything else you need. Thank you.

2013-07-27 10:48:53 -0500 asked a question Why isn't Rostest running my gtests in catkin?

I am trying to run a rostest that subscribes to topics of the node it tests. It is made with gtests. Currently, I'm trying to make the rostest deliberately fail using assert_true(false), etc.

However, no matter what I do, running rostest my_package CLASStester.test returns success with absolutely no information. I've checked the xml log files and there's also no trace of test information (also, I can never seem to get "cout" statements in the CLASStester.cpp file to print anything in the terminal).

The following shows...roughly...what I believe are the relevant sections from my CMakeLists.txt.

add_library(CLASSForTesting src/CLASS.cpp include/mypackage/CLASS.h)

target_link_libraries(CLASS ${catkin_LIBRARIES})

catkin_add_gtest(CLASSTester include/mypackage/test/CLASSTester.h src/test/CLASSTester.cpp include/mypackage/CLASS.h include/mypackage/CLASS.h)

target_link_libraries(CLASSTester ${catkin_LIBRARIES} CLASSForTesting)

set_target_properties(CLASSTester PROPERTIES OUTPUT_NAME CLASSTester)

add_rostest(test/CLASSTester.test)

add_dependencies(CLASSTester ${PROJECT_NAME}_gencpp)

There doesn't seem to be much documentation on using rostest with catkin. Let me know if there's anything else you need. Thank you.

2013-07-16 23:37:06 -0500 received badge  Notable Question (source)
2013-07-16 16:04:40 -0500 received badge  Popular Question (source)
2013-07-16 16:00:30 -0500 received badge  Teacher (source)
2013-07-16 16:00:30 -0500 received badge  Self-Learner (source)
2013-07-15 12:14:54 -0500 answered a question Is it possible to share global variables between nodes?

Thank you for all the suggestions. In the end, I had my Subscriber publish a "confirmation message" back to the Publisher. That way, the Publishing Node could always keep track of both the number of messages sent as well as the number of messages that were received.

The difference of "sent minus received" then provides the current Queue size (unless of course the Queue overflows, but that's another matter entirely).

2013-07-15 12:10:29 -0500 received badge  Notable Question (source)
2013-07-15 08:53:58 -0500 received badge  Famous Question (source)
2013-07-14 18:13:40 -0500 received badge  Notable Question (source)
2013-07-14 17:54:25 -0500 marked best answer Can you check how many messages are in a subscriber's Queue?

For testing purposes, I want to plot the number of messages waiting in a subscriber's topic Queue over time.

Having too many old messages is undesirable since up to date information is critical. However, I don't want to arbitrarily shorten the Queue since one size will definitely not fit all in my situation.

So, is there a simple way I can get the current number of messages in the Queue? I can't seem to find anything in the Subscriber documentation http://www.ros.org/doc/api/roscpp/html/classros_1_1Subscriber.html.

Thank you.