{{ name }}
====================

This is a custom implementation of the communication skill 'Say'.

What are the next steps?

## Compile and install the skill

You need a ROS 2 environment to compile the template.

You can for instance use PAL Robotics public 'tutorials' Docker image:

```
> docker pull palrobotics/public-tutorials-alum-devel
> docker run -it --name ros2_sandbox \
             -v <path to your workspace>:/home/user/exchange/ws \
             palrobotics/public-tutorials-alum-devel bash
```

Then, simply run:

```
> cd /home/user/exchange/ws
> colcon build
> source install/setup.bash
```

You can now start your skill with:

```
> ros2 launch {{id}} {{id}}.launch.py
```

## Testing

This basic skill template does not do much on this own. It simply
'says' (ie, outputs) on the terminal the input provided by user when
invoking the skill.

We can already check it works as intended:

Open a second terminal, and run:

```
ros2 action list
```

> Note: you can open a new terminal in the same Docker image with:
> ```
> docker exec -it ros2_sandbox bash
> ```

You should see your skill and its *control* action:

```
/skill/say
```


We can trigger the skill (from a third terminal):

```
ros2 action send_goal /skill/say communication_skills/action/Say "input: 'hello there'" 
```

You should get the following output:

```
Waiting for an action server to become available...
Sending goal:
     [...]
     input: hello there

Goal accepted with ID: a257b444a54d4f42911678d6f93e7e65

Result:
    result:
  error_code: 0
  error_msg: ''

Goal finished with status: SUCCEEDED
```

In the terminal where your skill is running, you should see:

```
[...]
[start_skill-1] [WARN] [1750164542.904816436] [{{id}}]: NEW MESSAGE TO USER: hello there
```

## Customize your skill

If you want to go ahead, and implement a real `Say` skill, using for instance a
custom TTS engine, have a look at `{{id}}/skill_impl.py`: this is the main file
you will have to modify.

## Install on the robot

**To deploy the code to the robot, you have to run the following commands from
*inside* your PAL OS Developer Docker image**.

- from within the PAL OS Developer Docker image, go to root of the project
- run `ros2 run pal_deploy deploy --package {{ id }} {{ robot | lower
  }}-XXc` (replace `{{ robot | lower }}-XXc` by your actual robot)

You can now `ssh` onto the robot (`ssh pal@{{ robot | lower }}-XXc`, password
`pal`), and go to your project: `cd ~/deployed_ws/share/{{ id }}`

## Run your application

`ssh` onto the robot (`ssh pal@{{ robot | lower }}-XXc`, password `pal`).

There are several ways to run the application:

1. Automatically launch the app and transition to an active state:

`ros2 launch {{ id }} {{ id }}.launch.py`

2. Manually start your skill:

`ros2 run {{ id }} start_skill`

3. Automatically start your application at startup:

To make your application run at startup, uncomment the related lines in
`setup.py` and reinstall the package. You can then start, stop or view the logs
of the application as a module. See [Application
management](https://docs.pal-robotics.com/edge/management/application-management)
for more details. 
