×

INDI Library v2.0.7 is Released (01 Apr 2024)

Bi-monthly release with minor bug fixes and improvements

issue with indi_setprop & indi_getprop | SOLVED |

  • Posts: 2255
  • Thank you received: 223
The issue I'm having: can't seem to connect from command line.

On the RPI I start a server:
root@raspberrypi:~# indiserver -v indi_eqmod_telescope
2014-06-12T19:25:53: startup: indiserver -v indi_eqmod_telescope 
2014-06-12T19:25:53: Driver indi_eqmod_telescope: pid=2446 rfd=3 wfd=6 efd=7
2014-06-12T19:25:53: listening to port 7624 on fd 4
 

On the same RPI I try the following to connect:
root@raspberrypi:~# indi_setprop 'EQMod Mount.CONNECTION.CONNECT=On'
root@raspberrypi:~#

and get the following result on the server:
2014-06-12T19:26:07: Client 0: new arrival from 127.0.0.1:55226 - welcome!
2014-06-12T19:26:07: Client 0: read EOF
2014-06-12T19:26:07: Client 0: shut down complete - bye!

I then try a indi_getprop and get partial information before returning to the prompt, yes I did also try with -t 30 and even longer.
root@raspberrypi:~# indi_getprop 
EQMod Mount.CONNECTION.CONNECT=Off
EQMod Mount.CONNECTION.DISCONNECT=On
EQMod Mount.DRIVER_INFO.NAME=EQMod Mount
EQMod Mount.DRIVER_INFO.EXEC=indi_eqmod_telescope
EQMod Mount.DRIVER_INFO.VERSION=0.2
EQMod Mount.CONFIG_PROCESS.CONFIG_LOAD=Off
EQMod Mount.CONFIG_PROCESS.CONFIG_SAVE=Off
EQMod Mount.CONFIG_PROCESS.CONFIG_DEFAULT=Off
EQMod Mount.DEVICE_PORT.PORT=/dev/ttyUSB0
EQMod Mount.DEBUG.ENABLE=Off
EQMod Mount.DEBUG.DISABLE=On
EQMod Mount.SIMULATION.ENABLE=Off
EQMod Mount.SIMULATION.DISABLE=On
EQMod Mount.DEVICE_PORT.PORT=/dev/ttyUSB0
EQMod Mount.CONFIG_PROCESS.CONFIG_LOAD=Off
EQMod Mount.CONFIG_PROCESS.CONFIG_SAVE=Off
EQMod Mount.CONFIG_PROCESS.CONFIG_DEFAULT=Off
root@raspberrypi:~#


The extremely rare time I can fully connect over the command line, the output from indi_getprop would be way bigger.
I'm writing a bash script for the RPI/Piface module to talk to the indi_server and issue a park command before closing the roof of the observatory.

At the moment I can't as the indi_getprop is not returning the right info.


Am I doing something somewhere?



Thanks for the help
Stephane



edit:
solved, see page two
Last edit: 9 years 10 months ago by Gonzothegreat.
9 years 10 months ago #1284

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

  • Posts: 2255
  • Thank you received: 223
I think I've managed to get something working.

Here's my checkpark script (it's still a work in a progress...):
root@raspberrypi:~# more checkpark.sh 
#!/bin/bash
 
 
until [ $(indi_getprop | grep CURRENTSTEPPERS.DEStepsCurrent | awk -F= '{print $2}') -eq "8734257" ]
 
do
indi_setprop 'EQMod Mount.DEVICE_PORT.PORT=/dev/ttyS64'
indi_setprop 'EQMod Mount.CONNECTION.CONNECT=On'
done
 
echo PARKED
root@raspberrypi:~#

With 8734257 being the set DEC park position.

tbc...
9 years 10 months ago #1292

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

  • Posts: 2255
  • Thank you received: 223
Now with DEC and RA condition
root@raspberrypi:~# more checkpark.sh 
#!/bin/bash
 
