Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

  • 画一条机器人当前位置x轴方向正向的,长6米的轨道,然后沿轨道走到目标点

    Code Block
    languagejava
    themeMidnight
    title导航到目标点
    linenumberstrue
    /* 与底盘连接 */
    final AbstractSlamwarePlatform robotPlatform = DeviceManager.connect("10.0.130.71", 1445);
    
    try {
    
        //draw a 6 meter virtual track
        Pose pose = robotPlatform.getPose();
        Line line = new Line(new PointF(pose.getX(), pose.getY()), new PointF(pose.getX()+6, pose.getY()));
        robotPlatform.addLine(ArtifactUsageVirtualTrack, line);
    
        IMoveAction action = robotPlatform.getCurrentAction();
        if (action != null)
            action.cancel();
    
        MoveOption moveOption = new MoveOption();
        moveOption.setTrackWithOA(true);
        moveOption.setKeyPoints(true);
    
        action = robotPlatform.moveTo(new Location(7, 0, 0), moveOption, 0);
    
        action.waitUntilDone();
        if (action.getStatus() == ERROR)
            Log.d(TAG, "Action Failed");
    
    } catch (ConnectionTimeOutException e) {
    	/* Exception Handle code*/
    	....	   
    }