Ejemplo n.º 1
0
    def api_load_unload(self, wht: WarehouseTask) -> RobotMission:
        """Load or unload HU of a warehouse task."""
        # Default mission
        mission = RobotMission()

        # Get relevant parameters
        if wht.vlpla:
            action = {'getTrolley': {'dockName': wht.vlpla}}
        elif wht.nlpla:
            action = {'returnTrolley': {'dockName': wht.nlpla}}
        else:
            _LOGGER.error(
                'Neither source nor target bin in warehouse task')
            return mission

        spec = {'actions': [action]}
        mission_name = str(time.time())

        # Create CR
        success = self.create_cr(mission_name, self.labels, spec)

        # On success, set ID and STATE
        if success:
            mission.name = mission_name
            mission.status = RobotMission.STATE_ACCEPTED

        return mission
Ejemplo n.º 2
0
    def api_moveto_staging_position(self) -> RobotMission:
        """Move robot to a staging position of the map."""
        # Default mission
        mission = RobotMission()
        # Get relevant parameters
        # TODO implement real move to staging method
        action = {'moveToNamedPosition': {'targetName': 'Staging'}}
        spec = {'actions': [action]}
        mission_name = str(time.time())

        # Create CR
        success = self.create_cr(mission_name, self.labels, spec)
        # On success, set ID and STATE
        if success:
            mission.name = mission_name
            mission.status = RobotMission.STATE_ACCEPTED

        return mission
Ejemplo n.º 3
0
    def api_moveto_storagebin_position(
            self, storagebin: StorageBin) -> RobotMission:
        """Move robot to a storage bin position of the map."""
        # Default mission
        mission = RobotMission()
        # Get relevant parameters
        action = {'moveToNamedPosition': {'targetName': storagebin.lgpla}}
        spec = {'actions': [action]}
        mission_name = str(time.time())

        # Create CR
        success = self.create_cr(mission_name, self.labels, spec)
        # On success, set ID and STATE
        if success:
            mission.name = mission_name
            mission.status = RobotMission.STATE_ACCEPTED

        return mission
Ejemplo n.º 4
0
    def api_charge_robot(self) -> RobotMission:
        """Charge robot at the charging position."""
        # Default mission
        mission = RobotMission()
        # Get relevant parameters
        action = {'charge': {'chargerName': self.charger,
                             'thresholdBatteryPercent': self.battery_min,
                             'targetBatteryPercent': self.battery_ok}}
        spec = {'actions': [action]}
        mission_name = str(time.time())

        # Create CR
        success = self.create_cr(mission_name, self.labels, spec)
        # On success, set ID and STATE
        if success:
            mission.name = mission_name
            mission.status = RobotMission.STATE_ACCEPTED

        return mission