Loading ...
Sorry, an error occurred while loading the content.

Re: AxisRate Structure

Expand Messages
  • Peter Simpson
    Hi Bill, Which version of Conform are you using? I suggest that you turn on Conform debugging; this will print out a lot more information about the various
    Message 1 of 39 , Sep 1, 2011
    View Source
    • 0 Attachment
      Hi Bill,

      Which version of Conform are you using?

      I suggest that you turn on Conform debugging; this will print out a lot more information about the various tests that Conform carries out on AxisRates (much more in version 6.0.x.x, which works on Plaform 6 only). The debug switch is in the Conform menu: Options / Conformance Options.

      The code below is from the Telescope simulator, which passes Conform tests OK.

      Regards, Peter

          //
          // AxisRates is a strongly-typed collection that must be enumerable by
          // both COM and .NET. The IAxisRates and IEnumerable interfaces provide
          // this polymorphism.
          //
          // The Guid attribute sets the CLSID for ASCOM.Telescope.AxisRates
          // The ClassInterface/None addribute prevents an empty interface called
          // _AxisRates from being created and used as the [default] interface
          //
          [System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Naming", "CA1710:IdentifiersShouldHaveCorrectSuffix"), Guid("af5510b9-3108-4237-83da-ae70524aab7d"), ClassInterface(ClassInterfaceType.None), ComVisible(true)]
          public class AxisRates : IAxisRates, IEnumerable, IEnumerator, IDisposable
          {
              private TelescopeAxes m_axis;
              private Rate[] m_Rates;
              private int pos;

              //
              // Constructor - Internal prevents public creation
              // of instances. Returned by Telescope.AxisRates.
              //
              internal AxisRates(TelescopeAxes Axis)
              {
                  m_axis = Axis;
                  //
                  // This collection must hold zero or more Rate objects describing the
                  // rates of motion ranges for the Telescope.MoveAxis() method
                  // that are supported by your driver. It is OK to leave this
                  // array empty, indicating that MoveAxis() is not supported.
                  //
                  // Note that we are constructing a rate array for the axis passed
                  // to the constructor. Thus we switch() below, and each case should
                  // initialize the array for the rate for the selected axis.
                  //
                  switch (m_axis)
                  {
                      case TelescopeAxes.axisPrimary:
                          // TODO Initialize this array with any Primary axis rates that your driver may provide
                          // Example: m_Rates = new Rate[] { new Rate(10.5, 30.2), new Rate(54.0, 43.6) }
                          m_Rates = new Rate[] { new Rate(10.0, 30.2), new Rate(43.6, 50.0) };
                          break;
                      case TelescopeAxes.axisSecondary:
                          // TODO Initialize this array with any Secondary axis rates that your driver may provide
                          m_Rates = new Rate[] { new Rate(10.0, 30.2), new Rate(43.6, 50.0) };
                          break;
                      case TelescopeAxes.axisTertiary:
                          // TODO Initialize this array with any Tertiary axis rates that your driver may provide
                          m_Rates = new Rate[] { new Rate(10.0, 30.2), new Rate(43.6, 50.0) };
                          break;
                  }
                  pos = -1;
              }

              #region IAxisRates Members

              public int Count
              {
                  get { return m_Rates.Length; }
              }

              public IEnumerator GetEnumerator()
              {
                  pos = -1; //Reset pointer as this is assumed by .NET enumeration
                  return this as IEnumerator;
              }

              public IRate this[int index]
              {
                  get
                  {
                      if (index < 1 || index > this.Count)
                          throw new InvalidValueException("AxisRates.index", index.ToString(CultureInfo.CurrentCulture), string.Format(CultureInfo.CurrentCulture, "1 to {0}", this.Count));
                      return (IRate)m_Rates[index - 1];     // 1-based
                  }
              }

              #endregion

              #region IDisposable Members

              public void Dispose()
              {
                  Dispose(true);
                  GC.SuppressFinalize(this);
              }

              // The bulk of the clean-up code is implemented in Dispose(bool)
              protected virtual void Dispose(bool disposing)
              {
                  if (disposing)
                  {
                      // free managed resources
                      m_Rates = null;
                  }
              }

              #endregion

              #region IEnumerator implementation

              public bool MoveNext()
              {
                  if (++pos >= m_Rates.Length) return false;
                  return true;
              }

              public void Reset()
              {
                  pos = -1;
              }

              public object Current
              {
                  get
                  {
                      if (pos < 0 || pos >= m_Rates.Length) throw new System.InvalidOperationException();
                      return m_Rates[pos];
                  }
              }

              #endregion
       


      --- In ASCOM-Talk@yahoogroups.com, "Bill" <williamgarylea@...> wrote:
      >
      > Gentlemen:
      >
      > I am having a problem with the AxisRate structure definition. I have
      > followed the example exactly. I have used the debugger to examine the
      > rate structure as it is being created. All the members and elements are
      > present and accessible in the debugger. However, Conform says I'm
      > passing an empty list. Can you offer any explanation? The code I'm using
      > is reproduced below:
      >
      > m_Rates = new Rate[] { new Rate( 0.00417821,
      > 0.00417821 ),
      > new
      > Rate( 0.00334257, 0.00334257 ),
      > new
      > Rate( 0.00250693, 0.00250693 ),
      > new
      > Rate( 0.00167129, 0.00167129 ) };
      >
      > Is there something strange here that I am not seeing?
      >
      > The rates I'm working with are also very odd. They are based on a
      > Sidereal tracking rate of 15.04157 degrees/hour have I missed something
      > here? When I run my move axis tests the mount is giving me much higher
      > angular rates. by a factor of 10 or 100. This is really puzzling.
      >
      > Is it better to use the theoretical rates in the language specification
      > or to MEASURE the actual speed of rotation of the shafts in the various
      > modes of operation and report those? I'm puzzled that they are so far
      > apart.
      >
      > My other problem is with Pulse guiding. My scope will not support it
      > directly. I was thinking of supporting it in software by writing a
      > routine to create a timed MoveAxis command. What puzzles me is what
      > SPEED to make the Pulse Guided adjustments at? There does not seem to be
      > a rate mechanism associated with Pulse Guiding. Should I just pick a
      > speed arbitrarily? I have 4 available:
      >
      > 1. 1.0 x Sidereal
      > 2. 0.8 x Sidereal
      > 3. 0.6 x Sidereal
      > 4. 0.4 x Sidereal
      > I'm just not familiar enough with the workings of pulse guiding to make
      > an informed decision. Have you any recommendations or suggestions?
      >
      > Bill Lea
      >
    • Chris
      Bill, We see a number of people who start by planning to extend interfaces. You will be better off learning to use what is available before thinking about
      Message 39 of 39 , Sep 9, 2011
      View Source
      • 0 Attachment
        Bill,

        We see a number of people who start by planning to extend interfaces. You will be better off learning to use what is available before thinking about that. At present you don't seem to have got any driver working.

        That said, more comments and advice below.

        > I may be sweeping on to the grand falacy, but I have put the mount driver asside for now. I need to get the camera working and I have been looking at the camera driver. I have concluded that I need to expand the camera driver interface. I need to control things like noise reduction, mirror lockup, imageSize, file handling, thumbnail generation a lot of things I don't think I can reasonably squeeze into the existing code.

        Remember this is an Astronomy interface, not a general purpose imag collection interface. You only need to implement what's required to collect astronomical images.

        Noise reduction? Do you mean the in camera noise reduction done by taking a dark frame and subtracting it for every exposure? I would put this in the setup dialog, it doesn't need to be different every time.

        Mirror lockup - also in the setup dialog.

        Image Size - if you mean the output image size you might be able to use binning but to start with I'd specify raw images and no binning.

        The image type (raw or the various sizes of jpeg image) could be set in the setup dialog. The SensorType property would change appropriately. For the Jpeg images they would be provided as three image planes and the sensor type would be colour.

        File handling and thumbnail generation are application things. There's no image saving in the driver and there isn't supposed to be.

        > So far All I can make the system do is connect to the camera. I was hoping I could generate an experimental interface for the groups consideration and my use....

        Try to walk before you run. Connecting is good - and further than I got. Set up some of the image properties - full frame, raw no binning - then try to get the exposure working.

        Once you have an image in the camera get the download working. I'd start with a single mode - raw or one frame of a jpeg image whatever is easiest - and get the data transfer working. Getting the data order correct can be tricky.

        Once that is going start extending things using the existing interface. I'm not sure how subframes will work, maybe you will have to get the entire frame from the camera and extract the subframe in the driver.

        I've written several CCD camera drivers and they are not trivial. from what I see a DSLR driver will be a complex example of the breed.

        Hope you aren't working to a deadline...

        Chris
      Your message has been successfully submitted and would be delivered to recipients shortly.