How to address 'action' ?

asked 2020-01-27 00:04:09 -0500

kane_choigo gravatar image

Hello, I'm working on ROS kinetic of Ubuntu 16.04.

I'm trying to test a simple action node, but I've faced a little trouble.

I made my custom action message named test1.action in ~/basic/action directory, in which basic is the name of package includes test1.action

Below is my main node:

#! /usr/bin/env python
import rospy
import time
import actionlib
from basic.msg import test1Action, test1Goal,test1Result, test1Feedback

index = 0.0

def feedback_callback(FEEDBACK):
    global index
    print 'Feedback: ',index
    index += 1

if __name__ == '__main__':
    action_server_name = '/test_action_server'

    client = actionlib.SimpleActionClient(action_server_name, test1Action)'Wait for action server...' + action_server_name)
    client.wait_for_server()'get action server...' + action_server_name)

    goal = test1Goal()
    goal.goal = 500

    client.send_goal(goal, feedback_cb = feedback_callback)
    rate = roapy.Rate(1)

    while not client.wait_for_result():"Doing stuff while waiting for the sersere")


And I always get the following error,

ImportError: No module named basic.msg

How can i troubleshoot this kind of error?

Do I have to make msg directory??

edit retag flag offensive close merge delete


No, but you have to properly specify the message in the CMakeLists.txt to create it by compiling this package. Have you done that?

If this solves your issue, great. If not, please edit your question and post the relevant content of your CMakeLIsts.txt (i.e. without any comments) as well as your .action file.

mgruhler gravatar image mgruhler  ( 2020-01-27 01:40:44 -0500 )edit