Ease tablet interaction — EnforceTabletReachability ¶
In this tutorial, we will use EnforceTabletReachability in order to make Pepper reduce his movements, and therefore ease user interaction on the tablet.
Before stepping in this tutorial, you should:
- Be familiar with the Action notion. For further details, see: Running Actions on Pepper.
- Be familiar with the
Sayaction. For further details, see: Hello human!.
- Be familiar with the notion of
Future. For further details, see: Chaining operations.
Let’s start a new project
- Start a new project, let’s call it TabletReachabilityPepper.
- Robotify it and make sure it implements the QiSDK & the Robot Life Cycle.
For further details, see: Creating a robot application.
Creating an EnforceTabletReachability action¶
In this section, we will see how to create an EnforceTabletReachability action.
Start by storing the following fields in your
Then, put the following code in the
In order to observe the effect of EnforceTabletReachability, we will make Pepper talk when his tablet reaches
the wanted position. To do so, add the following field in your
And add tho following code in the same
Think about cleaning the qiContext field and set listeners in the
Running the action¶
In this section, we will see how to run the EnforceTabletReachability action.
Start by storing this following fields in your
Then, create a
startEnforceTabletReachability() method in your
Calling this method will run the EnforceTabletReachability action asynchronously. We
also added code to make Pepper talk when the action is done. This will allow us to observe
the difference in Pepper’s movements when the action is running or not.
However, let’s not forget to initialize this say action in the
Stopping the action¶
Add this simple
stopEnforceTabletReachability to your
Calling this method will stop the EnforceTabletReachability action that is running.
Let’s test our code using a button:
The following code is just a quick way to test the functionality, this is not what you would do in a real application.
In the activity_main.xml layout file, add the following
<Button android:id="@+id/tablet_reachability_button" android:layout_width="wrap_content" android:layout_height="wrap_content" android:text="Enforce tablet reachability"/>
onCreate method, add the following code:
Clicking on the button will either start or stop the EnforceTabletReachability action, accordingly to its running state.
Let’s try it¶
The sources for this tutorial are available on GitHub.
Install and run the application.
For further details, see: Running an application.
Choose “Enforce tablet reachability”.
Notice that Pepper moves his arms and torso while talking.
|Click on the button and the robot will reduce his movements, easing tablet interaction.|
Click again on the button and the robot will go back to his previous state.
You are now able to ease tablet interaction on Pepper!