Ask Your Question

Getting error after calling a service in eloquent

asked 2020-12-02 16:10:44 -0600

mirella melo gravatar image


I`m trying to use a Rtabmap service, which is defined as follows:

 bool global
 bool optimized
 bool graph_only

Then, I call:

 ros2 service call /publish_map rtabmap_ros/srv/PublishMap "{global: 1, optimized: 1, graph_only: 0}"

But it returns:

Traceback (most recent call last):
File "/opt/ros/eloquent/bin/ros2", line 11, in <module>
    load_entry_point('ros2cli==0.8.7', 'console_scripts', 'ros2')()
File "/opt/ros/eloquent/lib/python3.6/site-packages/ros2cli/", line 69, in main
    rc = extension.main(parser=parser, args=args)
File "/opt/ros/eloquent/lib/python3.6/site-packages/ros2service/command/", line 43, in main
    return extension.main(args=args)
File "/opt/ros/eloquent/lib/python3.6/site-packages/ros2service/verb/", line 59, in main
    args.service_type, args.service_name, args.values, period)
File "/opt/ros/eloquent/lib/python3.6/site-packages/ros2service/verb/", line 69, in requester
    module = importlib.import_module('.'.join(parts[:-1]))
File "/usr/lib/python3.6/importlib/", line 126, in import_module
    return _bootstrap._gcd_import(name[level:], package, level)
File "<frozen importlib._bootstrap>", line 994, in _gcd_import
File "<frozen importlib._bootstrap>", line 971, in _find_and_load
File "<frozen importlib._bootstrap>", line 955, in _find_and_load_unlocked
File "<frozen importlib._bootstrap>", line 665, in _load_unlocked
File "<frozen importlib._bootstrap_external>", line 678, in exec_module
File "<frozen importlib._bootstrap>", line 219, in _call_with_frames_removed
File "/home/user/rtabmap_ros/install/rtabmap_ros/lib/python3.6/site-packages/rtabmap_ros/srv/", line 1, in <module>
    from rtabmap_ros.srv._get_map import GetMap  # noqa: F401
File "/home/user/rtabmap_ros/install/rtabmap_ros/lib/python3.6/site-packages/rtabmap_ros/srv/", line 77 = kwargs.get('global', bool())
SyntaxError: invalid syntax

Please, any idea why this is happening?

Thanks in advance!

edit retag flag offensive close merge delete

1 Answer

Sort by ยป oldest newest most voted

answered 2020-12-03 14:17:45 -0600

RobertWilbrandt gravatar image

Hey, the problem here seems to be the field name global used in the service definition. I could not find any ROS2 resource for this, but the ROS1 msg wiki said:

It is recommended that you avoid using field names that correspond to keywords in common languages -- although those names are legal, they create confusion as to how a field name is translated.

This seems to be exactly what is happening here. The ROS2 cli packages are written in python (this wasn't the case in ROS1), and global is a keyword in python. So IMO this looks like an issue in the rtabmap_ros package.

edit flag offensive delete link more


This makes sense! Hopefully, the Rtabmap team will fix it if this is the case. Thank you for your reply!!

mirella melo gravatar image mirella melo  ( 2020-12-03 20:24:13 -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

1 follower


Asked: 2020-12-02 16:10:44 -0600

Seen: 67 times

Last updated: Dec 02 '20