Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Merged
merged 2 commits into from
Nov 15, 2018
Merged

Conversation

dirk-thomas
Copy link
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
Copy link
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
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
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
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