Ask Your Question

Revision history [back]

Hi @rozoalex,

The error is "probably" on your CMakeLists.txt, but since it wasn't provided, I'll show you the steps to make custom action from zero (which can be useful for more people), as shown in this video.

Since the name of your package is turtlebot3_console_controller and the action name is Motor.action, we are going to use the same names for simplicity.

1. Create the Catkin Workspace:

mkdir ~/catkin_ws/src/ -p
cd ~/catkin_ws/src/

2. Create your package named turtlebot3_console_controller that depends on the packages actionlib_msgs and std_msgs:

cd ~/catkin_ws/src/
catkin_create_pkg turtlebot3_console_controller actionlib_msgs std_msgs

3. Create the Motor.action on turtlebot3_console_controller/action:

cd ~/catkin_ws/src/
mkdir -p turtlebot3_console_controller/action
touch turtlebot3_console_controller/action/Motor.action

4. Add to Motor.action the content provided on the question:

# This is an action definition file, which has three parts: the goal
# the result, and the feedback.
# Part 1: the goal.
# The angle in degree the robot to turn, sent by client main
float64 angle
# Part 2: the result, sent by action server unpon completion
# How much time used
duration time_elapsed
# How many updates thrown in total
uint32 updates_n
# Part 3: the feedback,to be sent periodically by server
# The amount of time elapsed from the start
duration time_elapsed

5. Change add_action_files and generate_messages from turtlebot3_console_controller/CMakeLists.txt to be able to compile the action file. At the end, the CMakeLists.txt will be like we have below:

cmake_minimum_required(VERSION 2.8.3)

find_package(catkin REQUIRED COMPONENTS


   actionlib_msgs#   std_msgs

#  INCLUDE_DIRS include
#  LIBRARIES turtlebot3_console_controller
#  CATKIN_DEPENDS actionlib_msgs std_msgs
#  DEPENDS system_lib


6. Compile your package:

cd ~/catkin_ws/src/

Ok, now your custom action should be compiled.

To confirm it was compiled, you can create a test file named that just imports your custom action by following the steps below:

7. Create your test file named

cd ~/catkin_ws/src/
touch turtlebot3_console_controller/src/

8. Add the content below to

#! /usr/bin/env python

from turtlebot3_console_controller.msg import MotorGoal, MotorResult, MotorFeedback

print 'Ok, it worked!!!'

9. Run your to confirm your custom action was compiled without any problem.

rosrun turtlebot3_console_controller

After running you should seee the message "Ok, it worked!!!".

In the video mentioned at the beginning we just follow the steps described here.

Hope it helps.