require 'win32ole' # this allows us to create instances of Windows COM objects # create instances of each of our drivers $filt = WIN32OLE.new("ASCOM.Simulator.FilterWheel") $foc = WIN32OLE.new("ASCOM.Simulator.Focuser") $tele = WIN32OLE.new("ASCOM.Simulator.Telescope") $cam = WIN32OLE.new("ASCOM.Simulator.Camera") # a function that disconnects from each connected device def DisconnectAllDevices() puts "Disconnecting from all devices..." # disconnect from each device $filt.Connected = false $foc.Connected = false $tele.Connected = false $cam.Connected = false puts "All devices disconnected" end # capture a number of images with a specific exposure time def CaptureImages(numImages, expTime) for i in 1..numImages puts "Capturing Image " << i.to_s << "..." #$cam.ExposureMin = expTime $cam.StartExposure(expTime, true) while(!$cam.ImageReady) do end # do something with $cam.ImageArray here, probably save it to disk puts "Captured Image Successfully!" end end # connect up to each device $filt.Connected = true if($filt.Connected) then puts "Connected to Filter Wheel!" end $foc.Connected = true if ($foc.Connected) then puts "Connected to Focuser!" end $tele.Connected = true if($tele.Connected) then puts "Connected to Telescope!" end $cam.Connected = true if($cam.Connected) then puts "Connected to Camera!" end # unpark the telescope so that we can move it to our target position $tele.Unpark() puts "Unparking telescope..." while($tele.Slewing) do end puts "Telescope unparked!" # slew scope to our target location puts "Slewing Telescope to target location... RA = " << $tele.RightAscension.to_s << ", DEC = " << $tele.Declination.to_s # tracking is a feature of the telescope mount that continuously adjusts the position to compensate for the movement of the stars $tele.Tracking = true # move the telescope to point to the target position $tele.SlewToCoordinates(15.26, 75.4) puts "Slew Complete! RA = " << $tele.RightAscension.to_s << ", DEC = " << $tele.Declination.to_s # move filter wheel to postion 1 $filt.Position = 1 $foc.Move(22000) while($foc.IsMoving) do end puts "Focuser Position = " << $foc.Position.to_s puts "Filter Wheel Positon = " << $filt.Position.to_s # capture a set of images CaptureImages(10, 2) # move filter wheel to postion 2 $filt.Position = 2 $foc.Move(21000) while($foc.IsMoving) do end puts "Focuser Position = " << $foc.Position.to_s puts "Filter Wheel Positon = " << $filt.Position.to_s # capture a set of images CaptureImages(10, 1) # move filter wheel to postion 3 $filt.Position = 3 $foc.Move(21500) while($foc.IsMoving) do end puts "Focuser Position = " << $foc.Position.to_s puts "Filter Wheel Positon = " << $filt.Position.to_s # capture a set of images CaptureImages(10, 3) # park the telescope puts "Parking telescope..." $tele.Park() while($tele.Slewing) do end puts "Telescope parked!" # disconnect DisconnectAllDevices() puts "Process Completed Successfully!"