Dear SharpCap team!
Please advise - I want to automate the operation of the telescope and camera with the following tasks:
1. pointing the telescope according to the list of points in RA/DEC, the time of the start of shooting, shooting at the given exposure and the number of frames, diurnal motion is enabled.
2. aiming the telescope according to the list of points in Az/Alt, the time of the start of shooting, shooting at the given exposure and number of frames, diurnal movement is turned off.
3. is there support for TLE?
4. Aiming at a point and setting a speed by RA/DE - for example, for asteroid tracking.
There are probably already many such scripts - please tell me - where to look for examples?
Thank you!
examples
- admin
- Site Admin
- Posts: 14384
- Joined: Sat Feb 11, 2017 3:52 pm
- Location: Vale of the White Horse, UK
- Contact:
Re: exasmples
Hi,
I don't think anyone has tried anything quite like this using scripting before, but it should be achievable. You can work with the connected GOTO mount via SharpCap.Mounts.SelectedMount to perform GOTO operations to either RA/Dec or Alt/Az co-ordinates inside a loop structure of your own implementation in Python. You can also do certain parts of this in SharpCap's sequencing tool (but I suspect that overall you will find gaps in the sequencer that will end up making you use the Python scripting).
There is no TLE support for orbital elements. You may be able to set RA/Dec tracking speeds by talking direct to the ASCOM driver of the GOTO mount and setting the RA and Declination tracking rates via the ASCOM ITelescopeV3 interface properties (https://ascom-standards.org/Help/Platfo ... copeV3.htm). This API can be accessed via SharpCap.Mounts.SelectedMount.AscomMount
Hope this helps,
Robin
I don't think anyone has tried anything quite like this using scripting before, but it should be achievable. You can work with the connected GOTO mount via SharpCap.Mounts.SelectedMount to perform GOTO operations to either RA/Dec or Alt/Az co-ordinates inside a loop structure of your own implementation in Python. You can also do certain parts of this in SharpCap's sequencing tool (but I suspect that overall you will find gaps in the sequencer that will end up making you use the Python scripting).
There is no TLE support for orbital elements. You may be able to set RA/Dec tracking speeds by talking direct to the ASCOM driver of the GOTO mount and setting the RA and Declination tracking rates via the ASCOM ITelescopeV3 interface properties (https://ascom-standards.org/Help/Platfo ... copeV3.htm). This API can be accessed via SharpCap.Mounts.SelectedMount.AscomMount
Hope this helps,
Robin
-
- Posts: 525
- Joined: Sun Oct 13, 2019 10:52 am
- Location: Germany
Re: examples
Hello Olek and Robin,
That is a few weeks ago. I can answer some of the questions, but I have first a question ...
Somebody ask in the few weeks ago if it could be possible to have a place on the forum to upload the scripts.
The idea was to have somewhere all the SharpCap scripts and that the programmer can update a script easily.
Today it is spread over the full forum.
Robin, do you think about this topic ?
1. I have the Occultation script where it takes a text file with the observation information and it is possible
to GOTO to the coordinates and perform a Plate Solve ... + to show the UCAC4 stars.
The observation can be started from the predicted time of the occultation. The start and stop of the capture is then automatic.
If the camera is a QHY174GPS, then the time has the GPS precision. If not then it is the PC clock precision.
viewtopic.php?p=43503#p43503
Some explanation here: viewtopic.php?p=36210#p36210
2. It would be not too difficult to transfer the Alt/Az coordinates in place of RA/Dec.
For the given exposure or number of frames ... that is easy to define.
3. no
4. That is already done ... I have a small script here. You can set the RA and the DEC at different rates.
You need to calculate the RA and DEC rates of the asteroid at the time of the observation.
It works for a comet too ... here: viewtopic.php?p=34431#p34431
Some planetarium software or JPL website can do the calculation.
Depending on the meridian flip side and the type of mount, the +DEC or -DEC direction can be inversed.
Click on RA+ or RA- to start the movement in RA direction.
Click on DEC+ or DEC- to start for the movement in DEC direction.
It is not necessary to click continuously on the button.
If you click a second time or more times on the same button, then the direction will go faster (scaled 2x, 3x, 4x, ... at each click).
The STOP button stop completely the movement. The tracking should restart if enable before the first click.
If the DEC movement is in the wrong direction, you can click on the opposite DEC button to cancel the DEC movement without stopping the RA.
For the RA movement ... it is sometime not clear if the tracking rate is taken in account or not.
Now I do not remember if I solved this problem in this script.
Regards,
Jean-Francois
That is a few weeks ago. I can answer some of the questions, but I have first a question ...
Somebody ask in the few weeks ago if it could be possible to have a place on the forum to upload the scripts.
The idea was to have somewhere all the SharpCap scripts and that the programmer can update a script easily.
Today it is spread over the full forum.
Robin, do you think about this topic ?
1. I have the Occultation script where it takes a text file with the observation information and it is possible
to GOTO to the coordinates and perform a Plate Solve ... + to show the UCAC4 stars.
The observation can be started from the predicted time of the occultation. The start and stop of the capture is then automatic.
If the camera is a QHY174GPS, then the time has the GPS precision. If not then it is the PC clock precision.
viewtopic.php?p=43503#p43503
Some explanation here: viewtopic.php?p=36210#p36210
2. It would be not too difficult to transfer the Alt/Az coordinates in place of RA/Dec.
For the given exposure or number of frames ... that is easy to define.
3. no
4. That is already done ... I have a small script here. You can set the RA and the DEC at different rates.
You need to calculate the RA and DEC rates of the asteroid at the time of the observation.
It works for a comet too ... here: viewtopic.php?p=34431#p34431
Some planetarium software or JPL website can do the calculation.
Depending on the meridian flip side and the type of mount, the +DEC or -DEC direction can be inversed.
Click on RA+ or RA- to start the movement in RA direction.
Click on DEC+ or DEC- to start for the movement in DEC direction.
It is not necessary to click continuously on the button.
If you click a second time or more times on the same button, then the direction will go faster (scaled 2x, 3x, 4x, ... at each click).
The STOP button stop completely the movement. The tracking should restart if enable before the first click.
If the DEC movement is in the wrong direction, you can click on the opposite DEC button to cancel the DEC movement without stopping the RA.
For the RA movement ... it is sometime not clear if the tracking rate is taken in account or not.
Now I do not remember if I solved this problem in this script.
Code: Select all
# *******************************************************************************************
# SharpCap script "Telescope_Control.py"
# Jean-Francois
#
# Version: 1.0 : 2023/10/09 Add "Night Vision Colours" and small bug corrections
# Version: 0.1 : 2023/10/03
#
# Conditions to be fullfilled before starting the script with SharpCap:
# ------------------------------------------------------------------
# 1. Camera is selected and running
# 2. Telescope is selected and connected
#
#
# Description of the script version 1.0:
# --------------------------------------
# Add the Night Vision Colours. It works only if the mode is selected before starting the "Telescope_Control" script.
# Add RA and DEC rates separatly
# Add version check. The script can be used with SharpCap 4.1 and 4.0
#
# Description of the script version 0.1:
# --------------------------------------
# Modification of INTI_SharpCap script
#
# *******************************************************************************************
import os
import time
import datetime
import math
import clr
clr.AddReference("System.Drawing")
clr.AddReference("System.Windows.Forms")
import System.Drawing
import System.Windows.Forms
SharpCap_version = SharpCap.AppName.Split("v")[1].Split(",")[0]
if (SharpCap_version.CompareTo("4.1") == -1): # if version below 4.1, use old ASCOM driver
clr.AddReference("ASCOM.DriverAccess")
clr.AddReference("ASCOM.Astrometry")
from ASCOM.DriverAccess import *
from ASCOM.Astrometry import *
else: # if version 4.1 or above, use new ASCOM driver
clr.AddReference("ASCOM.Com")
clr.AddReference("ASCOM.Tools")
from ASCOM.Com import *
from ASCOM.Tools import *
from datetime import datetime
from math import *
from System import EventHandler
from System.Drawing import *
from System.Threading import Thread, ApartmentState, ParameterizedThreadStart
from System.Windows.Forms import *
# ****************************************************************************************************
RA_rate_factor = 0
DEC_rate_factor = 0
Tel_Film = "T" # Telescope movement mode at start
versionCR = "Version 1.0\n" + "Jean-Fran©ois"
if (SharpCap_version.CompareTo("4.1") == -1): # if version below 4.1, path of the script location is needed
script_path = "C:\Projekte\Astro\Scripts_Desktop\Spectro"
default_icon = script_path + "\Telescope_Control.ico"
else:
script_path = os.path.dirname(__file__) # if version 4.1 or above, path is found automatically
default_icon = script_path + "\Telescope_Control.ico"
def Center_thread(self): # Action by clicking on the center button
global RA_rate_factor, DEC_rate_factor
stop_time = datetime.utcnow()
if (self.Center_Button.Text == "T"):
self.process.Log("Do nothing")
if (self.Center_Button.Text == "STOP"):
self.Center_Button.Text = Tel_Film
if (SharpCap.NightModeControl.Enabled):
self.Center_Button.BackColor = Color.Black
if (not SharpCap.NightModeControl.Enabled):
self.Center_Button.BackColor = Color.LightGray
self.Center_Button.Font = Font("Times", 28, FontStyle.Bold)
self.Center_Button.Text = "T"
self.process.Log("Stop telescope movement")
try:
if (SharpCap.Mounts.SelectedMount.Connected):
if (SharpCap.Mounts.SelectedMount.Slewing):
SharpCap.Mounts.SelectedMount.Stop()
RA_rate_factor = 0
DEC_rate_factor = 0
else:
self.process.Log_error("Telescope is not connected")
except:
self.process.Log_error("No telescope is selected")
class StatePanel(Panel):
def __init__(self, label, width, height):
super(StatePanel, self).__init__()
self.Width = width
self.Height = height
label_widget = Label()
label_widget.Text = label
label_widget.Dock = DockStyle.Top
label_widget.Height = 25
label_widget.Font = Font(label_widget.Font, FontStyle.Bold)
label_widget.Padding = Padding(3)
state_widget = RichTextBox()
state_widget.Dock = DockStyle.Top
state_widget.Height = height - label_widget.Height
state_widget.Multiline = True
state_widget.ScrollBars = RichTextBoxScrollBars.Vertical
state_widget.WordWrap = True
state_widget.ReadOnly = True
self.Controls.Add(state_widget)
self.Controls.Add(label_widget)
self.label = label_widget
self.info = state_widget
if (SharpCap.NightModeControl.Enabled):
label_widget.BackColor = Color.Black
label_widget.ForeColor = Color.DarkOrange
state_widget.BackColor = Color.Black
state_widget.ForeColor = Color.DarkOrange
if (not SharpCap.NightModeControl.Enabled):
label_widget.BackColor = Color.White
label_widget.ForeColor = Color.Black
state_widget.BackColor = Color.White
state_widget.ForeColor = Color.Black
def Log(self, text, error=False):
start_selection = self.info.Text.Length
self.info.ReadOnly = False
self.info.AppendText(str(text)+"\n")
self.info.ReadOnly = True
if error:
self.info.SelectionStart = start_selection
self.info.SelectionLength = self.info.Text.Length - start_selection
self.info.SelectionColor = Color.Red
self.info.SelectionStart = self.info.Text.Length
self.info.ScrollToCaret()
def Log_status(self, text):
self.label.Text = (str(text))
def Log_error(self, text):
self.Log(text, True)
def Clear_Log(self):
self.info.ReadOnly = False
self.info.Text = ""
self.info.ReadOnly = True
class Telescope_Control(Form):
def __init__(self):
self.SuspendLayout()
self.Text = "Telescope centring"
self.Width = 800
#self.Height = 430
self.MinimumSize = Size(350, 290)
self.MaximumSize = Size(800, 290)
self.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Dpi
self.AutoScaleDimensions = SizeF(96, 96)
self.SetupCheckButtons()
self.IsNightMode()
self.CheckConnection()
self.ResumeLayout()
def SetupCheckButtons(self):
self.VersionCR = Label()
self.DEC_plus_Button = Button()
self.RA_plus_Button = Button()
self.Center_Button = Button()
self.RA_minus_Button = Button()
self.DEC_minus_Button = Button()
self.TelRateLabel = Label()
self.TelRateLabelRA = Label()
self.TelRateLabelDEC = Label()
self.TelRateTextboxRA = TextBox()
self.TelRateTextboxDEC = TextBox()
self.ExitButton = Button()
self.process = StatePanel("Process output", width = 420, height = 220)
self.Controls.Add(self.VersionCR)
self.Controls.Add(self.DEC_plus_Button)
self.Controls.Add(self.RA_plus_Button)
self.Controls.Add(self.Center_Button)
self.Controls.Add(self.RA_minus_Button)
self.Controls.Add(self.DEC_minus_Button)
self.Controls.Add(self.TelRateLabel)
self.Controls.Add(self.TelRateLabelRA)
self.Controls.Add(self.TelRateLabelDEC)
self.Controls.Add(self.TelRateTextboxRA)
self.Controls.Add(self.TelRateTextboxDEC)
self.Controls.Add(self.ExitButton)
self.Controls.Add(self.process)
box_height = 65 # Telescope control button dimension
box_width = 65
pos_x = 145 # Telescope control button position
pos_y = 15
dist = 5 # Telescope control button gap
self.VersionCR.Text = versionCR
self.VersionCR.Location = Point(10, 10)
self.VersionCR.AutoSize = True
self.DEC_plus_Button.Text = "DEC +"
self.DEC_plus_Button.Font = Font("Times", 12, FontStyle.Bold)
self.DEC_plus_Button.Location = Point(pos_x, pos_y)
self.DEC_plus_Button.Height = box_height
self.DEC_plus_Button.Width = box_width
self.DEC_plus_Button.Click += self.DEC_plus
self.RA_plus_Button.Text = "RA +"
self.RA_plus_Button.Font = Font("Times", 12, FontStyle.Bold)
self.RA_plus_Button.Location = Point(pos_x - box_width - dist, pos_y + box_height + dist)
self.RA_plus_Button.Height = box_height
self.RA_plus_Button.Width = box_width
self.RA_plus_Button.Click += self.RA_plus
self.Center_Button.Text = "T"
self.Center_Button.Font = Font("Times", 28, FontStyle.Bold)
self.Center_Button.Location = Point(pos_x, pos_y + box_height + dist)
self.Center_Button.Height = box_height
self.Center_Button.Width = box_width
self.Center_Button.Click += self.Center
self.RA_minus_Button.Text = "RA -"
self.RA_minus_Button.Font = Font("Times", 12, FontStyle.Bold)
self.RA_minus_Button.Location = Point(pos_x + box_width + dist, pos_y + box_height + dist)
self.RA_minus_Button.Height = box_height
self.RA_minus_Button.Width = box_width
self.RA_minus_Button.Click += self.RA_minus
self.DEC_minus_Button.Text = "DEC -"
self.DEC_minus_Button.Font = Font("Times", 12, FontStyle.Bold)
self.DEC_minus_Button.Location = Point(pos_x, pos_y + 2*box_height + 2*dist)
self.DEC_minus_Button.Height = box_height
self.DEC_minus_Button.Width = box_width
self.DEC_minus_Button.Click += self.DEC_minus
self.TelRateLabel.Text = "Telescope Rate:"
self.TelRateLabel.Font = Font("Times", 10, FontStyle.Bold)
self.TelRateLabel.Location = Point(220, 5)
self.TelRateLabel.AutoSize = True
self.TelRateLabelRA.Text = "RA:"
self.TelRateLabelRA.Font = Font("Times", 10, FontStyle.Bold)
self.TelRateLabelRA.Location = Point(220, 28)
self.TelRateLabelRA.AutoSize = True
self.TelRateLabelDEC.Text = "DEC:"
self.TelRateLabelDEC.Font = Font("Times", 10, FontStyle.Bold)
self.TelRateLabelDEC.Location = Point(220, 58)
self.TelRateLabelDEC.AutoSize = True
self.TelRateTextboxRA.Text = "16"
self.TelRateTextboxRA.Font = Font("Times", 12, FontStyle.Bold)
self.TelRateTextboxRA.Location = Point(270, 25)
self.TelRateTextboxRA.Width = 60
self.TelRateTextboxDEC.Text = "16"
self.TelRateTextboxDEC.Font = Font("Times", 12, FontStyle.Bold)
self.TelRateTextboxDEC.Location = Point(270, 55)
self.TelRateTextboxDEC.Width = 60
self.ExitButton.Text = "Exit"
self.ExitButton.Location = Point(10, 200)
self.ExitButton.Width = 100
self.ExitButton.Click += self.exit
self.process.Location = Point(351, 10)
self.process.BorderStyle = BorderStyle.FixedSingle
def IsNightMode(self):
if (SharpCap.NightModeControl.Enabled):
self.StyleFromParent = False
self.BackColor = Color.Black
self.VersionCR.BackColor = Color.Black
self.DEC_plus_Button.BackColor = Color.Black
self.RA_plus_Button.BackColor = Color.Black
self.Center_Button.BackColor = Color.Black
self.RA_minus_Button.BackColor = Color.Black
self.DEC_minus_Button.BackColor = Color.Black
self.TelRateLabel.BackColor = Color.Black
self.TelRateLabelRA.BackColor = Color.Black
self.TelRateLabelDEC.BackColor = Color.Black
self.TelRateTextboxRA.BackColor = Color.Black
self.TelRateTextboxDEC.BackColor = Color.Black
self.ExitButton.BackColor = Color.Black
self.process.BackColor = Color.Black
self.VersionCR.ForeColor = Color.DarkOrange
self.DEC_plus_Button.ForeColor = Color.DarkOrange
self.RA_plus_Button.ForeColor = Color.DarkOrange
self.Center_Button.ForeColor = Color.DarkOrange
self.RA_minus_Button.ForeColor = Color.DarkOrange
self.DEC_minus_Button.ForeColor = Color.DarkOrange
self.TelRateLabel.ForeColor = Color.DarkOrange
self.TelRateLabelRA.ForeColor = Color.DarkOrange
self.TelRateLabelDEC.ForeColor = Color.DarkOrange
self.TelRateTextboxRA.ForeColor = Color.DarkOrange
self.TelRateTextboxDEC.ForeColor = Color.DarkOrange
self.ExitButton.ForeColor = Color.DarkOrange
self.process.ForeColor = Color.DarkOrange
self.process.label.BackColor = Color.Black
self.process.label.ForeColor = Color.DarkOrange
self.process.info.BackColor = Color.Black
self.process.info.ForeColor = Color.DarkOrange
if (not SharpCap.NightModeControl.Enabled):
self.StyleFromParent = True
self.BackColor = Color.White
self.VersionCR.BackColor = Color.White
self.DEC_plus_Button.BackColor = Color.White
self.RA_plus_Button.BackColor = Color.White
self.Center_Button.BackColor = Color.White
self.RA_minus_Button.BackColor = Color.White
self.DEC_minus_Button.BackColor = Color.White
self.TelRateLabel.BackColor = Color.White
self.TelRateLabelRA.BackColor = Color.White
self.TelRateLabelDEC.BackColor = Color.White
self.TelRateTextboxRA.BackColor = Color.White
self.TelRateTextboxDEC.BackColor = Color.White
self.ExitButton.BackColor = Color.White
self.process.BackColor = Color.White
self.VersionCR.ForeColor = Color.Black
self.DEC_plus_Button.ForeColor = Color.Black
self.RA_plus_Button.ForeColor = Color.Black
self.Center_Button.ForeColor = Color.Black
self.RA_minus_Button.ForeColor = Color.Black
self.DEC_minus_Button.ForeColor = Color.Black
self.TelRateLabel.ForeColor = Color.Black
self.TelRateLabelRA.ForeColor = Color.Black
self.TelRateLabelDEC.ForeColor = Color.Black
self.TelRateTextboxRA.ForeColor = Color.Black
self.TelRateTextboxDEC.ForeColor = Color.Black
self.ExitButton.ForeColor = Color.Black
self.process.ForeColor = Color.Black
self.process.label.BackColor = Color.White
self.process.label.ForeColor = Color.Black
self.process.info.BackColor = Color.White
self.process.info.ForeColor = Color.Black
def CheckConnection(self):
try:
if (SharpCap.Mounts.SelectedMount.Connected):
self.process.Log("The telescope (" + str(SharpCap.Mounts.SelectedMount) + ") is connected")
else:
self.process.Log_error("The telescope is not connected.")
if (SharpCap.Mounts.SelectedMount.Tracking):
self.process.Log("The telescope is tracking")
else:
self.process.Log_error("The tracking of the telescope is off")
except:
self.process.Log_error("No telescope is selected")
def DEC_plus(self, sender, event): # Action by clicking on the DEC+ button
global DEC_rate_factor, Tel_Film
self.IsNightMode()
if (SharpCap.NightModeControl.Enabled):
self.DEC_plus_Button.BackColor = Color.Gray
self.RA_minus_Button.BackColor = Color.Black
self.RA_plus_Button.BackColor = Color.Black
self.DEC_minus_Button.BackColor = Color.Black
if (not SharpCap.NightModeControl.Enabled):
self.DEC_plus_Button.BackColor = Color.Gray
self.RA_minus_Button.BackColor = Color.LightGray
self.RA_plus_Button.BackColor = Color.LightGray
self.DEC_minus_Button.BackColor = Color.LightGray
if (self.Center_Button.Text == "T"):
DEC_rate_factor = 1
if (self.Center_Button.Text == "STOP"):
DEC_rate_factor += 1
print("DEC_plus:", DEC_rate_factor)
if (SharpCap.Mounts.SelectedMount == None):
self.process.Log_error("No telescope is selected")
else:
if (SharpCap.Mounts.SelectedMount.Connected):
rate = abs(float(self.TelRateTextboxDEC.Text))
self.process.Log("DEC+ movement with rate = " + str("%.4f" % round(rate*DEC_rate_factor,4)))
SharpCap.Mounts.SelectedMount.MoveAxis(1, rate*DEC_rate_factor)
self.Center_Button.Text = "STOP"
self.Center_Button.Font = Font("Times", 12, FontStyle.Bold)
self.Center_Button.BackColor = Color.Red
else:
self.process.Log_error("Telescope is not connected")
def RA_minus(self, sender, event): # Action by clicking on the RA- button
global RA_rate_factor, Tel_Film
self.IsNightMode()
if (SharpCap.NightModeControl.Enabled):
self.DEC_plus_Button.BackColor = Color.Black
self.RA_minus_Button.BackColor = Color.Gray
self.RA_plus_Button.BackColor = Color.Black
self.DEC_minus_Button.BackColor = Color.Black
if (not SharpCap.NightModeControl.Enabled):
self.DEC_plus_Button.BackColor = Color.LightGray
self.RA_minus_Button.BackColor = Color.Gray
self.RA_plus_Button.BackColor = Color.LightGray
self.DEC_minus_Button.BackColor = Color.LightGray
if (self.Center_Button.Text == "T"):
RA_rate_factor = 1
if (self.Center_Button.Text == "STOP"):
RA_rate_factor += 1
print("RA_minus:", RA_rate_factor)
if (SharpCap.Mounts.SelectedMount == None):
self.process.Log_error("No telescope is selected")
else:
if (SharpCap.Mounts.SelectedMount.Connected):
if (SharpCap.Mounts.SelectedMount.Tracking): Delta_rate = 0.0
else: Delta_rate = 1.0
rate = abs(float(self.TelRateTextboxRA.Text))
self.process.Log("RA- movement with rate = " + str("%.4f" % round(rate*RA_rate_factor,4)))
if (rate == 1):
SharpCap.Mounts.SelectedMount.MoveAxis(0, rate*RA_rate_factor - 0.9999 + Delta_rate)
temp = rate*RA_rate_factor - 0.9999 + Delta_rate
else:
SharpCap.Mounts.SelectedMount.MoveAxis(0, rate*RA_rate_factor - 1.0 + Delta_rate)
temp = rate*RA_rate_factor - 1.0 + Delta_rate
print("RA = ", temp)
self.Center_Button.Text = "STOP"
self.Center_Button.Font = Font("Times", 12, FontStyle.Bold)
self.Center_Button.BackColor = Color.Red
else:
self.process.Log_error("Telescope is not connected")
def RA_plus(self, sender, event): # Action by clicking on the RA+ button
global RA_rate_factor, Tel_Film
self.IsNightMode()
if (SharpCap.NightModeControl.Enabled):
self.DEC_plus_Button.BackColor = Color.Black
self.RA_minus_Button.BackColor = Color.Black
self.RA_plus_Button.BackColor = Color.Gray
self.DEC_minus_Button.BackColor = Color.Black
if (not SharpCap.NightModeControl.Enabled):
self.DEC_plus_Button.BackColor = Color.LightGray
self.RA_minus_Button.BackColor = Color.LightGray
self.RA_plus_Button.BackColor = Color.Gray
self.DEC_minus_Button.BackColor = Color.LightGray
if (self.Center_Button.Text == "T"):
RA_rate_factor = -1
if (self.Center_Button.Text == "STOP"):
RA_rate_factor -= 1
print("RA_plus:", RA_rate_factor)
if (SharpCap.Mounts.SelectedMount == None):
self.process.Log_error("No telescope is selected")
else:
if (SharpCap.Mounts.SelectedMount.Connected):
if (SharpCap.Mounts.SelectedMount.Tracking): Delta_rate = 0.0
else: Delta_rate = 1.0
rate = abs(float(self.TelRateTextboxRA.Text))
self.process.Log("RA+ movement with rate = " + str("%.4f" % round(rate*RA_rate_factor,4)))
SharpCap.Mounts.SelectedMount.MoveAxis(0, rate*RA_rate_factor - 1.0 + Delta_rate)
print("RA = ", rate*RA_rate_factor - 1.0 + Delta_rate)
self.Center_Button.Text = "STOP"
self.Center_Button.Font = Font("Times", 12, FontStyle.Bold)
self.Center_Button.BackColor = Color.Red
else:
self.process.Log_error("Telescope is not connected")
def DEC_minus(self, sender, event): # Action by clicking on the DEC- button
global DEC_rate_factor, Tel_Film
self.IsNightMode()
if (SharpCap.NightModeControl.Enabled):
self.DEC_plus_Button.BackColor = Color.Black
self.RA_minus_Button.BackColor = Color.Black
self.RA_plus_Button.BackColor = Color.Black
self.DEC_minus_Button.BackColor = Color.Gray
if (not SharpCap.NightModeControl.Enabled):
self.DEC_plus_Button.BackColor = Color.LightGray
self.RA_minus_Button.BackColor = Color.LightGray
self.RA_plus_Button.BackColor = Color.LightGray
self.DEC_minus_Button.BackColor = Color.Gray
if (self.Center_Button.Text == "T"):
DEC_rate_factor = -1
if (self.Center_Button.Text == "STOP"):
DEC_rate_factor -= 1
print("DEC_minus:", DEC_rate_factor)
if (SharpCap.Mounts.SelectedMount == None):
self.process.Log_error("No telescope is selected")
else:
if (SharpCap.Mounts.SelectedMount.Connected):
rate = abs(float(self.TelRateTextboxDEC.Text))
self.process.Log("DEC- movement with rate = " + str("%.4f" % round(rate*DEC_rate_factor,4)))
SharpCap.Mounts.SelectedMount.MoveAxis(1, rate*DEC_rate_factor)
self.Center_Button.Text = "STOP"
self.Center_Button.Font = Font("Times", 12, FontStyle.Bold)
self.Center_Button.BackColor = Color.Red
else:
self.process.Log_error("Telescope is not connected")
def exit(self, sender, event):
try:
if (SharpCap.Mounts.SelectedMount.Slewing):
self.process.Log("Stop telescope movement")
SharpCap.Mounts.SelectedMount.Stop()
except:
self.process.Log_error("No telescope is selected")
self.process.Log("Stop script Telescope Control")
self.Close()
def Center(self, sender, event):
th_Center = Thread(ParameterizedThreadStart(Center_thread))
th_Center.SetApartmentState(ApartmentState.STA)
th_Center.Start(self)
def BeforeClosing(self, sender):
try:
if (SharpCap.Mounts.SelectedMount.Slewing):
SharpCap.Mounts.SelectedMount.Stop()
except:
self.process.Log_error("No telescope is selected")
form = Telescope_Control()
form.StartPosition = FormStartPosition.CenterScreen
form.TopMost = True
form.FormClosing += BeforeClosing
form.Show()
Jean-Francois
- admin
- Site Admin
- Posts: 14384
- Joined: Sat Feb 11, 2017 3:52 pm
- Location: Vale of the White Horse, UK
- Contact:
Re: examples
Hi,
for a 'script library', we could have a pinned topic here in the scripting forum. One post per 'script', with an announcment of what it does and a link to somewhere else (probably another forum thread) for discussions and downloads. No discussions in the 'Library' thread, just announcements.
cheers,
Robin
for a 'script library', we could have a pinned topic here in the scripting forum. One post per 'script', with an announcment of what it does and a link to somewhere else (probably another forum thread) for discussions and downloads. No discussions in the 'Library' thread, just announcements.
cheers,
Robin
-
- Posts: 525
- Joined: Sun Oct 13, 2019 10:52 am
- Location: Germany
Re: examples
Hello Robin,
Yes, could work.
And how to announce a new version ? ... Edit the pinned topic ? (and add a date of the last modification).
Regards,
Jean-Francois
Yes, could work.
And how to announce a new version ? ... Edit the pinned topic ? (and add a date of the last modification).
Regards,
Jean-Francois
- admin
- Site Admin
- Posts: 14384
- Joined: Sat Feb 11, 2017 3:52 pm
- Location: Vale of the White Horse, UK
- Contact:
Re: examples
Hi Jean-Francois,
yes, I would think that a new post in the 'dedicated' topic and an edit to the post in the pinned topic would do the trick.
I could maintain an index in the pinned first post of the items.
cheers,
Robin
yes, I would think that a new post in the 'dedicated' topic and an edit to the post in the pinned topic would do the trick.
I could maintain an index in the pinned first post of the items.
cheers,
Robin
-
- Posts: 525
- Joined: Sun Oct 13, 2019 10:52 am
- Location: Germany
Re: examples
Hello Robin,
OK, fine. We can test it.
Jean-Francois
OK, fine. We can test it.
Jean-Francois