Understanding GoTo ¶
In this tutorial, we will make Pepper move, using the GoTo action.
Before stepping in this tutorial, you should be familiar with the action notion.
For further details, see: Running Actions on Pepper.
Let’s start a new project
- Start a new project, let’s call it GoToPepper.
- Robotify it and make sure it implements the QiSDK & the Robot Life Cycle.
For further details, see: Creating a robot application.
Moving Pepper around¶
Let’s see how to make Pepper move at a predefined location.
To do this, we need to create the position to go to.
Building the target frame¶
A Frame is a data which describes a spacial position.
Here we need to get the target frame: this is the location we want Pepper to go to.
To retrieve the target frame, we will first need to get the robot frame.
The robot frame is provided by a service called
We can retrieve it if we use the
getActuation method on the
Put the following code in the
Now we can get the robot frame:
Next, we create a 1 meter forward translation corresponding to the transform between the robot frame current location and the target frame:
We will now create the target frame.
Mapping service provides a method to create a
FreeFrame represents a location free to be placed anywhere, that does not
move when other frames move.
The global position of a
FreeFrame can be updated by applying a
Transform to a base
Frame. The timestamp is left to 0, to update
targetFrame relatively to the last known location of robotFrame.
We now have the target frame. We will use it to build the GoTo action.
Moving to the target frame¶
You can make Pepper move by using the GoTo interface.
Add a GoTo field in your
We will create a GoTo action with a
GoToBuilder in the
Do not forget to remove this listener on GoTo in the
We will now run the GoTo in the
And display a log trace indicating that the action finished with success or error:
Bonus: adjusting the max navigation speed¶
You can adjust the maximum navigation speed (in m/s) by using
GoTo creation by the following code:
For more details, see Tuning GoTo behavior.
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 “Step forward”.
You should observe the following:
You are now able to make Pepper move!