ROS Resources: Documentation | Support | Discussion Forum | Index | Service Status | ros @ Robotics Stack Exchange
Ask Your Question
0

Cannot import custom rosmsg (actionlib)

asked 2019-12-17 08:03:43 -0600

Yehor gravatar image

updated 2022-01-22 16:10:13 -0600

Evgeny gravatar image

Hi,

I have very strange problem related to my custom action msg. I compiled my msg, but I can't import it. When I try to run my py action server I am getting next error:

raceback (most recent call last):
File "/home/ivan/infocom_robotics_ws/src/dock_station_goal/src/turn_for_specific_angle_server.py", line 5, in <module> from dock_station_goal.msg import DoTurnAction, DoTurnFeedback, DoTurnResult ImportError: No module named msg

But I can at the same time I can find my msg with: rosmsg list | grep DoTurn

ivan@ivan-desktop:~$ rosmsg list | grep DoTurn

dock_station_goal/DoTurnAction dock_station_goal/DoTurnActionFeedback dock_station_goal/DoTurnActionGoal dock_station_goal/DoTurnActionResult dock_station_goal/DoTurnFeedback dock_station_goal/DoTurnGoal dock_station_goal/DoTurnResult ivan@ivan-desktop:~$

Another strange thing is that when I am checking: rosmsg packages, the pkgs with my custom msgs are doubled:

ivan@ivan-desktop:~$ rosmsg packages

actionlib actionlib_msgs actionlib_tutorials base_local_planner beginner_tutorials beginner_tutorials bond control_msgs costmap_2d diagnostic_msgs dock_station_goal dock_station_goal dynamic_reconfigure geometry_msgs map_msgs move_base_msgs nav_msgs realsense2_camera robot_drive roscpp rosgraph_msgs rospy_tutorials rosserial_msgs sensor_msgs shape_msgs smach_msgs std_msgs stereo_msgs tf tf2_msgs trajectory_msgs turtle_actionlib turtlebot3_msgs turtlebot_msgs turtlesim visualization_msgs

You can see that beginner_tutorials and dock_station_goal are doubled

I am stack and getting crazy((( Can somebody help me?

Thank you!

EDIT

I am using catkin_make, the output of $ROS_PACKAGE_PATH is:

/home/ivan/infocom_robotics_ws/src:/opt/ros/melodic/share

And my Cmake list is:

cmake_minimum_required(VERSION 2.8.3) project(dock_station_goal)

find_package(catkin REQUIRED COMPONENTS message_generation
actionlib actionlib_msgs
move_base_msgs roscpp rospy
std_msgs genmsg )

add_action_files( DIRECTORY action FILES DoDocking.action
DoTurn.action )

generate_messages( DEPENDENCIES
std_msgs actionlib_msgs )

catkin_package( LIBRARIES dock_station_goal CATKIN_DEPENDS move_base_msgs roscpp rospy std_msgs actionlib_msgs DEPENDS system_lib
DEPENDS message_runtime )

include_directories(
${catkin_INCLUDE_DIRS} )

${catkin_EXPORTED_TARGETS})

${catkin_EXPORTED_TARGETS})

edit retag flag offensive close merge delete

Comments

Another weird thing is that I can import my msg from /home/usr/my_ws by running python! But I cant import from my_pkg/src

Yehor gravatar image Yehor  ( 2019-12-17 08:07:57 -0600 )edit

Could you please edit your post and provide the following information:

  • the CMakeLists.txt of your package (remove all comments, though),
  • the build tool you use (catkin_make or catkin_tools / catkin build)
  • the output of echo $ROS_PACKAGE_PATH
  • if possible, a link to your package source code (GitHub or similar)
mgruhler gravatar image mgruhler  ( 2019-12-17 08:44:00 -0600 )edit

@mgruhler I edited my post

Unfortunately I don't have this project on a github

Yehor gravatar image Yehor  ( 2019-12-17 08:59:54 -0600 )edit

1 Answer

Sort by ยป oldest newest most voted
0

answered 2019-12-17 09:39:59 -0600

Yehor gravatar image

Sorry, it was my fail. I had the file with the same name as pkg in that folder and didn't notice that. Thank you for the response.

I will delete the question

edit flag offensive delete link more

Comments

I will delete the question

I've undeleted your question, as it is a valid question.

The fact that it has a "trivial" answer does not change this.

I've also accepted your comment as the answer.

gvdhoorn gravatar image gvdhoorn  ( 2019-12-17 14:26:01 -0600 )edit

Question Tools

2 followers

Stats

Asked: 2019-12-17 08:03:43 -0600

Seen: 623 times

Last updated: Dec 17 '19