James, On Thu, Apr 6, 2017 at 2:22 AM, James McHugh <jame...@gmail.com> wrote:
> I'm writing some software to monitor and control my observatory. It will > have many many inputs (clouds, rain, temp, time, roof position, telescope > status, focuser status, camera status, filter status etc etc ) and will > control the whole setup including opening closing the roof based on weather > / alt of the Sun, taking images, focusing based on temp changes, auto > guiding, selecting the best target, shutting the system down if there is > rain or clouds, etc etc etc > It could get quite complex. > > I have all the individual pieces working, now I'm looking for a nice > design pattern to tie it all together. > > Any suggestions or ideas to get me started? I'm worried if I start off > with just a bunch of if statements and for loops it will quickly become a > huge mess. > I don't if what I have is a nice design. it certainly has grown a bit organically lately because time pressure :) I wrote a little web server that can send command to motors controling a piece of equipment (rotating/elevating a testbench system for the LSST camera). this is done from the GUI (an authenticated web page, served by the server) via websockets. the server relays this to the motors, using some protocol (modbus over TCP). if any error occurs, the server relays it back again, raising an alert. the server also has a ticking goroutine that gathers monitoring data from the motors, video frames from a webcam (pointed at the apparatus). this data is relayed to the GUI via yet another websocket channel, in the form of base64-encoded images (for the video frames) and SVG plots (for the monitoring data). the ticking goroutine is also saving the monitoring data (at a slower rate than the "real time" monitoring data) to a database. it's all there: https://github.com/go-lsst/fcs-lpc-motor-ctl a few slides about it: http://talks.godoc.org/github.com/sbinet/talks/2016/20160928-ji-go-polymer/talk.slide#10 hth, -s -- You received this message because you are subscribed to the Google Groups "golang-nuts" group. To unsubscribe from this group and stop receiving emails from it, send an email to golang-nuts+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/d/optout.