Short-bus / pilomar

RaspberryPi based miniature observatory
https://shortbus.blog/
GNU General Public License v3.0
63 stars 14 forks source link

2024 01 issues merged to main branch. #63

Closed Short-bus closed 5 months ago

Short-bus commented 5 months ago

Summary of changes in the "2024-01-issues" branch.

OBJECTIVE Use feedback from people who have built a pi-lomar to fix some bugs and niggles. Make it easier to identify common mistakes and problems that people have had.

ISSUES ADDRESSED

44 Issues related to CircuitPython 8.x installation on Tiny2040. (enhancement)

51 Preview can inherit previous target as background. (bug)

52 Move more motor parameters into parameter file. (enhancement)

53 src/pilomarimage.py CalculateStarSpread() fails for bright skies. (bug)

54 Tree branches confuse Astroalign. (enhancement)

56 Target selection menu does not recognise the 'x' key. (bug)

57 Simplify microstepping configuration for motors. (enhancement)

58 Can pilomar run on RPi4B with Bookworm o/s? (enhancement)

59 ProjectRoot not fully respected bug. (bug)

MICROCONTROLLER SOFTWARE circuitpython/code.py The program now also runs on CircuitPython 8.x. You nolonger need to find the archived copy of CircuitPython 7.2. Message processing cleaned to avoid confused data if versions are out of sync. OptimiseMoves parameter now allows unlimited rotation in any direction. This improves performance in more Southern latitudes. Gearing and step signal configuration now set in motor configuration message. Set it via the parameter file. The old UseMicrostepping parameter has been removed because it has no effect. There are other ways to introduce microstepping. See below. DRV8825 fault signal handling improved. GPIO pins now use PULL-UP setting and fault status latches more appropriately. This is better protection from unconnected floating pins triggering random on/off fault signals. Multiple changes to the code to help identify communication problems.

RASPBERRY PI SOFTWARE src/pilomarimage.py, pilomarlogfile.py, pilomartimer.py, pilomar.py, textcolor.py

General updates and continuing cleanup of code.
MotorsEnabled and UseMicrostepping parameters removed because they had no function anymore.
    Microstepping is still possible via other options. See below.
Motor configurations now taken from parameter file rather than hardcoded values.
    This supports builds which use alternative motors.
    MinAngle,MaxAngle,GearRatio,MotorStepsPerRev,MicrostepRatio,RestAngle,BacklashAngle,Orientation
    All now taken from the parameter file. Values are available for each motor separately.
    FastTime,SlowTime,TimeDelta now taken from parameter file, global values for both motors.
    This means that you can tailor these values in your build and the values will be retained if you update
    the software. In previous versions these values were hardcoded so you would have to re-edit the source 
    codes each time you took an update.
Microstepping support simplified.
    To activate microstepping just set the 'MicrostepRatio' parameter to the number of microsteps you want the motor to take.
    The program will revise all related parameters in the RPi and Microcontroller configurations.
    If you change MicrostepRatio you must power cycle the RPi and microcontroller to ensure that the new configurations propogate correctly.
Cleanup of preview image.
    Parameters to control the number of labels added. Keeps image more clear.
Latitudes in Southern Hemisphere now allowed.
    Previous 'error' message is now removed. Feedback suggests that the telescope will operate OK.
    See the new OptimiseMoves parameter to allow more free movement if needed.
GOTO and HOME moves now report progress during moves.
    This gives some reassurance that things are happening on large moves.
    GOTO nolonger reports an error if a single attempt to move does not complete in 30 seconds.
    - The limit is now 60 seconds, an error is only reported if all allowed retries fail.
    - False alarms were sometimes raised if there was a backlog of microcontroller messages to handle before the move could begin.
    - Any stale messages are now flushed at the start of the observation to reduce the processing delay.
Code protected from empty starlists, eg if capturing daylight images.
    Drift tracking routines could crash if a blue-sky (or total cloud) image had no stars at all.
