python rospkg can't find all my packages

asked 2020-09-20 23:07:17 -0600

borgcons gravatar image

updated 2020-09-21 02:41:43 -0600

gvdhoorn gravatar image

The ROS command line tools seems to work just fine. Why doesn't the python script show all the packages and why doesn't it give me a version number?

test.py

#!/usr/bin/python
import rospkg
ros_root = rospkg.get_ros_root()
print ("ROS root is " , ros_root)
p = rospkg.get_ros_paths()
print("ROS paths ", p)
l = rospkg.RosStack().list()
print ("List of packages is " , l)
v = rospkg.RosStack().get_stack_version('common_msgs')
print ("Version is " , v)

Running it:

$ test.py  
('ROS root is ', '/opt/ros/kinetic/share/ros')  
('ROS paths ', ['/opt/ros/kinetic/share/ros', '/home/cellula/auv/src', '/opt/ros/kinetic/share'])  
('List of packages is ', ['gazebo_ros_pkgs', 'ros_tutorials', 'nodelet_core', 'geometry_tutorials', 'roscpp_core', 'viz', 'ros', 'vision_opencv', 'perception_pcl', 'rqt_common_plugins', 'image_pipeline', 'desktop', 'rqt_robot_plugins', 'ros_base', 'image_common', 'ros_core', 'perception', 'bond_core', 'common_tutorials', 'ros_comm', 'simulators', 'executive_smach', 'common_msgs', 'image_transport_plugins', 'robot_model', 'visualization_tutorials', 'laser_pipeline', 'robot', 'geometry', 'diagnostics', 'desktop_full'])  
('Version is ', None)

rospack list:

actionlib /opt/ros/kinetic/share/actionlib  
actionlib_msgs /opt/ros/kinetic/share/actionlib_msgs  
actionlib_tutorials /opt/ros/kinetic/share/actionlib_tutorials  
advnav_fog /home/cellula/auv/src/advnav_fog  
angles /opt/ros/kinetic/share/angles  
bond /opt/ros/kinetic/share/bond  
bondcpp /opt/ros/kinetic/share/bondcpp  
bondpy /opt/ros/kinetic/share/bondpy  
camera_calibration /opt/ros/kinetic/share/camera_calibration  
camera_calibration_parsers /opt/ros/kinetic/share/camera_calibration_parsers  
camera_info_manager /opt/ros/kinetic/share/camera_info_manager  
catkin /opt/ros/kinetic/share/catkin  
class_loader /opt/ros/kinetic/share/class_loader  
cmake_modules /opt/ros/kinetic/share/cmake_modules  
collada_parser /opt/ros/kinetic/share/collada_parser  
collada_urdf /opt/ros/kinetic/share/collada_urdf  
compressed_depth_image_transport /opt/ros/kinetic/share/compressed_depth_image_transport  
compressed_image_transport /opt/ros/kinetic/share/compressed_image_transport  
control_msgs /opt/ros/kinetic/share/control_msgs  
cpp_common /opt/ros/kinetic/share/cpp_common  
crl_cmn /home/cellula/auv/src/crl_cmn  
crl_comms /home/cellula/auv/src/crl_comms  
crl_distributed_io /home/cellula/auv/src/crl_distributed_io  
crl_logic /home/cellula/auv/src/crl_logic  
crl_motion_controllers /home/cellula/auv/src/crl_motion_controllers  
crl_msgs /home/cellula/auv/src/crl_msgs  
crl_navigation /home/cellula/auv/src/crl_navigation  
crl_wgfd6 /home/cellula/auv/src/crl_wgfd6  
cv_bridge /opt/ros/kinetic/share/cv_bridge  
depth_image_proc /opt/ros/kinetic/share/depth_image_proc  
diagnostic_aggregator /opt/ros/kinetic/share/diagnostic_aggregator  
diagnostic_analysis /opt/ros/kinetic/share/diagnostic_analysis  
diagnostic_common_diagnostics /opt/ros/kinetic/share/diagnostic_common_diagnostics  
diagnostic_msgs /opt/ros/kinetic/share/diagnostic_msgs  
diagnostic_updater /opt/ros/kinetic/share/diagnostic_updater  
diamond_ir104 /home/cellula/auv/src/diamond_ir104  
dynamic_reconfigure /opt/ros/kinetic/share/dynamic_reconfigure  
eigen_conversions /opt/ros/kinetic/share/eigen_conversions  
eigen_stl_containers /opt/ros/kinetic/share/eigen_stl_containers  
filters /opt/ros/kinetic/share/filters  
gazebo_dev /opt/ros/kinetic/share/gazebo_dev  
gazebo_msgs /opt/ros/kinetic/share/gazebo_msgs  
gazebo_plugins /opt/ros/kinetic/share/gazebo_plugins  
gazebo_ros /opt/ros/kinetic/share/gazebo_ros  
gencpp /opt/ros/kinetic/share/gencpp  
geneus /opt/ros/kinetic/share/geneus  
genlisp /opt/ros/kinetic/share/genlisp  
genmsg /opt/ros/kinetic/share/genmsg  
gennodejs /opt/ros/kinetic/share/gennodejs  
genpy /opt/ros/kinetic/share/genpy  
geometric_shapes /opt/ros/kinetic/share/geometric_shapes  
geometry_msgs /opt/ros/kinetic/share/geometry_msgs  
gl_dependency /opt/ros/kinetic/share/gl_dependency  
gnss_receiver /home/cellula/auv/src/gnss_receiver  
gps_common /home/cellula/auv/src/gps_umd/gps_common    
image_geometry /opt/ros/kinetic/share/image_geometry  
image_publisher /opt/ros/kinetic/share/image_publisher  
image_rotate /opt/ros/kinetic/share/image_rotate  
image_transport /opt/ros/kinetic/share/image_transport    
image_view /opt/ros/kinetic/share/image_view    
imagenex_837a ...
(more)
edit retag flag offensive close merge delete

Comments

1

You're calling rospkg.RosStack().list(), which appears to only return metapackages. rospack list returns packages, of which there are always more.

I haven't checked the code nor the documentation, so I'm not sure why RosStack() returns metapackages, but I can guess: stacks were like what metapackages are now. Perhaps as a form of bw compatibility, metapackages are returned as-if they were stacks.

gvdhoorn gravatar image gvdhoorn  ( 2020-09-21 02:46:41 -0600 )edit

metapackage version bit is a known issue https://github.com/ros-infrastructure...

v = rospkg.RosStack().get_stack_version('common_msgs')
print ("Version is " , v)
('Version is ', None)
130s gravatar image 130s  ( 2020-09-22 06:20:38 -0600 )edit