Goal - Make Pepper go somewhere. The robot will try to reach safely the target location, while avoiding obstacles.
// Get the target frame.
val targetFrame: Frame = ...
// Build the action.
val goTo: GoTo = GoToBuilder.with(qiContext)
.withFrame(targetFrame)
.build()
// Run the action synchronously.
goTo.run()
// Get the target frame.
Frame targetFrame = ...;
// Build the action.
GoTo goTo = GoToBuilder.with(qiContext)
.withFrame(targetFrame)
.build();
// Run the action synchronously.
goTo.run();
Typical usage - You want Pepper to find a path to reach a target location.
To use GoTo
, the pattern is:
Step | Action |
---|---|
Define the target location by retrieving or calculating a Frame. | |
Build the GoTo . |
|
Run the GoTo . |
When building the GoTo, it is possible to specify some parameters that will affect the GoTo Action running behavior. One can specify:
Options are:
GET_AROUND_OBSTACLES
policy (default): the robot
computes and follows the path that is the most likely to reach the target,
he may follow non-straight paths around obstacles.STRAIGHT_LINES_ONLY
policy: the robot first aligns with the target then goes
straight to it. If there is an obstacle in his way, he stops and does not
try to go around it.Options are:
FREE_ORIENTATION
policy (default): the GoTo does not control the robot
final orientation, it will only try to reach the target frame 2D position.ALIGN_X
policy: the GoTo finishes by aligning the robot frame X-Axis with
the target frame X-Axis.Make the robot go straight to a target, at 0.55 m/s, and align with the target X-axis at the end.
// Get the target frame.
val targetFrame: Frame = ...
// Build the action.
val goTo: GoTo = GoToBuilder.with(qiContext)
.withFrame(targetFrame)
.withPathPlanningPolicy(PathPlanningPolicy.STRAIGHT_LINES_ONLY)
.withFinalOrientationPolicy(OrientationPolicy.ALIGN_X)
.withMaxSpeed(0.55f)
.build()
// Run the action synchronously.
goTo.run()
// Get the target frame.
Frame targetFrame = ...;
// Build the action.
GoTo goTo = GoToBuilder.with(qiContext)
.withFrame(targetFrame)
.withPathPlanningPolicy(PathPlanningPolicy.STRAIGHT_LINES_ONLY)
.withFinalOrientationPolicy(OrientationPolicy.ALIGN_X)
.withMaxSpeed(0.55f)
.build();
// Run the action synchronously.
goTo.run();
You want Pepper to reach the point located one meter in front of him.
Retrieve the robot frame and define the target location relatively to Pepper current location:
val actuation: Actuation = qiContext.actuation
val robotFrame: Frame = actuation.robotFrame()
val transform: Transform = TransformBuilder.create().fromXTranslation(1.0)
val mapping: Mapping = qiContext.mapping
val targetFrame: FreeFrame = mapping.makeFreeFrame()
// Pass a 0-timestamp to publish target relatively to the
// last known location of robotFrame.
targetFrame.update(robotFrame, transform, 0L)
val goTo: GoTo = GoToBuilder.with(qiContext)
.withFrame(targetFrame.frame())
.build()
goTo.run()
Actuation actuation = qiContext.getActuation();
Frame robotFrame = actuation.robotFrame();
Transform transform = TransformBuilder.create().fromXTranslation(1);
Mapping mapping = qiContext.getMapping();
FreeFrame targetFrame = mapping.makeFreeFrame();
// Pass a 0-timestamp to publish target relatively to the
// last known location of robotFrame.
targetFrame.update(robotFrame, transform, 0L);
GoTo goTo = GoToBuilder.with(qiContext)
.withFrame(targetFrame.frame())
.build();
goTo.run();
Pepper is able to avoid obstacles while moving to a specific location. If there are obstacles on his way, he will try to get around them to reach his destination.
A target is assured to be reachable only if a path between the current robot location and the target location with a minimal clearance of 120 cm exists, and if it is located at least 50 cm away from obstacles.
Many elements of the environment are likely to disturb the robot and cause GoTo execution errors:
Knowing that, the developer must handle the occurrence of an error and determine, according to the use case, if the robot should abandon the task and express his current issue, or try again, and for how long or until which result.