using_mount_classes.html 14 KB

<!DOCTYPE html>

<html>
  <head>
    <meta charset="utf-8" />
    <meta name="viewport" content="width=device-width, initial-scale=1.0" />
    <title>User guide to program with mount Python classes &#8212; Mount Control Software 1.0.0 documentation</title>
    <link rel="stylesheet" href="_static/pygments.css" type="text/css" />
    <link rel="stylesheet" href="_static/classic.css" type="text/css" />
    <link rel="stylesheet" type="text/css" href="_static/graphviz.css" />
    
    <script id="documentation_options" data-url_root="./" src="_static/documentation_options.js"></script>
    <script src="_static/jquery.js"></script>
    <script src="_static/underscore.js"></script>
    <script src="_static/doctools.js"></script>
    
    <link rel="index" title="Index" href="genindex.html" />
    <link rel="search" title="Search" href="search.html" />
    <link rel="next" title="User guide to program with celme Python classes" href="using_celme_classes.html" />
    <link rel="prev" title="Communication protocols for astromecca mounts" href="communication_langage_protocol.html" /> 
  </head><body>
    <div class="related" role="navigation" aria-label="related navigation">
      <h3>Navigation</h3>
      <ul>
        <li class="right" style="margin-right: 10px">
          <a href="genindex.html" title="General Index"
             accesskey="I">index</a></li>
        <li class="right" >
          <a href="py-modindex.html" title="Python Module Index"
             >modules</a> |</li>
        <li class="right" >
          <a href="using_celme_classes.html" title="User guide to program with celme Python classes"
             accesskey="N">next</a> |</li>
        <li class="right" >
          <a href="communication_langage_protocol.html" title="Communication protocols for astromecca mounts"
             accesskey="P">previous</a> |</li>
        <li class="nav-item nav-item-0"><a href="index.html">Mount Control Software 1.0.0 documentation</a> &#187;</li>
        <li class="nav-item nav-item-this"><a href="">User guide to program with mount Python classes</a></li> 
      </ul>
    </div>  

    <div class="document">
      <div class="documentwrapper">
        <div class="bodywrapper">
          <div class="body" role="main">
            
  <div class="section" id="user-guide-to-program-with-mount-python-classes">
