Skip to content

Oculars telrad: cannot set telrad view FOV rings from Remote Control pluginΒ #4780

Closed

Description

@gchiozzi

Expected Behaviour

I am trying to use the Remote Control plugin sending set commands to configure from an external script the Oculars TelradVieW, i.e. the diameter of the Telrad circles.
This works fine for many other settings, but I do not get it working for this specific purpose.
My python code is:

##################################
# Set FOV Circular markers size in degrees

# Warning: this command does not seem to work, despite 
#          the fact that it does not produce errors.
#          Configure instead the size of the rings
#          in the Oculars UI (see section 8 of the hlcc User Manual)
#          GCH: I feel that there is a problem with the passing of the
#               parameters, but I could not make it working

#
# Imports to create http requests to the remote control
# server of stellarium
#
import requests
import subprocess

#
# Root URL to communicate with the stellarium remote control server
# Put here the correct IP address and make sure that the remote control plugin is 
# configured and running.
#
ip = "127.0.0.1"
url_main = f"http://{ip}:8090/api/"
property = "Oculars.telradFOV"


#marker_sizes = [0.16, 0.06, 0.0, 0.0]  # 10 arcmin, 4 arcmin
#marker_sizes = "'[0.16, 0.06, 0.0, 0.0]'"  # 10 arcmin, 4 arcmin
marker_sizes = "0.16,0.06,0.0,0.0"  # Test values

param_fov_marker = {"id" : property, "value": marker_sizes}
telrad_fov = requests.post(url_main + 'stelproperty/set', data=param_fov_marker)

properties = requests.get(url_main + 'stelproperty/list')
print("Current FOV markers        {}: {}".format(property, properties.json().get(property).get("value")))

print("Set size for Telrad FOV circular markers: ", telrad_fov, " to: ", marker_sizes, " deg")

properties = requests.get(url_main + 'stelproperty/list')
print("New FOV markers            {}: {}".format(property, properties.json().get(property).get("value")))
#print(properties.json())
##################

I would expect the output:

eltdev@elthlccd275 ~/tmp $ python3 ./oculars.py
Current FOV markers        Oculars.telradFOV: [0.03, 0.08, 0, 0]
Set size for Telrad FOV circular markers:  <Response [200]>  to:  0.16,0.06,0.0,0.0  deg
New FOV markers            Oculars.telradFOV: [0.16, 0.06, 0, 0]

Actual Behaviour

Instead I get:

eltdev@elthlccd275 ~/tmp $ python3 ./oculars.py
Current FOV markers        Oculars.telradFOV: [0.03, 0.08, 0, 0]
Set size for Telrad FOV circular markers:  <Response [200]>  to:  0.16,0.06,0.0,0.0  deg
New FOV markers            Oculars.telradFOV: [0.03, 0.08, 0, 0]

i.e. the new Telrad values are not set, even though I get an OK reply <Response [200]>
I have tried several formats for defining marker_sizes, a few of them commented out in the code above, but none works.
I believe that the uncommented one should be correct one.

Or there is a syntax for setting marker_sizes that I have not tried, or there is a bug in manipulating this property.

Steps to reproduce

Stat stellarium with the Remote Control and Oculars plugin enables and run the python script pasted above.

System

  • Stellarium version: 25.3
  • Operating system: AlmaLinux release 10.1 (Heliotrope Lion)

Logfile

Nothing useful in the log file

Help would be very much appreciated!!!
Thanks in advance.

