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

Getting error after calling a service in eloquent

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

mirella melo gravatar image

Hi!

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

 #request
 bool global
 bool optimized
 bool graph_only
 ---
 #response

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/cli.py", line 69, in main
    rc = extension.main(parser=parser, args=args)
File "/opt/ros/eloquent/lib/python3.6/site-packages/ros2service/command/service.py", line 43, in main
    return extension.main(args=args)
File "/opt/ros/eloquent/lib/python3.6/site-packages/ros2service/verb/call.py", line 59, in main
    args.service_type, args.service_name, args.values, period)
File "/opt/ros/eloquent/lib/python3.6/site-packages/ros2service/verb/call.py", line 69, in requester
    module = importlib.import_module('.'.join(parts[:-1]))
File "/usr/lib/python3.6/importlib/__init__.py", 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/__init__.py", 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/_get_map.py", line 77
    self.global = 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
0

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

Comments

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

Question Tools

1 follower

Stats

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

Seen: 218 times

Last updated: Dec 02 '20