controllables.Claw

class controllables.Claw(port: Optional[int] = None)

Reference to a claw part.

The follow code block assumes that a claw part is assigned to port 0.

from controllables import Claw

#create claw reference
claw = Claw(0)

while True:
    #wait until somthing is in our reach
    while not claw.can_grab():
        pass

    #grab it
    claw.close()

    #do nothing until it breaks free
    while claw.is_holding():
        pass
close()

Closes the claw. If an object between the claws mandibles, the claw will try grip onto it.

open()

Opens the claw, releasing any object it was gripping onto.

property max_force: float

The maximum force (in newtons) property of the claw avaliable in the properties tab.

can_grab() bool

Returns true when an object is between the claws mandibles.

is_holding() bool

Returns True exactly when the claw is holding an object. In the case that the claw was holding something, but has lost its grip, returns False.

is_open() bool
name() str

Returns the user editable name of the controllable as found in the properties tab of the game.

from ports import PortReference

print(PortReference(0).name())