最終更新:ID:HukTMs0QQA 2017年02月11日(土) 16:24:04履歴
Namespace: AL
#include <alproxies/alnavigationproxy.h>
class ALNavigationProxy
Pepperだけ
Navigation API:
- ALNavigationProxy::navigateTo
- ALNavigationProxy::moveAlong
- ALNavigationProxy::getFreeZone
- ALNavigationProxy::findFreeZone
- ALNavigationProxy::explore
- ALNavigationProxy::stopExploration
- ALNavigationProxy::saveExploration
- ALNavigationProxy::getMetricalMap
- ALNavigationProxy::navigateToInMap
- ALNavigationProxy::getRobotPositionInMap
- ALNavigationProxy::loadExploration
- ALNavigationProxy::relocalizeInMap
- ALNavigationProxy::startLocalization
- ALNavigationProxy::stopLocalization
bool ALNavigationProxy::navigateTo(const float& x, const float& y)
ロボットをFRAME_ROBOTで定義された総体的な目標地点pose2Dまでナビゲートします。ロボットは障害物を避けて経路を計算します。
ロボットは周囲の物体と衝突しないように高い確率で安全にナビゲートされます。例として、頭部カメラが障害物を検知した場合、経路を再計算するために動作を停止します。そのため、navigateToを行っている間は頭部を用いる動きがあるtimelineを実行することができません。
ALMotionProxy :: moveToとは異なり、ロボットは移動中に独自のパスと速度を選択できます。 ロボットが障害物に近づくほど速度は低下します。 障害物回避nの危険性が高くなった場合(セキュリティエリアに障害物が検出されるとすぐに)、ロボットはALNavigationProxy :: moveToのように停止します
目標はロボットから3mよりも近い位置になくてはなりません。ない場合は、ナビゲート指示は無視され、注意喚起されます。
This is a blocking call.
引数:
x – X軸における距離[m]
y – Y軸における距離[m]
戻り値:
True: ロボットが目標にたどり着いた場合、 False:障害物によってロボットが停止したもしくは目標までの経路を計算できなかった場合
navigationProxy.navigateTo(2.0, 0.0)
bool ALNavigationProxy::moveAlong(const AL::ALValue& trajectory)
引数:
trajectory –
ALValueは直接軌道[Holonomic、pathXY、finalTheta、finalTime]、または合成軌道["Composed"、direct trajectories]を記述しています。
pathXYは、2Dパスを記述するALValueであり、[“Composed”, direct paths]という構成で、直接パスまたは合成パスのどちらかです。
ダイレクトパスには、直線または円系の線であり、["Line"、[finalX、finalY]]、["Circle"、[centerX、centerY]、spanAngle]という形で構成されています。
戻り値:
True: ロボットが軌道動作指示を成功した場合、もしくは障害物によって確実に停止した場合。
次のコマンドは、ロボットを5秒間に1m移動させ、次に10秒間に1m移動させるという動作を停止なしで行います。
navigationProxy.moveAlong(["Composed", ["Holonomic", ["Line", [1.0, 0.0]], 0.0, 5.0], ["Holonomic", ["Line", [-1.0, 0.0
AL::ALValue ALNavigationProxy::getFreeZone(float desiredRadius, float displacementConstraint)
ロボットの周囲の動ける範囲を返します。この関数はロボットを動かしません。
引数:
desiredRadius – The radius of free space we want in meters.
displacementConstraint – The max distance we accept to move to reach the found place in meters.
戻り値:
ALValue [Free Zone Error Code, result radius (meters), [worldMotionToRobotCenterX (meters), worldMotionToRobotCenterY (meters)]]
qi::Future<AL::ALValue> ALNavigationProxy::findFreeZone(float desiredRadius, float displacementConstraint)
Looks for a free circular zone of a specified radius not farer than a specified displacement. To do this the robot moves and looks around itself. This is a blocking call.
指定された半径よりも狭い範囲で自由に動ける円形ゾーンを探します。 その際、ロボットは動いて周囲を確認します。 これはブロッキングコールであり、処理が完了するまで動作は停止されます。
引数:
desiredRadius – 自由に動けるスペースの半径[m]
displacementConstraint – 見つかった場所への移動距離の許容最大値[m]
戻り値:
a cancelable qi::Future<ALValue> [Free Zone Error Code, result radius (meters), [worldMotionToRobotCenterX (meters), worldMotionToRobotCenterY (meters)]]
desiredRadius = 0.6 displacementConstraint = 0.5 navigationProxy.findFreeZone(desiredRadius, displacementConstraint)
alnavigation.py
#! /usr/bin/env python # -*- encoding: UTF-8 -*- """Example: Use findFreeZone Method""" import qi import argparse import sys import almath import math def main(session): """ This example uses the findFreeZone method. """ # Get the services ALNavigation, ALMotion and ALRobotPosture. navigation_service = session.service("ALNavigation") motion_service = session.service("ALMotion") posture_service = session.service("ALRobotPosture") # Wake up robot motion_service.wakeUp() # Send robot to Stand Init posture_service.goToPosture("StandInit", 0.5) # Scanning the environement. navigation_service.startFreeZoneUpdate() ########################################################################### # Add here an animation with timelines and moves (less than 60 seconds). # # For example : motion_service.moveTo(0.0, 0.0, 2.0 * math.pi) ########################################################################### desiredRadius = 0.6 displacementConstraint = 0.5 result = navigation_service.findFreeZone(desiredRadius, displacementConstraint) errorCode = result[0] if errorCode != 1: worldToCenterFreeZone = almath.Pose2D(result[2][0], result[2][1], 0.0) worldToRobot = almath.Pose2D(motion_service.getRobotPosition(True)) robotToFreeZoneCenter = almath.pinv(worldToRobot) * worldToCenterFreeZone motion_service.moveTo(robotToFreeZoneCenter.x, robotToFreeZoneCenter.y, 0.0) else : print "Problem during the update of the free zone." if __name__ == "__main__": parser = argparse.ArgumentParser() parser.add_argument("--ip", type=str, default="127.0.0.1", help="Robot IP address. On robot or Local Naoqi: use '127.0.0.1'.") parser.add_argument("--port", type=int, default=9559, help="Naoqi port number") args = parser.parse_args() session = qi.Session() try: session.connect("tcp://" + args.ip + ":" + str(args.port)) except RuntimeError: print ("Can't connect to Naoqi at ip \"" + args.ip + "\" on port " + str(args.port) +".\n" "Please check your script arguments. Run with -h option for help.") sys.exit(1) main(session)
AL::ALValue ALNavigationProxy::startFreeZoneUpdate()
Deprecated since version 2.5: No more necessary: instead, directly call ALNavigationProxy::getFreeZone.
Starts a loop to update the mapping of the free space around the robot. It is like ALNavigationProxy::findFreeZone but this time the user is responsible for the move of scanning. It is a non-blocking call. Call ALNavigationProxy::stopAndComputeFreeZone to get the result. The maximum time for the scanning is 60 seconds. After that the update is stopped automatically. Clears the map if called again.
AL::ALValue ALNavigationProxy::stopAndComputeFreeZone(float desiredRadius, float displacementConstraint)
Deprecated since version 2.5: No more necessary: instead, cancel the future of ALNavigationProxy::findFreeZone.
Stops the update and returns the result. If the update was not running it returns error code 1.
引数:
desiredRadius – The radius of free space we want in meters.
displacementConstraint – The max distance we accept to move to reach the found place in meters.
戻り値:
an ALValue [Free Zone Error Code, result radius (meters), [worldMotionToRobotCenterX (meters), worldMotionToRobotCenterY (meters)]]
Event: "Navigation/AvoidanceNavigator/Status"
callback(std::string eventName, AL::ALValue status, std::string subscriberIdentifier)
Raised when status of the local navigator changes.
引数:
eventName (std::string) – “Navigation/AvoidanceNavigator/Status”
status – New local navigator status. Please refer to ALNavigation for details.
subscriberIdentifier (std::string) –
Event: "Navigation/AvoidanceNavigator/ObstacleDetected"
callback(std::string eventName, AL::ALValue position, std::string subscriberIdentifier)
Raised when an obstacle is detected in the close area.
引数:
eventName (std::string) – “Navigation/AvoidanceNavigator/ObstacleDetected”
position – Array formatted as [x, y], representing the position of the detected obstacle in FRAME_ROBOT.
subscriberIdentifier (std::string) –
Event: "Navigation/AvoidanceNavigator/MovingToFreeZone"
callback(std::string eventName, AL::ALValue status, std::string subscriberIdentifier)
Raised when the robot starts or stops a motion to leave an obstacle neighbourhood.
引数:
eventName (std::string) – “Navigation/AvoidanceNavigator/MovingToFreeZone”
status – 1.0 when the robot starts and 0.0 when it has finished its motion.
subscriberIdentifier (std::string) –
Event: "Navigation/AvoidanceNavigator/TrajectoryProgress"
callback(std::string eventName, AL::ALValue progress, std::string subscriberIdentifier)
Raised when the trajectory progress is updated.
引数:
eventName (std::string) – “Navigation/AvoidanceNavigator/TrajectoryProgress”
progress – percentage of the current trajectory accomplished, between 0.0 and 1.0.
subscriberIdentifier (std::string) –
Event: "Navigation/AvoidanceNavigator/AbsTargetModified"
callback(std::string eventName, AL::ALValue newTarget, std::string subscriberIdentifier)
Raised when the required target is unreachable because it is inside an obstacle.
The robot then computes the closest target to the initial one.
引数:
eventName (std::string) – “Navigation/AvoidanceNavigator/AbsTargetModified”
newTarget – the new target of the robot in FRAME_WORLD.
subscriberIdentifier (std::string) –
Event: "Navigation/MotionDetected"
callback(std::string eventName, AL::ALValue sensorData, std::string subscriberIdentifier)
Raised when a sensor detects that something is moving around the robot.
Current implementation is based solely on Pepper Infra-Red.
引数:
eventName (std::string) – “Navigation/MotionDetected”
sensorData – Array formated as [Sensor, Position, Detected], where: Sensor is the name of the sensor that detected the motion; Position is the 3D position, in FRAME_WORLD, of the detected movement around Pepper; Detected is a boolean equals to true if the movement corresponds to something arriving in Pepper’s vicinity and false if it corresponds to something leaving Pepper’s vicinity.
subscriberIdentifier (std::string) –
エラーコード | 意味 |
0 | OK. You can trust the result center and radius, and asked constraints were respected. |
1 | KO. There was a problem, do not take into account the returned center and radius. |
2 | CONSTRAINT KO. There was no problem but the asked constraints are not fullfilled, returned best approching solution |
コメントをかく