<h1>User guide to program with mount Python classes<a class="headerlink" href="#user-guide-to-program-with-mount-python-classes" title="Permalink to this headline">¶</a></h1>
<p>This section show how to use Mount classes in a Python code.</p>
<div class="section" id="classes-and-attributes">
<h2>1. Classes and attributes<a class="headerlink" href="#classes-and-attributes" title="Permalink to this headline">¶</a></h2>
<img alt="_images/classes_mount.png" src="_images/classes_mount.png" />
<p>The mountastro module provides the class Mountastro
which contains almost all the methods to drive mounts.
Mountastro provides methods only for simulations
but all these methods call also an abstract method
for real mounts. The abstracts methods are concreted
in a dedicated class. For example, for AstroMECCA mounts
the class Mountastro_Astromecca inherits the Mountastro
methods and provides concrete methods.</p>
</div>
<div class="section" id="examples-of-python-codes-to-instanciate-the-mount">
<h2>2. Examples of Python codes to instanciate the mount<a class="headerlink" href="#examples-of-python-codes-to-instanciate-the-mount" title="Permalink to this headline">¶</a></h2>
<p>To include the mount classes in a python program, one must import
the desired classes:</p>
<div class="highlight-default notranslate"><div class="highlight"><pre><span></span><span class="kn">import</span> <span class="nn">celme</span>
<span class="kn">import</span> <span class="nn">mountastro_astromecca</span>
</pre></div>
</div>
<p>Define the site where the telescope is installed:</p>
<div class="highlight-default notranslate"><div class="highlight"><pre><span></span><span class="n">home</span> <span class="o">=</span> <span class="n">celme</span><span class="o">.</span><span class="n">Home</span><span class="p">(</span><span class="s2">&quot;GPS 2.0375 E 43.6443484725 136.9&quot;</span><span class="p">)</span>
<span class="n">site</span> <span class="o">=</span> <span class="n">celme</span><span class="o">.</span><span class="n">Site</span><span class="p">(</span><span class="n">home</span><span class="p">)</span>
</pre></div>
</div>
<p>The home geographic coordinates must be adjusted to the location of the mount.
Instanciate the class Mountastro_Astromecca:</p>
<div class="highlight-default notranslate"><div class="highlight"><pre><span></span><span class="n">mount1</span> <span class="o">=</span> <span class="n">mountastro</span><span class="o">.</span><span class="n">Mountastro_Astromecca</span><span class="p">(</span><span class="s2">&quot;HADEC&quot;</span><span class="p">,</span> <span class="n">name</span><span class="o">=</span><span class="s2">&quot;My Mount&quot;</span><span class="p">,</span> <span class="n">manufacturer</span><span class="o">=</span><span class="s2">&quot;AstroMECCA&quot;</span><span class="p">,</span> <span class="n">model</span><span class="o">=</span><span class="s2">&quot;TM350&quot;</span><span class="p">,</span> <span class="n">serial_number</span><span class="o">=</span><span class="s2">&quot;beta001&quot;</span><span class="p">,</span> <span class="n">site</span><span class="o">=</span><span class="n">site</span><span class="p">,</span> <span class="n">CONTROLLER_BASE_ID</span><span class="o">=</span><span class="mi">1</span><span class="p">,</span> <span class="n">CONTROLLER_POLAR_ID</span><span class="o">=</span><span class="mi">2</span><span class="p">)</span>
</pre></div>
</div>
<p>HADEC stands for the fact the axes of the mount are oriented according an equatorial mount.
The protocol to communicate with the controller used for AstroMECCA mounts must be configured.
The following lines show how to get available list of serial ports and configre it:</p>
<div class="highlight-default notranslate"><div class="highlight"><pre><span></span><span class="n">tools</span> <span class="o">=</span> <span class="n">mountastro</span><span class="o">.</span><span class="n">Mounttools</span><span class="p">()</span>
<span class="n">available_serial_ports</span> <span class="o">=</span> <span class="n">tools</span><span class="o">.</span><span class="n">get_available_serial_ports</span><span class="p">()</span>
<span class="nb">print</span><span class="p">(</span><span class="s2">&quot;Avaible serial ports </span><span class="si">{}</span><span class="s2">&quot;</span><span class="o">.</span><span class="n">format</span><span class="p">(</span><span class="n">available_serial_ports</span><span class="p">))</span>
<span class="n">port</span> <span class="o">=</span> <span class="s2">&quot;/dev/ttySC0&quot;</span>
<span class="n">mount1</span><span class="o">.</span><span class="n">set_channel_params</span><span class="p">(</span><span class="s2">&quot;SERIAL&quot;</span><span class="p">,</span> <span class="n">port</span><span class="o">=</span><span class="n">port</span><span class="p">,</span> <span class="n">baud_rate</span><span class="o">=</span><span class="mi">115200</span><span class="p">,</span> <span class="n">delay_init_chan</span><span class="o">=</span><span class="mf">0.1</span><span class="p">,</span> <span class="n">end_of_command_to_send</span><span class="o">=</span><span class="s2">&quot;</span><span class="se">\r\n</span><span class="s2">&quot;</span><span class="o">.</span><span class="n">encode</span><span class="p">(</span><span class="s1">&#39;utf8&#39;</span><span class="p">),</span> <span class="n">end_of_command_to_receive</span><span class="o">=</span><span class="s2">&quot;</span><span class="se">\r\n</span><span class="s2">&quot;</span><span class="o">.</span><span class="n">encode</span><span class="p">(</span><span class="s1">&#39;utf8&#39;</span><span class="p">),</span> <span class="n">delay_put_read</span><span class="o">=</span><span class="mf">0.06</span><span class="p">)</span>
</pre></div>
</div>
<p>The port key must be available in the list of serial ports.</p>
</div>
<div class="section" id="examples-of-python-codes-to-drive-the-mount">
<h2>3. Examples of Python codes to drive the mount<a class="headerlink" href="#examples-of-python-codes-to-drive-the-mount" title="Permalink to this headline">¶</a></h2>
<p>Prerequisite is to have instanciated an object (mount1)
as explained in the previous section.</p>
<p>To get current coordinates of the mount:</p>
<div class="highlight-default notranslate"><div class="highlight"><pre><span></span><span class="n">ra</span><span class="p">,</span> <span class="n">dec</span><span class="p">,</span> <span class="n">side</span> <span class="o">=</span> <span class="n">mount1</span><span class="o">.</span><span class="n">radec_coord</span><span class="p">()</span>
</pre></div>
</div>
<p>The side is where the tube lies. Side can be 1 or -1.
If side = 1 the tube is in regular position.
If side = -1 the tube is in fliped position.</p>
<p>To slew the mount to a target defined by J2000 astronomical coordinates:</p>
<div class="highlight-default notranslate"><div class="highlight"><pre><span></span><span class="n">mount1</span><span class="o">.</span><span class="n">radec_goto</span><span class="p">(</span><span class="s2">&quot;3h5m56.45s&quot;</span><span class="p">,</span><span class="s2">&quot;+3d51m34.1s&quot;</span><span class="p">)</span>
</pre></div>
</div>
<p>The methods radec_coord and radec_goto, it is possible to
add options as equinox or output formats.</p>
<p>Example of options to get coordinates at the equinox of the date
and outputs in decimal degrees:</p>
<div class="highlight-default notranslate"><div class="highlight"><pre><span></span><span class="n">ra</span><span class="p">,</span> <span class="n">dec</span><span class="p">,</span> <span class="n">side</span> <span class="o">=</span> <span class="n">mount1</span><span class="o">.</span><span class="n">radec_coord</span><span class="p">(</span><span class="s2">&quot;deg&quot;</span><span class="p">,</span> <span class="s2">&quot;deg&quot;</span><span class="p">,</span> <span class="n">equinox</span><span class="o">=</span><span class="s2">&quot;NOW&quot;</span><span class="p">)</span>
</pre></div>
</div>
<p>To start a move on declination axis at the rate of 2 deg/sec:</p>
<div class="highlight-default notranslate"><div class="highlight"><pre><span></span><span class="n">mount1</span><span class="o">.</span><span class="n">hadec_move</span><span class="p">(</span><span class="mi">0</span><span class="p">,</span> <span class="mi">2</span><span class="p">)</span>
</pre></div>
</div>
<p>To stop a move motion:</p>
<div class="highlight-default notranslate"><div class="highlight"><pre><span></span><span class="n">mount1</span><span class="o">.</span><span class="n">hadec_move_stop</span><span class="p">()</span>
</pre></div>
</div>
<p>To stop a any motion:</p>
<div class="highlight-default notranslate"><div class="highlight"><pre><span></span><span class="n">mount1</span><span class="o">.</span><span class="n">hadec_stop</span><span class="p">()</span>
</pre></div>
</div>
</div>
</div>


            <div class="clearer"></div>
          </div>
        </div>
      </div>
      <div class="sphinxsidebar" role="navigation" aria-label="main navigation">
        <div class="sphinxsidebarwrapper">
  <h3><a href="index.html">Table of Contents</a></h3>
  <ul>
<li><a class="reference internal" href="#">User guide to program with mount Python classes</a><ul>
<li><a class="reference internal" href="#classes-and-attributes">1. Classes and attributes</a></li>
<li><a class="reference internal" href="#examples-of-python-codes-to-instanciate-the-mount">2. Examples of Python codes to instanciate the mount</a></li>
<li><a class="reference internal" href="#examples-of-python-codes-to-drive-the-mount">3. Examples of Python codes to drive the mount</a></li>
</ul>
</li>
</ul>

  <h4>Previous topic</h4>
  <p class="topless"><a href="communication_langage_protocol.html"
                        title="previous chapter">Communication protocols for astromecca mounts</a></p>
  <h4>Next topic</h4>
  <p class="topless"><a href="using_celme_classes.html"
                        title="next chapter">User guide to program with celme Python classes</a></p>
  <div role="note" aria-label="source link">
    <h3>This Page</h3>
    <ul class="this-page-menu">
      <li><a href="_sources/using_mount_classes.rst.txt"
            rel="nofollow">Show Source</a></li>
    </ul>
   </div>
<div id="searchbox" style="display: none" role="search">
  <h3 id="searchlabel">Quick search</h3>
    <div class="searchformwrapper">
    <form class="search" action="search.html" method="get">
      <input type="text" name="q" aria-labelledby="searchlabel" />
      <input type="submit" value="Go" />
    </form>
    </div>
</div>
<script>$('#searchbox').show(0);</script>
        </div>
      </div>
      <div class="clearer"></div>
    </div>
    <div class="related" role="navigation" aria-label="related navigation">
      <h3>Navigation</h3>
      <ul>
        <li class="right" style="margin-right: 10px">
          <a href="genindex.html" title="General Index"
             >index</a></li>
        <li class="right" >
          <a href="py-modindex.html" title="Python Module Index"
             >modules</a> |</li>
        <li class="right" >
          <a href="using_celme_classes.html" title="User guide to program with celme Python classes"
             >next</a> |</li>
        <li class="right" >
          <a href="communication_langage_protocol.html" title="Communication protocols for astromecca mounts"
             >previous</a> |</li>
        <li class="nav-item nav-item-0"><a href="index.html">Mount Control Software 1.0.0 documentation</a> &#187;</li>
        <li class="nav-item nav-item-this"><a href="">User guide to program with mount Python classes</a></li> 
      </ul>
    </div>
    <div class="footer" role="contentinfo">
        &#169; Copyright 2021, astromecca.
      Created using <a href="https://www.sphinx-doc.org/">Sphinx</a> 3.4.0.
    </div>
  </body>
</html>