github.com/gkstretton/dark/services/goo@v0.0.0-20231114224855-2d1a2074d446/actor/executor/actions.go (about)

     1  package executor
     2  
     3  import (
     4  	"fmt"
     5  	"sync"
     6  
     7  	"github.com/gkstretton/asol-protos/go/topics_firmware"
     8  	"github.com/gkstretton/dark/services/goo/mqtt"
     9  )
    10  
    11  // goTo functionality is treated as a resource. For example if something is
    12  // running goto and dispense, a voting round should respect that and not send
    13  // goTo commands.
    14  var goToLock sync.Mutex
    15  
    16  func collect(vialNo int, volUl int) {
    17  	mqtt.Publish(topics_firmware.TOPIC_COLLECT, fmt.Sprintf("%d,%d", vialNo, volUl))
    18  }
    19  
    20  func goTo(x, y float32) {
    21  	mqtt.Publish(topics_firmware.TOPIC_GOTO_XY, fmt.Sprintf("%.3f,%.3f", x, y))
    22  }
    23  
    24  func dispense() {
    25  	mqtt.Publish(
    26  		topics_firmware.TOPIC_DISPENSE,
    27  		fmt.Sprintf("%.1f", getDispenseVolume()),
    28  	)
    29  }