NGC catalog data is now cached rather than being recalculated.
    This makes the program start up faster.
    NGC Catalog now includes the 'type' of object, this is included in Preview image labelling.
Now an option to generate a short AVI animation of the preview images at the end of an observation.
    AVI is created in the session's /preview folder to show motion of the target and surrounding stars during the observation.
    Set the parameter GeneratePreview to False to remove this option.
The raspistill commands to capture different types of images are now held as templates in the parameter file.
    You can edit these templates if you want to change the options. Your changes will be retained across future versions.
Camera image buffers are reset at the start of each observation so previous and current target images do not get confused.
Improvements to the 'about' and 'status' options on various menus to show more information.
    Making more information available to understand configuration and its effects.
View Parameters option now highlights which parameters have been changed from their defaults.
Timer objects now use non-blocking wait() instead of sleep() to improve performance.
Some new parameters introduced (currently for documentation only, but may be used functionally in future versions).
    BoardType : A label to identify the motorcontroller PCB, so that variations can be supported.
    IRFilter : Indicates whether the sensor has an infrared filter (default True)
    PollutionFilter : Indicates whether a light pollution filter is in place (default False)
The initial 'target selection' menu now allows you to 'x' out instead of forcing you to select a target.
    If you 'x' out, your last target is selected automatically.
    If you have not made any observations yet you MUST still choose a target before you can continue.
More visible warnings if communication is not working as expected.
    UART teething problems seem to be common with new builds, so the program has more facilities to monitor/alert.
    The green 'status' display shown as the program starts up includes a check and report for suspected comms problems.
    Select the Status option from the main menu to view it again.
'Monitor communication' option added to the Microcontroller Tools menu. 
    This shows traffic in both directions in realtime so you can see what is working.
    You can 'reset' the microcontroller from this display and watch the microcontroller reconfigure itself by pressing the 'r' key.
    You can send an example yellow flash to the microcontroller LED to prove the microcontroller is understanding and responding by pressing the 'f' key.
    This shows if communication is working as planned.
Initial support for Bookworm 64bit operating system on RPi4 added.
    This is not heavily tested yet, functionality may still change.
    It ONLY works on the Raspberry Pi 4 at present.
    - The RPi5 hardware needs further changes, the current version will NOT work on an RPi5.
    - The RPi3 does not support Bookworm.
    The software uses libcamera when running under Bookworm.
    The software uses rapistill when running under Buster.
    The 64bit O/S improves overall performance.
    The program will check the combination of hardware and o/s at startup to be sure you have a supported combination.
    On RPi3 pi-lomar only works with Buster 32bit.
    On RPi4 pi-lomar works with Buster 32bit or Bookworm 64bit.
    The RPi5 is not yet supported.
The opencv routines to enhance images for tracking calculations are also now parameterised.
    The original version had a single hardcoded enhancement routine.
    The new version allows you to create and edit enhancement scripts in the parameter file.
    If your observation conditions require special enhancement parameters for reducing haze or making stars more clear
    you can now set the values without having to modify the software itself.
    There are two scripts included by default.
    - (1) 'EnhanceStars': Increases contrast in the image to help drift tracking identify stars more clearly.
    - (2) 'UrbanHaze': Removes common urban haze gradient from the image then enhances the remaining stars.
          This also seems to reduce tree branches in some cases.

RASPBERRY PI SCRIPTS scripts/buildpilomar_bookworm64, scripts/buildpilomar_buster32, scripts/zip-pilomar

You can now build pi-lomar on the BOOKWORM 64bit operating system on the RPi4. Use scripts/buildpilomar_bookworm64 when performing the initial build.

You can build pi-lomar on the BUSTER 32bit operating system on the RPi4 and RPi3. Use scripts/buildpilomar_buster32 when performing the initial build.

The zip-pilomar script now correctly stores the circuitpython code.

Draft documentation docs/Pilomar Manual 2024-02-26.pdf

Parameter list updated to new version.
Includes an example of an observation with images of various stages of the process.