until [ $(indi_getprop | grep CURRENTSTEPPERS.DEStepsCurrent | awk -F= '{print $2}') -eq "8734257" -a $(indi_getprop | grep CURRENTSTEPPERS.RAStepsCurrent | awk -F= '{pr
int $2}') -eq "9081404" ]
 
 
do
indi_setprop 'EQMod Mount.DEVICE_PORT.PORT=/dev/ttyS64'
indi_setprop 'EQMod Mount.CONNECTION.CONNECT=On'
done
 
echo PARKED
root@raspberrypi:~#
9 years 10 months ago #1293

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

so I take it it was because the port was not sent before connect? Is the script working now as expected?
9 years 10 months ago #1305

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

  • Posts: 2255
  • Thank you received: 223

Yes you do need to set the port AND make a connection.
However, it does not work on the first try, hence I have a loop in a script that gets repeated until it's connected.
root@raspberrypi:~# more checkconnection.sh 
#!/bin/bash
 
#Current connection state
CON=`indi_getprop | grep Mount.CONNECTION.CONNECT | awk -F= '{print $2}'`
DISC=`indi_getprop | grep Mount.CONNECTION.DISCONNECT | awk -F= '{print $2}'`
 
until [ $CON == "On" -a $DISC == "Off" ]
 
do
indi_setprop 'EQMod Mount.DEVICE_PORT.PORT=/dev/ttyS64'
indi_setprop 'EQMod Mount.CONNECTION.CONNECT=On'
done
echo CONNECTED
 
root@raspberrypi:~#


My new "is it park or not" script is now working, but it's still a huge work in progress...
root@raspberrypi:~# more checkpark.sh 
#!/bin/bash
 
#Park set values
RA=`cat /.indi/ParkData.xml | grep -A1 raencoder | sed  '/^[ \t]\+/d'`
DEC=`cat /.indi/ParkData.xml | grep -A1 deencoder | sed  '/^[ \t]\+/d'`
 
#Create range
minRA=`echo $RA - 25 | bc`
maxRA=`echo $RA + 25 | bc`
minDEC=`echo $DEC - 25 | bc`
maxDEC=`echo $DEC + 25 | bc`
 
#Current RA / DEC values
CRA=`indi_getprop | grep CURRENTSTEPPERS.RAStepsCurrent | awk -F= '{print $2}'`
CDEC=`indi_getprop | grep CURRENTSTEPPERS.DEStepsCurrent | awk -F= '{print $2}'`
 
 
if (($minRA<=$CRA && $CRA<=$maxRA)) && (($minDEC<=$CDEC && $CDEC<=$maxDEC))
        then
                echo "PARKED"
        else
                echo "NOT PARKED"
fi
root@raspberrypi:~#

the above script will tell you if the mount is physically parked or not by checking the "CURRENTSTEPPERS.RAStepsCurrent" AND "CURRENTSTEPPERS.DEStepsCurrent"
9 years 10 months ago #1306

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

  • Posts: 2255
  • Thank you received: 223
Here's a quick test you can do:

start indiserver as:
indiserver indi_eqmod_telescope &

then run the following script only once:
#!/bin/bash
indi_setprop 'EQMod Mount.DEVICE_PORT.PORT=/dev/ttyS64'
indi_setprop 'EQMod Mount.CONNECTION.CONNECT=On'
 
#Current connection state
CON=`indi_getprop | grep Mount.CONNECTION.CONNECT | awk -F= '{print $2}'`
DISC=`indi_getprop | grep Mount.CONNECTION.DISCONNECT | awk -F= '{print $2}'`
 
#Current RA / DEC values
CRA=`indi_getprop | grep CURRENTSTEPPERS.RAStepsCurrent | awk -F= '{print $2}'`
CDEC=`indi_getprop | grep CURRENTSTEPPERS.DEStepsCurrent | awk -F= '{print $2}'`
 
 
echo "Coonect     -ON-          : " $CON
echo "Disconnect -OFF-  : " $DISC
echo "RA                        : " $CRA
echo "DEC                       : " $CDEC

if will return the following:
root@raspberrypi:~# ./test.sh 
No *.*.* from localhost:7624
No *.*.* from localhost:7624
No *.*.* from localhost:7624
No *.*.* from localhost:7624
Coonect   -ON-          : 
Disconnect -OFF-        : 
RA                      : 
DEC                     : 
root@raspberrypi:~


run it one more time and you'll get:
root@raspberrypi:~# ./test.sh 
Coonect   -ON-          :  On
Disconnect -OFF-        :  Off
RA                      :  9081404
DEC                     :  8734257
root@raspberrypi:~#


Is there any reason why the first time, the connection is not being established?
Am I missing something in my connection string?



Regards
Stephane
9 years 10 months ago #1307

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

I ran the script, but instead of the port change, I enabled simulation
#!/bin/bash
indi_setprop 'EQMod Mount.SIMULATION.ENABLE=On'
indi_setprop 'EQMod Mount.CONNECTION.CONNECT=On'

And it worked the first time. I suspect your issue might have to do with timing, you might want to introduce some delay, say a second or so, before you make calls to indi_getprop
The following user(s) said Thank You: Gonzothegreat
9 years 10 months ago #1315

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

  • Posts: 2255
  • Thank you received: 223
Thanks, will give it a shot this evening when I'm back from work.
I might also use the '-t' flag too.
9 years 10 months ago #1326

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

  • Posts: 2255
  • Thank you received: 223


I've done as you said as I was able to connect on first try.
Will have to do more test to make sure this wasn't fluke.... stay tuned...
9 years 10 months ago #1327

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

Time to create page: 0.255 seconds