×

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

Bi-monthly release with minor bug fixes and improvements

Dome Scripting Gateway for a roll-off-roof?

  • Posts: 249
  • Thank you received: 62
Or you can write a tutorial for an Arduino Roll Off Roof and ask Jasem to pull your code in the main repository.
I think that someone could benefit from your experience and use it as a guide.

Ferrante
The following user(s) said Thank You: Derek
5 years 1 month ago #35243

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

  • Posts: 278
  • Thank you received: 17
I use this, where the scripts communicate with a 'roof server' I wrote in python that is running outside indi.
The following user(s) said Thank You: Derek
5 years 1 month ago #35248

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

  • Posts: 41
  • Thank you received: 4
Hi Ferrante,
I'm trying to use Dome Dcripting Gateway driver to control my roll off roof too.
I wrote a python script that use the on board Rpi Bluetoooth to send an open/close command to an ArduinoNano board connected to my motor controller. If I execute this script, is a Python 3 script by the way (to import and use Bluetooth library) in the console works fine, but when I tried to use the same script in "unpark.py" to execute via Dome Scripting Gateway it didn't work.
What I'm doing wrong? Any idea?
Thanks

Andres
3 years 6 months ago #59891

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

  • Posts: 249
  • Thank you received: 62
hi Andres,

I'm not using the Dome Scripting Gateway since a long time now. And trying to launch it from the nightly Kstars / Ekos version it raises an error and doesn't start.


Anyway, have you checked the right user / permission on the script?
Can you share the driver log and the source of the script? that could help to understand what is the issue.

Ferrante
3 years 6 months ago #59912

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

  • Posts: 41
  • Thank you received: 4
Hi Ferrante, thanks for the answer.
I set the permission to execute the scripts to "Anybody", the scripts are in /usr/share/indi/scripts folder. I that folder I've created 11 scripts (onr for each command for the driver), 9 of them are empty to be dummies (I don't know if doing it like this is correct) and only the unpark.py and park.py scripts have sourde code. Is the first time I'm doing this and I have no idea if the driver could run any type of python scripts or there is a typical source or some "rules" I have to follow.
The code is pretty simple, just it open a socket via bluetooth and send a command to the Arduino board.
Could not get the driver log, I tried to enable the logs from the Ekos profile but the logs folder is always empty no matter how I configure it.
Anyway, I attach the driver message on the INDI control panel if this help.

Thanks!
Andres
Last edit: 3 years 6 months ago by Andres Rossi.
3 years 6 months ago #59926
Attachments:

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

  • Posts: 1957
  • Thank you received: 420
Andres,

Check all devices that you need to access (most likely in the /dev directory) and make sure that your user is part of the group that is allowed to access it.


HTH, Wouter
3 years 6 months ago #59928

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

  • Posts: 41
  • Thank you received: 4
I think the only devices that I have yo access is the Bluetooth module, in the script I created a BT socket and use RFCOMM. In the /dev folder the only similar is rfcomm0 file and I seted permissions for anybody, but still not working :/

Is my first time doing this kind of python scripts. If I run the script in the console works fine.

Andres
3 years 6 months ago #59929

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

  • Posts: 249
  • Thank you received: 62
hi Wouter,
Andres is able to execute the unpark script from command line so the script should already have the right user/group permissions on the connected devices.
On the other hand, it could be that the indi user and the script user belong to different groups.

Andres, just to understand if it's the script or the driver: what is the output if in your script you only write in it:
print('ok')
3 years 6 months ago #59930

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

  • Posts: 41
  • Thank you received: 4
Ferrante,
If I run the script with the console de output is "ok" (without quotation marks).
If I run with the driver (park.py) an error message appears (as with the original script) [ERROR] Failed to park.

Would I need a STATUS or CONNECT script that is not a dummy?

Last edit: 3 years 6 months ago by Andres Rossi.
3 years 6 months ago #59932
Attachments:

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

  • Posts: 249
  • Thank you received: 62
hi Andres,

I've not been using this driver for a long time and I completely forgot that there are template scripts to implement.
The instructions are at the following link:
github.com/fenriques/indi/blob/master/li...dome/dome_script.txt

The bottom line is that the driver reads 3 digits from a file (/tmp/indi-status) every n seconds.
You just have to update those 3 digits. For example, 1 0 0 means park.
And in the same script you have to include your bluetooth commands.

ferrante

EDIT: Just to provide an example for your unpark.py:

<code>
...add bluetooth unpark commands here....
if bluetooth_unpark_response == "success":
str = str[0] + ' 1 ' + str[4:]
coordinates = open('/tmp/indi-status', 'w')
coordinates.truncate()
coordinates.write(str)
coordinates.close()
else:
sys.exit(0)
</code>

where str is the old status
The following user(s) said Thank You: Andres Rossi
Last edit: 3 years 6 months ago by Ferrante Enriques.
3 years 6 months ago #59941

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

  • Posts: 8
  • Thank you received: 1
You need to add the following to the bottom. ( taken from the example scripts ) you also need to exit the script in the right way to show that it completed successfully.

coordinates = open('/tmp/indi-status', 'w')
coordinates.truncate()
coordinates.write('0 0 0')
coordinates.close()
print("Fully Open")
sys.exit(0)
The following user(s) said Thank You: Andres Rossi
3 years 6 months ago #59945

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

  • Posts: 41
  • Thank you received: 4
SUCCESS people!!!

Taking Ferrante and Bundy's scripts as an example I managed to make it work !!! I am more than happy!!!
Thanks a lot, without your help I would not have made it.
Now I can automate my observatory much better.

Question: Is there another dirver similar to this one to run scripts but is it for a Roll Off Roof?

I also want to do something similar for my DIY dust cap and be able to include all these devices in my STARTUP and SHUTDOWN procedures. Is there any that I can use?

Thanks again
3 years 6 months ago #59959

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

Time to create page: 0.896 seconds