Questions about SharpCap.Mounts API usage in Python

Discussions on extending SharpCap using the built in Python scripting functionality
Post Reply
pe78420
Posts: 23
Joined: Sat Aug 26, 2017 12:09 pm

Questions about SharpCap.Mounts API usage in Python

#1

Post by pe78420 »

Hi everyone,

I'm currently experimenting with the SharpCap Python scripting interface, specifically the SharpCap.Mounts API. Unless I’ve missed something or made a mistake, I haven't found any relevant explanation that covers the following use cases:
  • How do I select and connect to a specific mount?
  • How can I retrieve information from the mount, especially GPS coordinates?
  • How do I perform a GoTo to a specific RA/DEC position?
  • And so on — other basic operations like slewing, checking status, etc.
  • And how to call an external python script...
If any documentation or example scripts exist for these cases, I’d really appreciate a pointer.

Thanks in advance for your help!

Best regards,

Philippe
pe78420
Posts: 23
Joined: Sat Aug 26, 2017 12:09 pm

Re: Questions about SharpCap.Mounts API usage in Python

#2

Post by pe78420 »

First try:
  • get the mount list
  • selected one of them
  • get the method list

Code: Select all

import clr
clr.AddReference("SharpCap")
mount_name = "ASCOM GS Sky Telescope"
for index, mount in enumerate(SharpCap.Mounts):
	if str(mount) == mount_name:
		break
SharpCap.Mounts.SelectedMount = SharpCap.Mounts[index]
print("\n".join(dir(SharpCap.Mounts.SelectedMount)))
Here, the methods list:

Code: Select all

Altitude
ApplyRAOffsetAsync
AscomMount
AvailableRates
Azimuth
CanApplyRAOffset
CanConfigure
CanGoto
CanGuide
CanMoveAxis
CanParkUnpark
CanPulseGuide
CanReportLocation
CanReportPointing
CanSetSideOfPier
CanSetTracking
CanSync
ConnectAsync
Connected
ConnectedChanged
Coordinates
Dec
DiscardConnection
DisconnectAsync
Dispose
DoAsyncInTask
DoInTask
Epoch
Equals
FocalLength
GetAvailableTrackingRates
GetControl
GetFullName
GetHardwareType
GetHashCode
GetObserverLocation
GetSkyCoordConverter
GetSlewRates
GetType
GuidingConnectedChanged
HardwareType
HourAngle
IsASCOM
IsAltAz
IsAvailable
IsConnected
IsEQ
IsJNow
IsPlateSolveAvailable
IsSettled
Latitude
Longitude
MemberwiseClone
MountType
MoveAxis
Name
Nudge
OnConnectedChanged
OnGuidingConnectedChanged
Park
ParkAsync
Parked
PulseGuideRate
RA
ReferenceEquals
RefreshCoordinatesNow
RemoveRAOffsetAsync
SelectedRate
SetSideOfPierAsync
SetTrackingAsync
SetTrackingRate
SetTrackingRateAsync
ShowProperties
ShowPropertiesAsync
SideOfPier
SiderealTime
SlewTo
SlewToAltAz
Slewing
SolveAndSync
StableTime
StartMoveAxisAsync
StartSlewToAsync
Stop
StopAsync
SyncTo
SyncToAsync
TargetPosition
ToString
Tracking
TrackingRate
UnPark
UnParkAsync
WaitUntilSettled
WouldGOTOChangeSideOfPier
__class__
__delattr__
__doc__
__enter__
__eq__
__exit__
__format__
__ge__
__getattribute__
__gt__
__hash__
__init__
__le__
__lt__
__ne__
__new__
__reduce__
__reduce_ex__
__repr__
__setattr__
__sizeof__
__str__
__subclasshook__
User avatar
admin
Site Admin
Posts: 15380
Joined: Sat Feb 11, 2017 3:52 pm
Location: Vale of the White Horse, UK
Contact:

Re: Questions about SharpCap.Mounts API usage in Python

#3

Post by admin »

Hi,


in general you won't need to set the SelectedMount to a different mount (unless you need to change which mount is being accessed during your script) - by default the selected mount will be the one set up in the SharpCap hardware settings, and mostly you would just work with that mount.

Don't forget that you can use 'help(...)' in the python console on an object to get info about the available methods/properties - ie

Code: Select all

>>> mount = SharpCap.Mounts.SelectedMount
>>> help(mount)
The sort of things you might want are

Code: Select all

>>> print (mount.GetObserverLocation())
Lat=51.0, Long=1.2
>>> print (mount.Coordinates)
RA=22:55:14.5,Dec=+90:00:00
>>> print (mount.Slewing)
False
>>> mount.SlewTo(5, -5)
The last line slews to an RA/Dec location and will assume that the co-ordinates given are in the same epoch as the mount's working epoch.

Hope this helps,

Robin
pe78420
Posts: 23
Joined: Sat Aug 26, 2017 12:09 pm

Re: Questions about SharpCap.Mounts API usage in Python

#4

Post by pe78420 »

Hi,

That's right! :lol:
Even if I have several cameras, several focusers and several optics... I only have one mount!

So... keep it simple!

Regards,

Philippe
Post Reply