Alpyca Device Quick Start
Running the Sample with the Conformance Checker
Here’s how to get this sample running on your development system. We recommended you use Visual Studio Code for Python development but it’s cerainly not a requirement.
Clone the AlpycaDevice repository from GitHub
The
devicefolder has all of the driver app files,app.pyis the startupLook at
config.tomland if port 5555 is ok, you can leave everything else for now.Recommend you create (and activate) a separate Python virtual environment. You do not need Conda or any fancy virtual environment tools, just use an
venvtype.Use
pipto installfalconandtoml. These are the only two packages needed by the driver sample.Start the sample/template from the
devicefolderpython app.py. It will not write to the shell/stdout. See the rotator.log file created in the root folder.Start ConformU and click Select Device. The sample should be discovered. If your dev system is on multiple IP addresses, you’ll see it listed multiple times. Pick any one.
Click Start and watch it exercise the sample device. After a while it should complete successfully.
Have a look through the code, step through it with the debugger, etc. If you need more context have a look through the Introduction to Alpaca Drivers. Also keep in mind that there are many resources at Alpaca Developers Info and the ASCOM Driver and Application Development Support Forum
Creating Your First Driver
OK, you have run the Rotator sample and maybe caught it in various places with the debugger and maybe you’ve looked at the Introduction to Alpaca Drivers and/or the Developer Roadmap. Or not. Here’s how to get started implementing your driver. Let’s say you want to make a roll-off roof driver.
The essential modules are all in the
devicefolder. Make a copy outside the cloned GitHub tree. This will serve as your driver project root.Remove the
rotator.pymodule from your driver project folder.Copy the
dome.pymodule from thetemplatesfolder into your project folder. Note that a roll-off roof is a type of dome in ASCOM (norotating part, only open-close).Open the
dome.pymodule.Find the
DomeMetadataclass and edit it to reflect your dome’s descriptive metadata. The##delimited sections elsewhere indicate things you need to supply in thedome.pymodule to make it your own.Open your project’s
app.pymodule.- Remove this line
import rotator- replace with
import dome
- Remove the following lines
rotator.logger = logger # Hook the master loggerrotator.start_rot_device(logger) # Start the physical device- replace with
dome.logger = logger
- Remove the following line
init_routes(falc_app, 'rotator', rotator)- replace with
init_routes(falc_app, 'dome', dome)
Optional: In your project’s log.py module replace
alpyca.logwithdome.log. The original name is generic because this server can support multiple device types.Open your project’s
management.pymodule- Remove this line
from rotator import RotatorMetadata- replace with
from dome import DomeMetadata
Find
class configureddevicesand change the referencesRotatorMetadatatoDomeMetadata.OK, that’s all there is to assemble the pieces. If you were to go back to
dome.pyand replace the##stuff with calls to your device code or just stub it out so the app would run, you would have a driver that would be discoverable and the endpoint responders would be called when any app talks to your device.