Please ask about problems and questions regarding this tutorial on answers.ros.org. Don't forget to include in your question the link to this page, the versions of your OS & ROS, and also add appropriate tags. |
Create your own task
Description: This tutorial explains how to create a task for the robot to executeTutorial Level:
Next Tutorial: Schedule your task in the continuous operation queue
Create a package
Start with creating a package with all the code and launch files to run your task. The package must depend on continuous_ops_task_manager, otherwise the task manager won't be able to find your task.
roscreate-pkg my_test_task continuous_ops_task_manager
Now add all your code and launch files to this package.
Task design
Launch file: A task is just a bunch of code that gets executed on the robot. All you need to provide is a single launch file. However, when that launch file gets launched, your task should not start by itself! The launch file should only bring up the nodes you need, but it should not trigger your task to start.
Action interface: The mechanism that will trigger your task is the action interface of you task. Every task must have an action server that handles continuous_ops_msgs/TaskAction. This action has an empty goal that makes implementation easy. You'll need to specify the namespace of the action in your task description (see below).
Create a task description
Each task has a task description file in the package folder. This file must have an extension .task. For example, you could call your file 'my_task_description.task':
name: 'My task name' description: 'Description of what this task does' launch_file: 'my_launch_file.launch' image_file: 'my_image_file.jpg' action_ns: 'my_action_ns'
A package can have more than one task specification.