×

INDI Library v2.0.6 is Released (02 Feb 2024)

Bi-monthly release with minor bug fixes and improvements

Enhanced Joystick Control for Focuser

  • Posts: 91
  • Thank you received: 5
Hi,
I am brand new to this forum. Just upgraded my equipment and diving deeper into astronomy. First of all thank you so much for all the work you are doing here. It does look quite professional and enthusiastic, indeed.
I am using my epipment both for visual and astrophotography.

First item on my wish list is improvement for manual focus control via joystick. I would suggest some of the following:
- adjustable focuser speeds, equivalent to slew speeds. 3 different speeds would suffice here.
- more joystick options: eg. button option to select presets, focus control with joystick axis, button option to change focuser speeds
- more presets
- ideally: proportional focus control with analog joystick axis, i.e. the farther you go on one axis, the faster the focuser moves

I am currently using the Celestron SCT focuser with a Joystick. The whole equipment is being controlled via astroberry on a pi 4. My workaround currently is as follows: I select a big step size (e.g. 5.000; my focuser has around 30.000 steps) and than abort the movement when I am close to focus. I than select a smaller step size (e.g. 10 or 50) to get fine focus. However, to change the step value, I have to grab my iPad or some other device to access the indi panel. Would be much nicer, if I could just use the joystick. Same for the presets.
I am not into coding anymore. Used to do that stuff long ago (Commodore 64, hehe). But from my basic understanding at least some items from my wishlist should be quite easy to implement: having more presets and making these selectable for the joystick should work right away. Different focuser speeds are being supported by the original celestron driver (I just tried the Starsense for Skywatcher und had the celestron HC; returned it because of limited value; astroberry is way better !), so the basics should be there, too.

I would really appreciate if you could implement some of these points.

Many thanks for the great work being done already,
kind regards

Dirk Tetzlaff
3 years 8 months ago #56651

Please Log in or Create an account to join the conversation.

Hello Dirk and welcome to INDI forums!

I can help you to get familiar a bit with the code base.. I think given your background, you can probably work on getting that wishlist done yourself! So in indifocuser.cpp, you can see where we map the controller to different buttons. We process these press events in processButton function in the same file. Here you can see all the logic behind this.

There is no support for axis controls, it's just buttons now but if you feel it could be appropriate, you can add this as well following the example of INDI::Telescope class where you can see how it handles the axis. Good luck Dirk and let us know how it goes! Start off by forking INDI Repository on Github and then start hacking away at these two classes in your own tree to achieve your wishlist.
3 years 8 months ago #56664

Please Log in or Create an account to join the conversation.

  • Posts: 91
  • Thank you received: 5
Many thanks for the prompt reply. Will try to wrap my head around this. Started off by setting up a VM and installed the development environment according to the instructions. I am sure I will get back to you with some stupid questions...
Will keep you posted !
Regards
Dirk
3 years 8 months ago #56672

Please Log in or Create an account to join the conversation.

  • Posts: 91
  • Thank you received: 5
Dear knro,
I am afraid, I need some more help, please. I am not actually familiar with c and have only very rudimentary understanding of coding. By browsing through the code it occurs to me, that the celestron driver is utilitzing the standard indifocuser.cpp (via "include indifocuser.h"). Did I get it right, that this code does already provide the basis for using variable speeds ("HasVariableSpeed", "FocusSpeedN"). If so, can I just for testing purposes, set a different speed to start with ? So I first want to get the very basics right...
Many thanks
Dirk
3 years 8 months ago #57101

Please Log in or Create an account to join the conversation.

  • Posts: 91
  • Thank you received: 5
I sent a request to Celestron support regarding documentation of the focus motor commands. This is their answer:

• #define MTR_GET_POSITION 0x01 // returns 24 bit position (1000 counts per revolution)
• #define MTR_GOTO 0x02 // Coarse,follow by 24 bit position 1000 counts/rev, cancels goto if in a goto
• #define MTR_IS_GOTO_OVER 0x13 // goto over? returns 0 for no 255 for yes

• #define MTR_PMSLEW_RATE 0x24 // Move in, followed by rate 0-3
• #define MTR_NMSLEW_RATE 0x25 // Move out, followed by 0-3

• #define MTR_HS_CALIBRATION_ENABLE 0x2A // takes 8 bit value. Clears calibration data. If Value != 0, also starts calibration processes
• #define MTR_IS_HS_CALIBRATED 0x2B // returns uint8_t. true if calibration is complete, false otherwise.
• #define MTR_GET_HS_POSITIONS 0X2C // MC returns 2 uint32_t for the low side and high side limits. (typically < 65535).

• #define MTR_GET_VERSION 0xfe // return the version of the motor control

So the most basic amendment I would like to implement is the following: a assign one button to browse through the slew speeds (0-3). I define one button for "Move in" and one for "Move out". Then, "while_button_is_pressed" the slew is being executed. This way I envision the manual control of the focuser via joystick to be much more convenient and easy to use.
Can somebody please give me some more advice, exactly what and where I have to do these modifications ?
Many thanks and kind regards
Dirk
The following user(s) said Thank You: Jasem Mutlaq
3 years 7 months ago #57559

Please Log in or Create an account to join the conversation.

So if you check indifocuser.cpp , it already implements Focus In, Out, and Abort. For Slew speed, you might need to add "axis" control which is not yet mapped in the focuser class (just buttons for now). These can be implemented at the INDI::Focuser level, or perhaps you can just implement them in the celestron focuser driver directly.
3 years 7 months ago #57560

Please Log in or Create an account to join the conversation.

  • Posts: 91
  • Thank you received: 5
Ah early bird, apparently...
The way I understand the current implementation: if I press "Focus In", the focus motor is moving the amount of steps defined by the step size value, i.e. the button is not being monitored / polled to see how long it is being pressed. While the move is being executed I can press "Abort" and than the motor stops. I want to move the focus motor only while the button is pressed. So I assume I need a different mapping / logic ? what are the "HasVariableSpeed" and "FocusSpeedN" Variables in indifocuser.h for ?
Many thanks !!!
3 years 7 months ago #57563

Please Log in or Create an account to join the conversation.

  • Posts: 91
  • Thank you received: 5
one additional comment: instead of the "Abort" command I would rather map this button to cycle through the slew speeds, so while I press focus in or focus out, the focus motor slews with the speed set with the reassigned button.
3 years 7 months ago #57564

Please Log in or Create an account to join the conversation.

  • Posts: 91
  • Thank you received: 5
while browsing through the code of the celestron focuser driver"celestron.cpp" I noticed the following lines:

CelestronSCT::CelestronSCT()
{
// Can move in Absolute & Relative motions, can AbortFocuser motion.
// CR variable speed and sync removed
FI::SetCapability(FOCUSER_CAN_ABS_MOVE | FOCUSER_CAN_REL_MOVE | FOCUSER_CAN_ABORT | FOCUSER_HAS_BACKLASH);

I assume CR are the initials of Chris Rowland ? Apparently he has disabled the variable speed setting within the Celestron Focuser. How can I bring this back in ? I noticed that in the focuser simulator I can set a variable speed (1-5). So this needs to be changed to (0 -3). Where can I find the "command / value" to put the relative speed back in the driver. I searched in the "indifocuser.h" and in "indifocuser.cpp", but could not find a "SetCapability" variable. Also I would need to know, where the vaild value range for the speed is being defined, i.e. where I can set 0-3 instead of 1-5.
3 years 7 months ago #57574

Please Log in or Create an account to join the conversation.

  • Posts: 554
  • Thank you received: 138
Yes, CR is me.
I'm not sure why you need variable move speed, or how to achieve it.

The driver is designed to move to a position and does so using the MC_GOTO_FAST Celestron AUX command. This doesn't have any management of speed.

The MC_MOVE_POS and MC_MOVE_NEG commands have the ability to move at a variable rate but not to a specified position, the move continues until a rate of zero is set.

The INDI commands are moves to positions, either absolute or relative and don't seem to specify a rate.

All this seems to make setting a move speed a bit tricky to implement.

There is one possibility, there are commands which can set the rate used for the MC_GOTO_FAST command. It's the one used to restrict the maximum slew rate for the mounts.
I've never tried to use this but the commands are:

// custom rate 9 commands from EFA
SET_CUSTOM_RATE9 = 32,
GET_CUSTOM_RATE9 = 33,
SET_CUSTOM_RATE9_ENABLED = 34,
GET_CUSTOM_RATE9_ENABLED = 35,

I don't know what the units are, it seems to be continuously variable.

This is as far as I can take this, hope it helps.

Chris
3 years 7 months ago #57646

Please Log in or Create an account to join the conversation.

  • Posts: 91
  • Thank you received: 5
Chris,
first off, many thanks for the contributions to this community. I highly appreciate all the effort flowing into this !

The reason I want variable speed for the focus motor is for visual observation only. For astrophotography, the current indi implementation of the Celestron focuser is just fine. But as soon as you do visual observation and want manual focus control via joystick, the options are not ideal. If you want to focus with joystick control you will notice that the focus does change quite rapidly, so once you are close to focus you have to push the focus in or focus out button and a split second later the abort button. Achieving good focus is nearly impossible. A workaround is changing the step size, once you are close to focus but that does entail grabbing the tablet or whatever and changing the step size. Often, when you change your eyepiece, you also need to change your focus. Being able to adapt to these changing environments by just a few button presses would be quite convenient.

So when using the Celestron focuser with the Celestron HC you can choose between 3 speeds. Once you are close to focus you change to the slowest speed. While you press a button the focuser moves. If you stop pressing the button the focuser stops. This is exactly the way I would like to have the manual focus control implemented. I do not want the focus motor to move a predefined number of steps, I want it to stop when I feel the focus is optimal, i.e. I just lift my finger off the button in that moment. And for this I want the focus motor to move slowly.
So what I would like to do is assigning buttons to functions 0x24 and 0x25. While the button is pressed, the function is being called/executed. The speed value with which the function is being executed I want to set with a third button, which cycles through the three available speeds. I would assume that anybody who uses the joystick control for the focuser would welcome the opportunity to have variable speed.

Any advice how to achieve this is highly appreciated.

Many thanks

Dirk

P.S.: the indi driver currently is my only means to control the focus of my scope. I did completely away with any HC. I use a raspberry pi4 with astroberry. Eqmod controls my mount. Slewing is being done via Skysafari on a pad or with joystick. So for visual observation the indi control of the focus motor is critical.
3 years 7 months ago #57656

Please Log in or Create an account to join the conversation.

  • Posts: 554
  • Thank you received: 138
Looking at the drivers that support variable speed they seem to have an additional move command which has direction, speed and time. It looks as if this is the one to implement to get joystick control. I've no idea how, I suggest that you look at the sources for other focusers to see what they do. Some seem to ignore the speed control and use time in some way.

The MC_MOVE_POS and MC_MOVE_NEG commands are the ones to use, These take a byte in the range 0 to 9 and move at the appropiate rate, 0 being stop and 9 being full speed. The telescope axes use all 9 rates, the focuser seems to select 3 of the rates. You may find a code example using this in the celestron telescope driver. Set zero rate to stop. The Abort command uses this.

Hope this helps.
3 years 7 months ago #57678

Please Log in or Create an account to join the conversation.

Time to create page: 1.344 seconds