Ask Your Question
0

How to achieve launch service or topic in ROS2 TEST ?

asked 2018-05-24 00:50:08 -0600

RachelRen gravatar image

updated 2018-05-24 02:26:25 -0600

jayess gravatar image

Hi All,

I'm writing TEST for the company ROS2's project.I learned to launch service or topic via the .test file in ROS,but there is no .test file in ROS2 TEST.I don't know what kind of mechanism can launch service or topic in ROS2 TEST.

Additional information:I use

ament test --only-packages MY_PACKAGE_NAME

to run TEST. Thanks All

edit retag flag offensive close merge delete

1 Answer

Sort by ยป oldest newest most voted
0

answered 2018-07-05 16:04:35 -0600

marguedas gravatar image

updated 2018-07-06 07:04:29 -0600

The functionality you are referring to is provided by rostest in ROS 1.

There is currently no equivalent of rostest in ROS 2. Now that there is a new launch system in Bouncy, we should be closer to being able to add such functionality in ROS 2.

Currently the only ROS 2 tests running multiple processes are pytests using launch. Some examples can be found on the demos repository.

HTH,

EDIT:

I tried to launch processes in background in the ros2 test,but this way can't meet the expected requirements.

@RachelRen Can you clarify which ones are the requirements of your setup that are not met ? As a rostest port will "do the same thing" aka launching other nodes in different processes, I would expect the behavior to be similar as launching them with launch.

edit flag offensive delete link more

Comments

@marguedas Thank you very much.

I tried to launch processes in background in the ros2 test,but this way can't meet the expected requirements.I'm looking forward to this functionality to be added in ROS2 .

Thank you

RachelRen gravatar imageRachelRen ( 2018-07-06 03:33:20 -0600 )edit

@marguedas I'm sorry to comment too late.

I mean,when launching processes in background,the publisher don't publish data to the topic.It's really the phenomenon I have encountered.

Such as, after launch realsense_ros2_camera &,the subscriber can't call the callback. realsense_ros2_camera is OK

RachelRen gravatar imageRachelRen ( 2018-08-06 21:40:26 -0600 )edit

Can you provide a reproducible example involving only packages available in a standard ROS 2 installation?

I just tried: ./install_debug_isolated/demo_nodes_cpp/lib/demo_nodes_cpp/talker & and ros2 topic echo /chatter and couldn't reproduce the issue

marguedas gravatar imagemarguedas ( 2018-08-07 12:28:00 -0600 )edit
1

Hi ,

I have little different question on the same topic. I migrated .test file from ros1 into launch.py file in ros2 and able to test using

ros2 launch pkg-name filename.launch.py

But i want to do the same from CMakelist.txt with gtest, is it possible to do this? any help? Thanks.

poonam1120 gravatar imagepoonam1120 ( 2018-11-30 12:45:41 -0600 )edit

@poonam1120

Would you mind to introduce how you achieved the migrated .test file from ros1 into launch.py in ros2?

Thank you!

RachelRen gravatar imageRachelRen ( 2018-12-03 19:53:33 -0600 )edit

@poonam1120

Have you tried adding .py to CMakeLists.txt using ament_add_pytest_test?

RachelRen gravatar imageRachelRen ( 2018-12-03 20:12:31 -0600 )edit

@RachelRen, i have not tried using "ament_add_pytest_test" .. will give a try.

About migrating .test file into launch.py, I have referred the "test_launch_ros" from launch package ( master branch of ros2) .

thanks.

poonam1120 gravatar imagepoonam1120 ( 2018-12-04 00:26:39 -0600 )edit

I cannot find the source you are providing to look for the migration. Can you share the link? I am trying to put a test node into my normal launch file (with normal nodes) and I do not know how to do it in ROS2

hect1995 gravatar imagehect1995 ( 2019-07-29 03:57:02 -0600 )edit

Your Answer

Please start posting anonymously - your entry will be published after you log in or create a new account.

Add Answer

Question Tools

2 followers

Stats

Asked: 2018-05-24 00:45:21 -0600

Seen: 235 times

Last updated: Jul 06 '18