Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- ////////////////////////////////// new method parkatstorageplatform
- /**
- * Makes the AGV park on the storage platform
- * Side to park is recognized automatically by using the z axis
- * which platform to park at is recognized by the location/waypoint it is standing on
- * @param location
- */
- public void parkAtStoragePlatform(int location) {
- location += 1;
- int temp = location;
- int xStartPoint;
- float eastorwest;
- //determine which side the AGV is at
- if (this.getWorldTranslation().z < 0) {
- eastorwest = -122f;
- }
- else{
- eastorwest = 113f;
- }
- //if the agv is lower than x=70 its at ship platform
- if (this.getWorldTranslation().x < 70) {
- xStartPoint = -167;
- }
- //if lower than 330 train platform
- else if (this.getWorldTranslation().x < 330) {
- xStartPoint = 113;
- }
- //else it's at the lorry platform
- else{
- xStartPoint = 363;
- }
- //AGVs spawn in groups of 6, after 6 a extra distance is added
- while (temp > 6) {
- temp -= 6;
- xStartPoint += 22;
- }
- path.clearWayPoints();
- path.addWayPoint(new Vector3f(this.getWorldTranslation()));
- path.addWayPoint(new Vector3f(xStartPoint + (4.7f * location), 0, this.getWorldTranslation().z));
- path.addWayPoint(new Vector3f(xStartPoint + (4.7f * location), 0, eastorwest));
- motionControl.play();
- }
- ////////////////////////////////////////fixes in leavestorageplatform method
- /**
- * Determine in which storagearea this AGV is parked and send the AGV to the
- * nearby waypoint
- */
- public void leaveStoragePlatform() {
- char[] gotowaypoint = new char[1];
- int west = -122;
- int east = 113;
- //western ship platform -> goto waypoint P
- if ((int)this.getWorldTranslation().x < 12 && (int)this.getWorldTranslation().z == west) {
- gotowaypoint[0] = 'P';
- } //eastern ship platform -> goto waypoint Q
- else if ((int)this.getWorldTranslation().x < 12 && (int)this.getWorldTranslation().z == east) {
- gotowaypoint[0] = 'Q';
- } //western train platform -> goto waypoint O
- else if ((int)this.getWorldTranslation().x > 110f && (int)this.getWorldTranslation().x < 300 && (int)this.getWorldTranslation().z == west) {
- gotowaypoint[0] = 'O';
- } //eastern train platform -> goto waypoint N
- else if ((int)this.getWorldTranslation().x > 110f && (int)this.getWorldTranslation().x < 300 && (int)this.getWorldTranslation().z == east) {
- gotowaypoint[0] = 'N';
- } //western lorry platform -> goto waypoint L
- else if ((int)this.getWorldTranslation().x > 365f && (int)this.getWorldTranslation().x < 550 && (int)this.getWorldTranslation().z == west) {
- gotowaypoint[0] = 'L';
- } else if ((int)this.getWorldTranslation().x > 365f && (int)this.getWorldTranslation().x < 550 && (int)this.getWorldTranslation().z == east) {
- gotowaypoint[0] = 'M';
- } //AGV is not in any of the storage area's, send a msg and add 0
- else {
- System.out.println("AGV at location " + this.getWorldTranslation() + " cannot leave storage area because this AGV is not in any storage area.");
- gotowaypoint[0] = '0';
- }
- //only call move method when there's a valid waypoint in the char[] to avoid exception
- if (gotowaypoint[0] != '0') {
- move(gotowaypoint);
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement