Files
J1B4-Fitbot/docs/documentation/android/pepper_handling.md
2024-06-04 14:42:30 +02:00

38 lines
1.5 KiB
Markdown

## Pepper Handling
---
To make the handling of the Pepper robot easier, we've made some classes
that can be used to interact with the robot.
The classes associated with the Pepper robot interaction are located in the
`com.example.fitbot.pepper` package. To start interacting with the Pepper robot,
one must assign a `QiContext` first. This can be done by calling `Pepper.provideQiContext(QiContext context)`
method. This method takes a `QiContext` object as a parameter. This object is used to interact with the robot.
To make the robot talk, one can call the following method:
```java
Pepper.say(String text);
```
To make the robot execute an animation, one can call the following method:
```java
Pepper.animate(String animationName);
```
To make the robot do more sophisticated things, one can call the
```java
Pepper.addToEventQueue(AbstractPepperActionEvent event);
```
This adds the provided event to the event queue. The event will be executed in the order it was added.
Whenever there's no valid QiContext available to use, the event will maintain in the queue until one is
provided.
*Note* All Pepper action events are added to a queue, and executed synchronously. This means
that if the robot is still busy with a task, adding a new event to the queue will not do anything until
the robot is done with the current task.
Currently, the only supported actions are:
- `PepperSpeechEvent` - This event makes the robot say something.
- `PepperAnimationEvent` - This event makes the robot execute an animation.