Skip to content

conversion functions from .msg / .srv to .idl#324

Merged
dirk-thomas merged 2 commits intomasterfrom
idl-stage-3
Nov 15, 2018
Merged

conversion functions from .msg / .srv to .idl#324
dirk-thomas merged 2 commits intomasterfrom
idl-stage-3

Conversation

@dirk-thomas
Copy link
Copy Markdown
Member

This is the third PR integrating #298 step-by-step.

Builds on top of #323.

Since the functionality provided by this patch isn't actively being used yet there isn't a point in running CI.

The command line script msg2idl.py and srv2idl.py can be used to manually convert .msg / .srv files.

@dirk-thomas dirk-thomas added enhancement New feature or request in review Waiting for review (Kanban column) labels Nov 15, 2018
@dirk-thomas dirk-thomas self-assigned this Nov 15, 2018
@dirk-thomas dirk-thomas requested a review from sloretz November 15, 2018 00:00
Copy link
Copy Markdown
Member

@mjcarroll mjcarroll left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think the only thing that was unexpected is that the scripts had to be run from the package folder.

# Fails
 src/ros2/common_interfaces $ ros2 run rosidl_adapter srv2idl.py ./sensor_msgs/srv/SetCameraInfo.srv
# Succeeds
ros2/common_interfaces/sensor_msgs $ ros2 run rosidl_adapter srv2idl.py ./srv/SetCameraInfo.srv

A short doc or more informative error would be helpful in this case.

@dirk-thomas
Copy link
Copy Markdown
Member Author

I think the only thing that was unexpected is that the scripts had to be run from the package folder.

That is weird. It worked for me with arbitrary paths independent of the cwd. Can you please share your output when it fails.

@mjcarroll
Copy link
Copy Markdown
Member

ros2_ws)➜  common_interfaces git:(master) ros2 run rosidl_adapter srv2idl.py ./sensor_msgs/srv/SetCameraInfo.srv
Reading input file: sensor_msgs/srv/SetCameraInfo.srv
Traceback (most recent call last):
  File "/home/michael/workspaces/ros2_ws/install/rosidl_adapter/lib/rosidl_adapter/srv2idl.py", line 22, in <module>
    convert_files_to_idl('.srv', convert_srv_to_idl)
  File "/home/michael/workspaces/ros2_ws/install/rosidl_adapter/lib/python3.6/site-packages/rosidl_adapter/cli.py", line 48, in convert_files_to_idl
    package_dir, pkg.name, interface_file, interface_file.parent)
  File "/home/michael/workspaces/ros2_ws/install/rosidl_adapter/lib/python3.6/site-packages/rosidl_adapter/srv/__init__.py", line 26, in convert_srv_to_idl
    content = abs_input_file.read_text(encoding='utf-8')
  File "/usr/lib/python3.6/pathlib.py", line 1194, in read_text
    with self.open(mode='r', encoding=encoding, errors=errors) as f:
  File "/usr/lib/python3.6/pathlib.py", line 1181, in open
    opener=self._opener)
  File "/usr/lib/python3.6/pathlib.py", line 1035, in _opener
    return self._accessor.open(self, flags, mode)
  File "/usr/lib/python3.6/pathlib.py", line 387, in wrapped
    return strfunc(str(pathobj), *args)
FileNotFoundError: [Errno 2] No such file or directory: '/home/michael/workspaces/ros2_ws/src/ros2/common_interfaces/sensor_msgs/sensor_msgs/srv/SetCameraInfo.srv'

@dirk-thomas
Copy link
Copy Markdown
Member Author

I was able to reproduce the problem. It should be fixed in 9d2cd71.

@dirk-thomas dirk-thomas dismissed mjcarroll’s stale review November 15, 2018 16:52

Please retry with the current state

@dirk-thomas dirk-thomas merged commit db5ba54 into master Nov 15, 2018
@dirk-thomas dirk-thomas deleted the idl-stage-3 branch November 15, 2018 17:19
@dirk-thomas dirk-thomas removed the in review Waiting for review (Kanban column) label Nov 15, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants