-
Notifications
You must be signed in to change notification settings - Fork 38
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Move transfer logic into the specific Unit subclasses #474
Comments
Why does the |
That's a good point. Since transfer() is inside the Unit class. It should be able to use getContainerUnit() to get the origin |
@mokun There is a problem with Missions. The Person transferred to a Vehicle at the start of the Mission are still attached to the Settlement. So during the Mission they continue to walk around and do Task in the Settlement, Person is not transferring correctly. |
Actually this might be a problem with how Tasks are started. I suspect some Tasks that are Settlement based and not checking the person is in a Settlement before starting. |
btw, how we define if a vehicle is in a settlement or not is crucial. I have this scenario: Person P gets inside Vehicle V while parked inside a garage building G in Settlement S If V exits G and still parked at S, and I do a P.getSettlement(), what do you want to be the result ? Should it be S or null ? |
Also, what do you want P.getTopContainerUnit() to be ? |
There is a problem with how Tasks are selected. Some of the Tasks that can only be done in a Settlement use |
The problem is the some Settlement only task uses isInside as a precondition but it should be isInSettlement. This means that without this a Person could try and Walk out of a Vehicle to a building. Changes: - ReviewMissionPlan & Meta use isInSettlement - ReviewJobReassignment & Meta use isInSettlement #474
r6342 2021-10-25 ## ISSUE 1. #483 (comment) 2. #474 ## NEW 1. 3. Add codes in transfer() in Robot. 2. Add robotsWithin list in Settlement. ## CHANGE 1. Remove the origin param in transfer() in Person, Vehicle, Robot, Equipment. 2. Remove transfer() in Unit.
ok. So we'll need to fix I suppose it makes more sense to allow a person such as a commander or a chief inside a vehicle to review and approve a mission plan, or else there isn't much to do inside a vehicle during the trip. |
No 'isInside' is correct. It means I am in an air environment. The problem is some Tasks were not taking being in a Vehicle into account. I've fixed the 2 I found. |
|
I'm looking into this tonight. I think the issue might be a race condition in MarsSurface. |
Changes: - Person.transfer clears the building id when leaving a Settlement - MarsSurface added some synch blocks around the shared lists - BuildingAirlock relies on the transfer method to correctly move Person - Location description logic moved out of SimLogger. Supprots future reuse to remove LocationTag #474
So what race condition do you experience ? A settlement runs on a thread. A person.timePassing() would be run from his settlement's timePassing() in the same thread, right ? and why it only seems to affect it when loading from a saved sim ? |
No it wasn't a race condition. But there some warnings still that Units can not be retrieved from a container. |
Can you copy and paste here next time you see it ? |
The problem occurs because of 2 coding issues that we can fix:
|
Sure. I'm committing some simple changes to see if it fairs better. If not, we'll need to do it more defensively, like you suggested. |
I see 3 potential issues :
|
Ok. We need to make sure we don't have logic spread around the classes. The new Inventory approach has simplified and consolidated things a lit so we don't want to lose that. For clearness I see only the transfer method should be allowed to change a container. |
r6352 2021-10-27 ## ISSUE 1. #474 ## FIX 1. Use removePersonFromBuilding() within transfer() in Person and Robot. 2. Check if a transfer is successful or not in various methods.
LifeSupport class has always had a collection of occupants for a long time by previous developers. If there's no longer any merit to do so, we can certainly change that. |
Yes I don't like the top level container aspects. If a Person is in a Vehicle then they delegate to the vehicle for isInSettlement, getSettlement etc ? Then as the vehicle is transferred out of a Settlement or building the Person inherits the move ? |
r6363 2021-10-29 ## ISSUE 1. #474 ## FIX 1. Revise disembark() in RoverMission and DroneMission - Adopt the use of transfer(). 2. Revise the robot's action in enteringRoverInsideGaragePhase() and exitingRoverGaragePhase() in Walk.
r6364 2021-10-29 ## ISSUE 1. #474 ## CHANGE 1. Revise rescueOperation() and disembark() in RoverMission. ## NEW 1. Add findNumContainersOfType() in EquipmentOwner. ## FIX 1. Avoid NPE in UnloadVehicleEVA and LoadVehicleEVA.
r6365 2021-10-29 ## ISSUE 1. #474 ## CHANGE 1. Ensure each crew member in the vehicle has an EVA suit to wear - Revise unloadingPhase() in UnloadVehicleEVA. 2. Ensure getSettlement() in various class return object correctly.
r6366 2021-10-29 ## ISSUE 1. #474 ## CHANGE 1. Count the total num of EVA suits in a mission vehicle. - Add hasBaselineNumEVASuit() in RoverMission. - Include suits - stored in vehicle - on mission members' inventory - worn by him/her
r6367 2021-10-30 ## ISSUE 1. #474 ## CHANGE 1. Revise performEmbarkFromSettlementPhase() in RoverMission. ## FIX 1. Avoid NPE in walkingPhase() in WalkOutside.
Not sure what is happening but after my recent pull I have 2 issues:
I had a couple of warnings about not being able to retrieve in the transfer method I think. Do we still enforce a retrieval before the transfer? I feel the setContainer method has to be protect to stop logic bypassing the transfer. |
Also my simulation run has now stalled going into an infinite loop with a Persons walking task so the pulse is stuck just repeating the same sequence of steps. |
I revised is settlement() and getSettlement() recently and it seems to have affected walking |
With regard to the EVA suit transfer issue, it may have to do with the recent change in the embarking and disembarking methods in RoverMission |
I think the problem is isInSettlement in Person., The scenario I have is a Person is in a Vehicle parked at a Settlement but outside. The person returns true for isInSettlment because the Vehicle returns true;; this means that they can now do inside Settlement tasks like tend the greenhouse which in turn prevents them from walking out of the Vehicle. |
Maybe if you are in a Vehicle even if it is parked in a Garage you can't be in the settlement until you leave the Vehicle. That would work as that is what we had before. Remind me, why was it a problem with the previous way? |
Yes I can see teh changes to Person.getSettlement & Person.isInSettlement maybe causing problems. But I can't see how Persons leave the vehicle in a disembark phase.; do you know how it is triggered? |
I have no idea how MissionMember are meant to leave the Vehicle during the disembarking phase. Seems that the unloading cannot start unless everyone is out of the vehicle but only no one is ever told to leave. I think the mission member should be assigned an UnloadVehcile task as part of disembarking phase. Make sense but can't understand why it isn't there already. |
My bad ! I'm now correcting This way, |
Let's discuss this portion further in #488 |
r6369 2021-10-30 ## ISSUE 1. #474 2. #488 ## FIX 1. Revise transfer() in Vehicle. 2. Remove calling transfer() from two methods in Walk - exitingRoverGaragePhase - enteringRoverInsideGaragePhase 3. Correct addToGarageBuilding() in BuildingManager. 4. Avoid ClassCastException in unloadingPhase() in UnloadVehicleEVA. ## NEW 1. Add removeFromGarage() in BuildingManager. - remove people and robots from settlement when called. ## CHANGE 1. Revise from 2 methods in RoverMission to incorporate removeFromGarage() in BuildingManager. - performEmbarkFromSettlementPhase() - disembark() 2. Incorporate removeFromGarage() in various other classes.
r6559 2021-12-08 ### ISSUE 1. #474 ### FIX 1. Revise transfer() in Person and Robot 2. Fix code smells.
r6590 2021-12-14 ### ISSUE 1. #474 ### NEW 1. Add isInVehicleInGarage() in Worker. ### CHANGE 1. Modify getBuilding() in BuildingManager to see if a person is inside a vehicle in a garage. - Address "Not currently in a building" message. 2. Modify '# of Crew' label to '# Crew Boarded' in TabPanelCrew. 3. Increase the height of the member table in TabPanelCrew.
Describe the bug
The Unit Transfer logic sits inside the
Unit
class currently but it has logic branching to support different sub-types of Unit; but not all. For example Settlements & Building should not be transferable.It would make the logic cleaner if we move Unit specific transfer logic into the specific Unit subclasses. For example Person would have a dedicated transfer method handling just
Person
transfers. The same would need to be done toVehicle
&Equipment
.The text was updated successfully, but these errors were encountered: