Skip to content

Initial implementation - #1

Merged
esteve merged 1 commit into
masterfrom
initial
Feb 17, 2016
Merged

esteve merged 1 commit into
masterfrom
initial

Conversation

@esteve

@esteve esteve commented Jan 29, 2016

Copy link
Copy Markdown
Member

This is an initial implementation of rclpy.

Depends on ros2/rosidl#73

@esteve

esteve commented Jan 29, 2016

Copy link
Copy Markdown
Member Author

There's a bug in setup.py in which sometimes it cannot import ament_index_python. I think the dependencies in package.xml seem to be fine, but I haven't been able to find what's causing the issue.

Also, the examples currently fail with this error:

[rmw|error_handling.c:39] error string being overwritten: type support handle implementation 
'introspection_c'(0x7f7241be56b1) does not match rmw implementation 
'introspection_cpp'(0x7f724463c691), at /home/esteve/Projects/ros2/ros2_ws/src/ros2/rmw_connext
/rmw_connext_dynamic_cpp/src/functions.cpp:397

@wjwwood mentioned that he recently worked on C type support and found a solution to a problem, but I don't know if it's the same as this. Hopefully it is and I can fix it 😄

@tfoote tfoote added the in progress Actively being worked on (Kanban column) label Feb 2, 2016
@esteve esteve added in review Waiting for review (Kanban column) and removed in progress Actively being worked on (Kanban column) labels Feb 12, 2016
@tfoote

tfoote commented Feb 12, 2016

Copy link
Copy Markdown
Contributor

lgtm

It's unfortunate that the most complicated part of this pull request is the python finding. Is there a way to run ci on this?

@jackieokay

Copy link
Copy Markdown
Contributor

With ros2/ros2#191, the typesupport branch (rclpy-conversion-functions), and a test that exercises the Python API, we could test this branch on CI.

Comment thread src/rclpy/_rclpy.c.in Outdated
publisher->impl = NULL;
rcl_publisher_options_t publisher_ops = rcl_publisher_get_default_options();
rcl_ret_t ret = rcl_publisher_init(publisher, node, ts, topic, &publisher_ops);
(void)ret;

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

The function warns for not checking the return value for a reason. Instead of silencing the warning here I think it should either not catch the return value (and result in a compiler warning) or this needs a TODO.

Same below.

@dirk-thomas

Copy link
Copy Markdown
Member

More then 150 lines in the CMakeLists.txt file seem to be identical to the CMake in rosidl_generator_py. Instead of copy-n-paste this code block should be reused and only exist once.

Comment thread CMakeLists.txt Outdated
LIBRARY_OUTPUT_DIRECTORY_MINSIZEREL "${CMAKE_CURRENT_BINARY_DIR}/${PROJECT_NAME}"
RUNTIME_OUTPUT_DIRECTORY_MINSIZEREL "${CMAKE_CURRENT_BINARY_DIR}/${PROJECT_NAME}"
OUTPUT_NAME "_${PROJECT_NAME}${target_suffix}${PYTHON_EXTENSION_SUFFIX}"
SUFFIX "${PYTHON_EXTENSION_EXTENSION}")

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

The five set_target_properties calls are almost identical and should be refactored into a function to avoid code duplication.

@esteve

esteve commented Feb 16, 2016

Copy link
Copy Markdown
Member Author

@dirk-thomas agreed. Any suggestion where these lines should go? Into ament_python?

Comment thread rclpy/__init__.py
# See the License for the specific language governing permissions and
# limitations under the License.

import rclpy._rclpy__rmw_opensplice_cpp as _rclpy

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

How is this supposed to be exposed in the future?

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

@esteve Can you please comment on this question?

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

@esteve ping

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

Sorry, I forgot about this, thanks for the reminder. I imagine that in the future, we could have a CMake-generated Python module that has all the available typesupport implementations and rclpy just tries each of one. For example, let's say we have a typesuport_impls.py.in that gets populated with the typesupport implementations for OpenSplice, Connext static, Connext dynamic, etc. and they are exposed through the rclpy API. If the user does not pick an implementation (via a global function, e.g. rclpy.set_typesupport_implementation), the first one in typesupport_impls.py is picked.

@dirk-thomas

Copy link
Copy Markdown
Member

I don't think any ament package is a good location for this logic since it simply doesn't know what might be needed downstream. Instead it should be somewhere specific to the Python generator and client library in ROS. I don't see a good common package both of them depend on (since the client library doesn't depend on the generator). Maybe a new package which both then depend on?

@esteve

esteve commented Feb 16, 2016

Copy link
Copy Markdown
Member Author

@dirk-thomas makes sense, I'll look into that. Thanks!

@tfoote tfoote added in progress Actively being worked on (Kanban column) and removed in review Waiting for review (Kanban column) labels Feb 16, 2016
@esteve

esteve commented Feb 17, 2016

Copy link
Copy Markdown
Member Author

@dirk-thomas after merging your PR, I can't get this to install the native extensions properly. PYTHON_INSTALL_DIR in https://github.com/ros2/rclpy/blob/initial/rclpy/CMakeLists.txt#L74 is not defined. PYTHON_INSTALL_DIR is defined in https://github.com/ament/ament_cmake/blob/master/ament_cmake_python/ament_cmake_python-extras.cmake#L37 but since it's a private macro, it's best not to call _ament_cmake_python_get_python_install_dir, right? What would be the best way to install the extension? Thanks!

@dirk-thomas

Copy link
Copy Markdown
Member

Calling ament_python_install_package before the custom macro will make sure that the variable is set. I guess during testing it came from the CMakeCache which is the reason why it doesn't work for a first-time build now.

@dirk-thomas

Copy link
Copy Markdown
Member

The new package can not be in this repo though since that would result in a circular dependency on the repository level:

  • rclpy:rclpy -> rosidl:rosidl_generator_py
  • rosidl:rosidl_generator_py -> rclpy:python_cmake_module

To avoid that it needs to be in the rosidl repo.

@esteve

esteve commented Feb 17, 2016

Copy link
Copy Markdown
Member Author

@dirk-thomas thanks for the suggestion, moving the package right now.

@esteve esteve added in review Waiting for review (Kanban column) and removed in progress Actively being worked on (Kanban column) labels Feb 17, 2016
esteve added a commit that referenced this pull request Feb 17, 2016
Initial implementation of the Python client API
@esteve
esteve merged commit d435784 into master Feb 17, 2016
@esteve
esteve deleted the initial branch February 17, 2016 05:35
@esteve esteve removed the in review Waiting for review (Kanban column) label Feb 17, 2016
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants