Skip to content

Enforcing safe zone in RotatorInterface #2425

Description

@olsonse

@knro

I've just finished some changes to indirotatorinterface.cpp to unify rotator response. This new patch enforces the safe zone, such that the rotator would not be allowed to travel out of the safe zone to get to a target angle. It may be that the rotator would instead take the longer route to the intended target in order to avoid traversing the non-safe region. One of the side effects of the changes I've made is that all rotators would be commanded to go the optimal direction (shortest path when possible). There are a few issues, as outlined below, with these changes that should be resolved before I submit a pull request. I am seeking thoughts and inputs to remedy these issues.

Background

I've been spending a lot of time fixing the WanderRotator interface to make it substantially more robust. In the process, I have also been looking at some of the intended purposes of the RotatorInterface. In particular, 19a0e9d strengthened the description of the RotatorLimitsNP to represent a safe zone, centered around a reference angle. The intent is obviously to ensure that a rotator can keep cables somewhat stable and untwisted. The problem with the patch in 19a0e9d is that it is possible that a rotator would still move to a new location that is indeed in the safe zone but pass out of the safe zone to get there. One can easily demonstrate this with the Rotator Simulator.

This issue may not happen with all rotators and not with all directions of travel. While some rotator drivers appear to just take the commanded target as is, other rotators modify the commanded motion to select the shortest rotation required to obtain the target angle. It is not clear how many of the rotators may auto-select a different rotation angle internal to their firmware. The rotator simulator, for example, implicitly always travels the shortest distance.

Doing these changes has made me realize that the only way to properly enforce the safe zone is to change MoveRotator such that devices are requested to move in a specific direction to their target.

Now the real focus of this issue:

  • All drivers would need to eventually be changed to affect a common response.
  • The changes I have made so far cause a breakage in compilation for drivers that are not updated.
  • Looking through all the rotators supported in indi and indi-3rdparty, it seems challenging to determine whether all rotators do support rotating in both directions. I would assume so, but cannot find definite documentation.
  • It is also challenging to determine actual current response for all rotators since some rotators appear to only be commanded with absolute angles and may not have relative motion control. Possibly resolved by better documentation that I cannot find from vendors.

I think it would be advantageous for RotatorInterface to do as much as possible to unify the rotator response--what my current changes attempt to realize. My current patch modifies MoveRotator to accept both the absolute angle and the signed delta angle for a driver to base its commands on. There are backwards-compatibility issues and I am looking for thoughts before I issue a pull request.

I see the following options:

  • Go ahead and modify MoveRotator in all known rotators in indi and indi-3rdparty to take a second argument. For some rotators, it will be clear how to correctly respond. For others, we may choose to ignore the second argument and simply keep responses as they now are. It would be the exercise of others who have documentation and know the other devices better to fix these.
  • Introduce an overloaded version of MoveRotator with absolute and relative motion arguments. RotatorInterface would first try calling this new version of MoveRotator and then failover to the old version of MoveRotator if it is detected that the driver did not override the new version of MoveRotator. This also leaves current functionality mostly in place while also leaving the current interface in place. This approach may seem nice because of clean backwards compatibility, but it creates a divergence in the type of interface that RotatorInterface presents as compared with all other INDI interfaces. In order to not have immediate impact to all other drivers, it would have to be a non-pure virtual function. Name hiding in c++ would keep this somewhat invisible to all drivers except for where RotatorInterface calls it. Another challenge for this approach will be how RotatorInterface detects if a driver truly did not override the new MoveRotator overload. A hackish way to do this is for the default version of the new MoveRotator overload to return a bogus IPState, such as -1 statically casted to IPState.

I think I prefer the cleaner first option, even while this will break compilation for any rotators that are not changed. I can fix compilation for all drivers in indi and indi-3rdparty with subsequent patches as described in the first option above. Further, this would force any private driver developers to know that there is a new interface that requests a specific signed delta angle in order to reach a target angle.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Fields

    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions