kinu-garage / hut_10sqft

Computer setup tools for my own environment, and public discussion place holder.
2 stars 1 forks source link

Python package built in "ament_python" manner not resolving when built with colcon #660

Open 130s opened 2 years ago

130s commented 2 years ago

Using a sample pkg from ros2/examples repo, I am having the following trouble:

Experiment on a Docker container ``` $ export DIMG=ros:melodic-ros-base $ docker run --network host -it $DIMG bash # mkdir -p /cws2/src && git clone https://github.com/ros2/examples.git --depth 1 # cd /cws2 # mkdir .tmp && mv src/examples/ .tmp/ && cp -R .tmp/examples/rclpy/topics/minimal_publisher src/ # source /opt/ros/melodic/setup.bash # colcon build # source install/setup.bash root@130s-p50:/cws2# rospack find minimal_publisher [rospack] Error: package 'minimal_publisher' not found root@130s-p50:/cws2# rospack find examples_rclpy_minimal_publisher [rospack] Error: package 'examples_rclpy_minimal_publisher' not found # # rospack list actionlib /opt/ros/melodic/share/actionlib actionlib_msgs /opt/ros/melodic/share/actionlib_msgs bond /opt/ros/melodic/share/bond bondcpp /opt/ros/melodic/share/bondcpp bondpy /opt/ros/melodic/share/bondpy catkin /opt/ros/melodic/share/catkin class_loader /opt/ros/melodic/share/class_loader cmake_modules /opt/ros/melodic/share/cmake_modules cpp_common /opt/ros/melodic/share/cpp_common diagnostic_msgs /opt/ros/melodic/share/diagnostic_msgs dynamic_reconfigure /opt/ros/melodic/share/dynamic_reconfigure gencpp /opt/ros/melodic/share/gencpp geneus /opt/ros/melodic/share/geneus genlisp /opt/ros/melodic/share/genlisp genmsg /opt/ros/melodic/share/genmsg gennodejs /opt/ros/melodic/share/gennodejs genpy /opt/ros/melodic/share/genpy geometry_msgs /opt/ros/melodic/share/geometry_msgs message_filters /opt/ros/melodic/share/message_filters message_generation /opt/ros/melodic/share/message_generation message_runtime /opt/ros/melodic/share/message_runtime mk /opt/ros/melodic/share/mk nav_msgs /opt/ros/melodic/share/nav_msgs nodelet /opt/ros/melodic/share/nodelet nodelet_topic_tools /opt/ros/melodic/share/nodelet_topic_tools pluginlib /opt/ros/melodic/share/pluginlib ros_environment /opt/ros/melodic/share/ros_environment rosbag /opt/ros/melodic/share/rosbag rosbag_migration_rule /opt/ros/melodic/share/rosbag_migration_rule rosbag_storage /opt/ros/melodic/share/rosbag_storage rosbash /opt/ros/melodic/share/rosbash rosboost_cfg /opt/ros/melodic/share/rosboost_cfg rosbuild /opt/ros/melodic/share/rosbuild rosclean /opt/ros/melodic/share/rosclean rosconsole /opt/ros/melodic/share/rosconsole rosconsole_bridge /opt/ros/melodic/share/rosconsole_bridge roscpp /opt/ros/melodic/share/roscpp roscpp_serialization /opt/ros/melodic/share/roscpp_serialization roscpp_traits /opt/ros/melodic/share/roscpp_traits roscreate /opt/ros/melodic/share/roscreate rosgraph /opt/ros/melodic/share/rosgraph rosgraph_msgs /opt/ros/melodic/share/rosgraph_msgs roslang /opt/ros/melodic/share/roslang roslaunch /opt/ros/melodic/share/roslaunch roslib /opt/ros/melodic/share/roslib roslisp /opt/ros/melodic/share/roslisp roslz4 /opt/ros/melodic/share/roslz4 rosmake /opt/ros/melodic/share/rosmake rosmaster /opt/ros/melodic/share/rosmaster rosmsg /opt/ros/melodic/share/rosmsg rosnode /opt/ros/melodic/share/rosnode rosout /opt/ros/melodic/share/rosout rospack /opt/ros/melodic/share/rospack rosparam /opt/ros/melodic/share/rosparam rospy /opt/ros/melodic/share/rospy rosservice /opt/ros/melodic/share/rosservice rostest /opt/ros/melodic/share/rostest rostime /opt/ros/melodic/share/rostime rostopic /opt/ros/melodic/share/rostopic rosunit /opt/ros/melodic/share/rosunit roswtf /opt/ros/melodic/share/roswtf sensor_msgs /opt/ros/melodic/share/sensor_msgs shape_msgs /opt/ros/melodic/share/shape_msgs smclib /opt/ros/melodic/share/smclib std_msgs /opt/ros/melodic/share/std_msgs std_srvs /opt/ros/melodic/share/std_srvs stereo_msgs /opt/ros/melodic/share/stereo_msgs topic_tools /opt/ros/melodic/share/topic_tools trajectory_msgs /opt/ros/melodic/share/trajectory_msgs visualization_msgs /opt/ros/melodic/share/visualization_msgs xmlrpcpp /opt/ros/melodic/share/xmlrpcpp # # echo $PYTHONPATH /cws2/install/examples_rclpy_minimal_publisher/lib/python3.6/site-packages:/opt/ros/melodic/lib/python2.7/dist-packages root@130s-p50:/cws2# ```

I do have found in some places where people seemed to be confused about building their own Python packages either in ROS2, and/or with colcon. So this may be something the community is missing?

130s commented 2 years ago

Btw, for mixing ros1 and ros2 Python packages on a single repo, I found this page On the mixing of ament and catkin (catment) (docs.ros.org), which doesn't seem to provide an easy, established way of mixing catkin/ROS1 packages and ament/ROS2 packages. I may re-review the doc, but for now I'm getting desperate about the mix on a single repo.

130s commented 2 years ago

For now for my monitoring_tools work, I'm switching the Python packaging to Catkin-based approach and see if that still works with colcon.

I think I do like ament_python approach better for the following points, but the lack of central instruction is causing me a pain and I don't have time to experiment with it.

130s commented 2 years ago

I'm getting this hypothesis:

To be proven.