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

Bernat Gaston's profile - activity

2023-05-24 07:25:56 -0500 marked best answer About unit testing in ROS2 - DI, wrappers and code structure.

Hi all,

Some time ago I used to be responsible of the testing framework of some software products outside of ROS. It's been some time that I am working in ROS now (lately in ROS2) and there are aspects on the testing design of ROS2 that I still don't understand. Specifically, I am talking about unit testing and the fact that many ROS2 functionalities are designed to use rclcpp:Node in an inheritance mode.

As far as I'm concerned in unit testing, you want to test (ideally one) aspect of you own code. This is why many libraries are using Dependency Injection instead of inheritance, to help developers test only their code. Hence, when you want to test, instead of the main library, you inject a mock and you can test your function without the need to call the library.

However, I see that the main code of ros2 and also the tests included use rclcpp:Node directly (without using mocks) and test multiple things (actually it seems that tests are most of the times integration ones and not unit ones). For example

https://github.com/ros2/rclcpp/blob/b...

Also, I tend to find the tests very long and difficult to follow, so I am a bit lost here. I assume I am not understanding something of the idea behind the testing architecture of ROS2. Why so inheritance based? Why testing so many things in a single function?

I have searched for a "testing guideline" or something like that but I am unable to find it. Can anybody enlighten this?

Many thanks

2023-05-24 07:25:45 -0500 received badge  Famous Question (source)
2023-05-16 01:24:18 -0500 commented question Build error in ROS Humble: pcl_msgs/msg/point_indices.hpp not found in pcl_conversions

Wait, have you tried this execution in your local before going to the CI? In my experiencie github CI gives a lot of pro

2023-05-15 09:11:07 -0500 commented question Build error in ROS Humble: pcl_msgs/msg/point_indices.hpp not found in pcl_conversions

sudo apt install locate sudo updatedb locate point_indices.hpp

2023-05-15 07:26:49 -0500 commented question Build error in ROS Humble: pcl_msgs/msg/point_indices.hpp not found in pcl_conversions

Ok. Can you search for this file? I usually use locate for finding these files. Just to see if the file is in the system

2023-05-15 06:07:10 -0500 commented question Build error in ROS Humble: pcl_msgs/msg/point_indices.hpp not found in pcl_conversions

Are you adding pcl_msgs as a dependency in your CMake?

2023-05-15 06:05:21 -0500 commented question How to do SLAM in limo robot simulation environment?

I'm a bit lost with your question. Which is the reason to not use SLAM toolbox http://wiki.ros.org/slam_toolbox?

2023-05-15 05:57:00 -0500 edited answer DWA Planner turning around the corners

Well, basically, this is what you should do. You have to work with inflation radius and footprint padding. Be careful wi

2023-05-15 05:56:36 -0500 edited answer DWA Planner turning around the corners

Well, basically, this is what you should do. You have to work with inflation radius and footprint padding. Be careful wi

2023-05-15 04:19:31 -0500 commented answer About unit testing in ROS2 - DI, wrappers and code structure.

That makes a lot of sense. Thanks!

2023-05-15 04:16:31 -0500 answered a question DWA Planner turning around the corners

Well, basically, this is what you should do. You have to work with inflation radius and footprint padding. Be careful wi

2023-05-15 04:16:31 -0500 received badge  Rapid Responder (source)
2023-05-14 04:07:01 -0500 commented answer About unit testing in ROS2 - DI, wrappers and code structure.

Thanks for the answer. We were not using testing at all so I wanted to start testing our code and I thought unit testing

2023-05-12 16:22:08 -0500 received badge  Notable Question (source)
2023-05-12 04:21:14 -0500 received badge  Favorite Question (source)
2023-05-12 04:08:21 -0500 received badge  Popular Question (source)
2023-05-11 04:26:25 -0500 received badge  Good Question (source)
2023-05-09 05:24:32 -0500 received badge  Nice Question (source)
2023-05-02 07:19:01 -0500 asked a question About unit testing in ROS2 - DI, wrappers and code structure.

About unit testing in ROS2 - DI, wrappers and code structure. Hi all, Some time ago I used to be responsible of the tes

2023-03-01 08:19:06 -0500 received badge  Famous Question (source)
2023-02-12 18:35:07 -0500 received badge  Notable Question (source)
2023-02-07 03:26:42 -0500 received badge  Famous Question (source)
2022-10-19 02:18:12 -0500 received badge  Popular Question (source)
2022-09-06 09:00:59 -0500 marked best answer ROS2 gmock for external libraries

Hi all,

I am trying to implement unit testing in my ROS2 project. I used to work with python and ROS1, where I had experience with pytest and nose. Now I am using ROS2-foxy, C++ and I've chosen gtest, since it seemed to me the best option (not sure though). Now, I am trying to test a function that has calls to rclcpp Node, since its class inherits from it. I am able to gtest it, but when I bring in gmock, I get tons of linking problems with gtest. Navigating arround, it seems that these linking problems come because gmock brings its own gtest implementation, which may conflict with previous one. However, due to the dependencies of ros-foxy-gtest and ros-foxy-gmock packages with the rest of the ros-foxy packages, I can not remove one of them or even both and execute my own version. I am trying to use known ros2 packages as examples (like rclcpp or even nav2) but I am not able to unlock how they use gmock or how they actually mock these functionalities. Any place where I can find easy examples? Tutorials? any clue? Many thanks

2022-09-06 09:00:53 -0500 answered a question ROS2 gmock for external libraries

The problem is gmock already comes with a gtest implementation, so adding both in the CMAKE creates a conflict. Hence, i

2022-09-06 05:32:59 -0500 asked a question Can not set breakpoints when debugging ros2 nodes

Can not set breakpoints when debugging ros2 nodes Hi, I am new using debuggers in ros2. I have used previously gdb in c

2022-07-30 22:51:32 -0500 received badge  Notable Question (source)
2022-07-28 12:36:48 -0500 received badge  Necromancer (source)
2022-06-10 22:46:33 -0500 received badge  Popular Question (source)
2022-06-07 07:31:59 -0500 asked a question ROS2 gmock for external libraries

ROS2 gmock for external libraries Hi all, I am trying to implement unit testing in my ROS2 project. I used to work with

2022-06-07 06:09:13 -0500 commented question How to create a mock publisher in ROS2 using gmock?

Hey, I am trying to use gmock to mock some calls to rclcpp, something very similar to what you were doing. Did you solve

2022-06-07 06:07:56 -0500 answered a question How to create a mock publisher in ROS2 using gmock?

Hey, I am trying to add gmock to my ros2 development to be able to test classes containing calls to rclcpp functions lik

2022-05-11 10:32:51 -0500 commented answer Intel realsense d435i - ros - rtabmap, slam gets lost if camera is moved slightly faster

Fantastic, glad to help. If you think that the answer was good enough, please mark the green tick so that it get ranked

2022-05-05 04:36:42 -0500 answered a question ImportError: No module named rospkg

None of the above solutions worked for me. I changed several times the python version and nothing. The only thing that w

2022-05-05 03:08:54 -0500 edited answer Intel realsense d435i - ros - rtabmap, slam gets lost if camera is moved slightly faster

Hi, after some tests I have found what it seems a pretty stable version of the system. The key is to use the two IR of t

2022-05-05 03:08:12 -0500 edited answer Intel realsense d435i - ros - rtabmap, slam gets lost if camera is moved slightly faster

Hi, after some tests I have found what it seems a pretty stable version of the system. The key is to use the two IR of t

2022-05-05 03:07:18 -0500 answered a question Intel realsense d435i - ros - rtabmap, slam gets lost if camera is moved slightly faster

Hi, After some tests I have found what it seems a pretty stable version of the system. The key is to use the two IR of t

2022-05-04 06:42:44 -0500 commented question Intel realsense d435i - ros - rtabmap, slam gets lost if camera is moved slightly faster

Hi, The same happens to me. I am guessing it is a divergence problem of the ufk filter. When visual odometry is lost, t

2021-10-11 07:40:35 -0500 commented answer How to turn the robot before moving to goal?

I have a diff robot, we are working with teb and it works perfectly. I know in the past they tryied dwa and where having

2021-10-11 05:47:17 -0500 commented answer How to turn the robot before moving to goal?

But you said you want to turn over yourself? That's not possible with a non-holonomic robot, is it? A car can not turn o

2021-10-11 05:47:17 -0500 received badge  Commentator
2021-10-11 05:36:32 -0500 answered a question How Do i Run My Own Program

You should start with the ROS tutorials to understand how topics, services and actions work. Depending on how are you go

2021-10-11 05:36:32 -0500 received badge  Rapid Responder (source)
2021-10-11 05:32:21 -0500 commented question Integration Testing: Rostest with non-Catkin Packages (MAVROS and PX4)

My experience with catkin tests is that they have a lot of problems with external resources since they don't load paths

2021-10-11 05:23:54 -0500 commented question Create a plot with x and y coordinates

I think your question needs a bit more context. If you are receiving the data from your robot (including x and y) then i

2021-10-11 05:16:14 -0500 edited answer How to turn the robot before moving to goal?

Hi, This behavior is expected since ROS has no way of knowing if your robot is holonomic (all the degrees of movement a

2021-10-11 05:15:11 -0500 received badge  Rapid Responder (source)
2021-10-11 05:15:11 -0500 answered a question How to turn the robot before moving to goal?

Hi, This behavior is normal since ROS has no way of knowing if your robot is holonomic (all the degrees of movement are

2021-09-27 07:42:02 -0500 edited answer Is it possible to navigate robot without global costmap? How

Hi, yes it is definitely possible. You can set up goals in x,y, theta (from the origin where you started the mission) an

2021-09-27 07:40:38 -0500 answered a question Is it possible to navigate robot without global costmap? How

Hi, yes it is definitely possible. You can set up goals in x,y (from the origin where you started the mission) and the r