Device: Gate - fdechaumont/micecraft GitHub Wiki

The gate is a sorter, or a flow controller of your animals. It grants access to animals to specific area of your experiment.

In the example bellow, the 2 gates are used to grant an access from the living area to the test blocks. In that case, the gate lets one animal go through, and wait for its return in the housing area.

collaboration-setup

General description

image

Gate commands:

The gate has several pre-programmed mode: todo: add video examples

Mode / Order Description (using side A to side B example)
Only one animal in side A
Only one animal in side B
The gate lets one animal go through, and wait for its return in the housing area.
Allow a single animal from side A to side B
Allow a single animal from side B to side A
The gate lets one animal at a time go through the gate from the A side to the B side. Then the gate waits for another animal from side A to get into the gate. In this mode, the animals cannot come back to side A.
Allow multiple animals from A to B
Allow multiple animals from B to A
The gate will allow any number of animal to go though at once, but will ensure that the animals go from A to B but never from A to B
empty gate to side A & empty gate to side B If animals are in the gate, the gate opens on the specified side and will close once no animal is present in the gate
No order The gate will not do anything. Still, safeties at doors are still on. (see safety section)

If you want to have the gate automatically sending only one animal to your test block, you just need those lines of code:

from micecraft.devices.gate.Gate import Gate, GateOrder

if __name__ == '__main__':
    
    gate = Gate( COM_Servo="COM12", COM_Arduino="COM13", COM_RFID="COM14" )
    gate.setOrder( GateOrder.ONLY_ONE_ANIMAL_IN_A )
    input("Hit enter to stop example")

Graphicals commands:

If you right click on the interface, this menu pops:

image
  • Open/Close A/B:This first section lets you perform actions on specific door, whatever the current order/mode is. Note that safety is still on (so the door may take a while to close if an animal or if anything is on its way).

  • Tare to zero: Manually tares the scale to zero. Note that the scale is tared each time an animal gets through.

  • Tare with animal(s) in the gate: You can select the number of animals that are in the gate to setup the tare. Note that when the system will detect that no more animal is present, it will quit this mode to get back to classic tare mode. The purpose of this action is to init gates while there is an animal into it.

  • GateOrder list: select an item to activate the corresponding mode/order of the gate (see order list).

  • User real scale value (normal mode): In this mode, the gate uses the reading from the scale.

  • Force reading scale to 0 grams.: The gate will act as if the scale returns 0g. Typically it will "sense" that it is empty. Should be used only while testing devices.

  • Force reading scale to expected animal weight: In this mode, the gate "sense" that there is one animal in the gate. If you are simulating your experiment, you will see the gate reacting just like if an animal gets into the gate, which is super handy to test your experiment code without any animal in the system, but still will all parts moving in the gate (see Simulate experiment).

  • No test RFID (normal mode): The gate will receive the RFIDs from transponders.

  • Force RFID reading 0001: The gate will read an animal with an RFID set as "0001". Once again very handy to test your experiment without real animals (see Simulate experiment).

Gate in GUI: https://github.com/fdechaumont/micecraft/blob/main/src/micecraft/examples/GateInGui.py

⚠️ **GitHub.com Fallback** ⚠️