Activity

  1. alex-w commented on Feb 19, 2026

    @alex-w
    Member

    Oculars.telradFOV is expected Vec4f as parameter, not a string

  2. gchiozzi commented on Feb 19, 2026

    @gchiozzi
    Author

    Thanks @alex-w, I have seen that, but my understanding was that the conversion was done along the way down through the web server of the Remote control plugin.
    Do you know what syntax should I use in the string that I pass to the post command to have it understood as a Vec4f and passed down to the Oculars plugin in the right way?

  3. gchiozzi commented on Feb 19, 2026

    @gchiozzi
    Author

    By the way, I have asked both google ai and copilot.
    They give me essentially the same code I have posted above, but with two different formats for the value string:

    Google: vec4f_value = "[0.0, 1.0, 0.0, 1.0]"
    Copilot: vec4_value = "0.5,2.0,4.0,0.0"

    I had already tested both and none works.

    Google says in the description:

    To set a StelProperty that requires a Vec4f (a vector of 4 floats, typically used for RGBA colors or 4D coordinates) using the Stellarium Remote Control plugin, you must pass the data as a JSON-formatted string representing an array of four numbers to the /api/stelproperty/set endpoint.

    API Method
    Endpoint: POST /api/stelproperty/set
    Parameters:
    id: The string ID of the StelProperty (e.g., "SolarSystem.textColor").
    value: A JSON array string "[r,g,b,a]" (e.g., "[1.0, 0.5, 0.0, 1.0]").

    Example using curl

    To set the constellation boundary color (which uses a Vec4f for RGBA) to red:
    bash
    curl -X POST "http://localhost:8090/api/stelproperty/set" \
         -d "id=ConstellationMgr.boundariesColor" \
         -d "value=[1.0,0.0,0.0,1.0]"
    

    Example using Python

    python
    import requests
    
    # Stellarium Remote Control URL
    url = "http://localhost:8090/api/stelproperty/set"
    
    # Set a color Vec4f (e.g., RGBA)
    property_id = "SolarSystem.textColor"
    # Value is a JSON string of 4 floats
    vec4f_value = "[0.0, 1.0, 0.0, 1.0]" 
    
    payload = {
        'id': property_id,
        'value': vec4f_value
    }
    
    response = requests.post(url, data=payload)
    print(response.text)
    

    Key Details
    Data Format: The value parameter must be a JSON array string containing four floats, specifically [x,y,z,w] or [r,g,b,a].
    QVariant Logic: The Remote Control plugin converts this string input into the appropriate Vec4f type within Stellarium using QVariant logic.

  4. 10110111 commented on Feb 19, 2026

    @10110111
    Contributor

    It looks like there exists a conversion from Vec4f to string (via QVariant), but not backwards. So an attempt to write a property will write a zero vector.

  5. gzotti commented on Feb 19, 2026

    @gzotti
    Member

    When adapting the Vec3d stuff for Qt6 scripting, I may have forgotten about the rare Vec4d (and Vec2d?), so (must check), a V4d class may have to be added.

  6. added this to the 26.1 milestone on Feb 19, 2026
  7. 10110111 commented on Feb 19, 2026

    @10110111
    Contributor

    When adapting the Vec3d stuff for Qt6 scripting

    This is not about scripting, it's about the RemoteControl POST API.

    The issue begins in StelProperty::setValue, where the QVariant is a QString, while the property is Vec4f. In this case QMetaType::canConvert with these types returns false.

  8. gzotti commented on Feb 19, 2026

    @gzotti
    Member

    This means it is even older? (2016...) In any case, the solution most likely has parallels in Vec3d/V3d.

  9. 10110111 commented on Feb 19, 2026

    @10110111
    Contributor

    In any case, the solution most likely has parallels in Vec3d/V3d.

    Not sure what you mean, the solution is as follows (and similarly for the rest of the types). Why the converters had been registered for to-string conversion but not back, I don't know.

    diff --git a/src/core/StelCore.cpp b/src/core/StelCore.cpp
    index 01c075f0e5..f7f4ce5e74 100644
    --- a/src/core/StelCore.cpp
    +++ b/src/core/StelCore.cpp
    @@ -2340,6 +2340,8 @@ void StelCore::registerMathMetaTypes()
         QMetaType::registerConverter(&Vec4f::toString);
         QMetaType::registerConverter(&Vec4i::toString);
     
    +    QMetaType::registerConverter<QString,Vec4f>(&Vec4f::fromBracketedString);
    +
         //Hopefully this works to convert types in scripts when given as String "[...]"
         // Maybe even make brackets optional!
         // Nope, does not work for QJSEngine.

    Then the updated Python script works well:

    #!/usr/bin/env python3
    
    import requests
    import subprocess
    
    ip = "127.0.0.1"
    url_main = f"http://{ip}:8090/api/"
    property = "Oculars.telradFOV"
    
    
    marker_sizes = "[0.16,0.06,0.0,0.0]"  # Test values
    
    properties = requests.get(url_main + 'stelproperty/list')
    print("Current FOV markers        {}: {}".format(property, properties.json().get(property).get("value")))
    
    param_fov_marker = {"id" : property, "value": marker_sizes}
    telrad_fov = requests.post(url_main + 'stelproperty/set', data=param_fov_marker)
    print("Set size for Telrad FOV circular markers: ", telrad_fov, " to: ", marker_sizes, " deg")
    
    properties = requests.get(url_main + 'stelproperty/list')
    print("New FOV markers            {}: {}".format(property, properties.json().get(property).get("value")))

    Output:

    $ ./test.py 
    Current FOV markers        Oculars.telradFOV: [0.1678, 0.05555, 0.003, 0]
    Set size for Telrad FOV circular markers:  <Response [200]>  to:  [0.16,0.06,0.0,0.0]  deg
    New FOV markers            Oculars.telradFOV: [0.16, 0.06, 0, 0]
    
  10. 10110111 commented on Feb 19, 2026

    @10110111
    Contributor

    Ah, I missed the comment after my added line. These converters were commented out in 7ce6ccd. No idea why though.

  11. added theissue type on Feb 20, 2026
  12. alex-w commented on Feb 20, 2026

    @alex-w
    Member

    Ah, I missed the comment after my added line. These converters were commented out in 7ce6ccd. No idea why though.

    Probably some troubles was in scripting engine for Qt6 - @gzotti any comments please

  13. gzotti commented on Feb 20, 2026

    @gzotti
    Member

    Well it seems I tried to find out which solution worked in the attempt to use both scripting ways (Qt5/Qt6). It seems that I had already added the converter which @10110111 suggested, tried for something I wanted to achieve in QJEngine, found not helpful or not required at that time, so I commented it away "for now". If it is useful in this case and doesn't break Qt6 scripting, we can activate these lines again.

  14. self-assigned this
    on Feb 20, 2026
  15. moved this from Backlog to Done in Pluginon Feb 20, 2026
  16. gzotti commented on Feb 20, 2026

    @gzotti
    Member

    It works on Qt5 and Qt6, all tests run. Now I hope there is no other issue reactivated...

  17. added a commit that references this issue on Feb 21, 2026
    5c74443
  18. added
    state: publishedThe fix has been published for testing in weekly binary package
    on Mar 16, 2026
  19. github-actions commented on Mar 16, 2026

    @github-actions

    Hello @gchiozzi!

    Please check the fresh version (development snapshot) of Stellarium:
    https://github.com/Stellarium/stellarium-data/releases/tag/weekly-snapshot

  20. removed
    state: publishedThe fix has been published for testing in weekly binary package
    on Apr 5, 2026
  21. github-actions commented on Apr 5, 2026

    @github-actions

    Hello @gchiozzi!

    Please check the latest stable version of Stellarium:
    https://github.com/Stellarium/stellarium/releases/latest

  22. gchiozzi commented on Apr 17, 2026

    @gchiozzi
    Author

    Thanks!
    I have installed stellarium 26.1 and now it works as expected.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

Type

Projects

  • Status
    Done

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions