¿ªÔÆÌåÓý

Date

Locked Re: Ops and Roster question

 

There isn't a way to export locos from operations to Decoder Pro.? You should always enter them into Decorder Pro first.

Dan


Locked Re: Trying to get on top of jython

 

Wouter,

I have uploaded 2 files to your folder.

It appears to me that the issue deals with scope and how import actually works. I don¡¯t think it is a JMRI issue. Most likely something with Jython or maybe how you are structuring your program.

miniTest DS.py uses the AbstractAutomaton class to handle the threading. It does not import util and the method calls to util where changed.

The existing def in util DS.py was changed to act as static method.

To run miniTest, util DS is run first which sets up the util environment with the util methods becoming global, then miniTest DS is run.

This approach works but I am sure there are others.

Dave Sand

On Jan 3, 2019, at 10:14 AM, whmvd <vandoornw@...> wrote:

Indeed, Dave, I have.

I've now created a WoutersPythonbug directory in ProblemsBeingWorkedOn which contains just three tiny scripts, together showing that there is, as far as I can make out, really a bug here.

1) jmriShortCuts.py
Simply prints all the objects that should be predefined according to the following documentation link:

(it turns out that 'programmers' (or indeed 'programmer') is not present, which is probably a very minor documentation buglet, but masts, the one I focus on, is. So my environment does set it up correctly for me.

2) miniTest.py
A main test program that simply runs, in its own thread, my object under test.

3) util.py
Totally useless as is, but that's because it has been pruned of everything that could go while still showing the bug. As uploaded, it works, but only because of the assignment statement that creates a valid 'masts' variable. Comment that out, and things go horribly wrong, which they shouldn't if masts were properly preset. Also, edit a signalmast name into this file that is a valid one in your panelfile, instead of EastNorthOuter. I've also included my panelfile, should that be handier to use instead.

Put the three scripts into the resources directory and run:
1) jmriShortCuts.py
proving that the environment sets up the masts variable
2) miniTest.py
proving that that test shows a validly retrieved signalMast

Comment out the line that should not be in miniTest.py (masts=...)
Restart JMRI to get rid of possibly remaining classes in memory (that bit me at some point)
3) miniTest.py
proving that now it does not work anymore, with all the symptoms listed in the file itself.

I'm using JMRI 4.14 under Linux Mint 18.3

Anything more I can do to help explain why I think this is a bug?

Thanks,
Wouter

On Thu, 3 Jan 2019 at 15:02, Dave Sand <ds@...> wrote:
Wouter,

Do you have "import java" and "import jmri" at the beginning of each python file?

Dave Sand



On Jan 3, 2019, at 5:37 AM, whmvd <vandoornw@...> wrote:

Hello again, Bob,

Thanks for bearing with me on this.

It didn't go quite as planned when I went looking for the global variables 'turnouts', 'masts' and 'sensors'. Weirdly, turnouts and sensors are there, but masts is not. That is now the only little niggle left. Considering where I was only yesterday, that's a nnumber of huge leaps forward. The error reported is "global name 'masts' is not defined". I can bypass the problem easily by including the following line in my code:

masts = jmri.InstanceManager.getDefault(jmri.SignalMastManager)

but that's really cheating, shouldn't be necessary and keeps the back of my mind worried at what else could go wrong when I continue. Any advice on this?masts = jmri.InstanceManager.getDefault(jmri.SignalMastManager)

Wouter

On Wed, 2 Jan 2019 at 20:31, Wouter van Doorn <vandoornw@...> wrote:
Hi Bob,

Re 1) Not only did I think that was the way to do it, I was also (and am still) just building my 'library of tricks' to use in the proper, big script later on. This is one of the stages of learning! I have now removed the join, and made the spawned threads daemons, and that now works a *lot* better! Not only do I now get error messages when I need them (hurray!), the user interface no longer locks up, as you predicted (double hurray!).

Re 2) The line you mention is there. I'll see next what happens when I do not create that 'sensors' variable myself. IF it still goes wrong, at least I have an error message now to tell me where and how I goofed.

It's a lot better already, so thank you very much for the help so far. I'll let you know the result of the test once I get to it, which won't be today, but I hope to find time tomorrow.

Thanks again,
Wouter

On Wed, 2 Jan 2019 at 20:03, Bob Jacobsen <rgj1927@...> wrote:
1) Why make the main thread wait with a join? What does that do for you?

2) I¡¯m not a Bash expert, but that looks like it should work. Somehow, Jython isn¡¯t initializing properly for you. Are you getting a line like this in the log?

2019-01-02 11:58:29,512 script.JmriScriptEngineManager INFO - python 2.7 is provided by jython 2.7.0 [AWT-EventQueue-0]

When I force an error, I get output that starts like:

2019-01-02 11:58:41,099 jython.InputWindow ERROR - Error executing script [AWT-EventQueue-0]
javax.script.ScriptException: NameError: name 'xo' is not defined in <script> at line number 1
at org.python.jsr223.PyScriptEngine.scriptException(PyScriptEngine.java:202)
at org.python.jsr223.PyScriptEngine.eval(PyScriptEngine.java:42)
at org.python.jsr223.PyScriptEngine.eval(PyScriptEngine.java:31)
at javax.script.AbstractScriptEngine.eval(AbstractScriptEngine.java:264)

Bob

On Jan 2, 2019, at 8:24 AM, whmvd <vandoornw@...> wrote:

Hi Bob ,

Thanks for the quick reaction.
Re 1: I actually do that in a separate thread - but then the first thread waits while 'join'ing the subthread, so that remains the same problem, really. Do I need to make the subthread a daemon one and let the main thread just go? That would seem to make sense?

Re 2: I use 'Run script...' from the Tables menu. If it helps, this is the script I use to start jmri (which should be good enough):
=============================
#!/bin/bash

cd $HOME/JMRI
nohup ./PanelPro >>$HOME/Desktop/.PanelPro.log 2>&1 &
=============================
Everything I log neatly shows up in the file on the desktop. The install is squeaky-clean; everything I do is in the user files area, nothing in the installation directory. VERY interesting that 'sensors' and 'turnouts' should have been predefined...

Wouter



On Wed, 2 Jan 2019 at 15:52, Bob Jacobsen <rgj1927@...> wrote:
1) There are ways to do this. They start off looking complicated, but you have to remember that asking the program to sleep _actually_ _works_: If you do that in the main program, the main program sleeps so that you can¡¯t click, etc. Instead, you have to hive your turnout activity into a little separate item (called a ¡°thread¡±) which can run and sleep independently.



2) How are you running your scripts? When I run something (i.e. while debugging) from a Script Entry window, the syntax error and runtime error messages show up nicely on JMRI System console window. Perhaps you¡¯re running them a different way or there¡¯s something else wrong?

Another clue that something is wrong is not seeing ¡°turnouts¡± and ¡°sensors¡± predefined. They _definitely_ should be.

Bob

On Jan 2, 2019, at 7:42 AM, whmvd <vandoornw@...> wrote:

Hello scripting-gurus,

For quite a while now, I've been fighting python/jython rather than using it, and frustration is building up. I want to like it, I want to work with it - but it's not making it easy. For now, I'd like to focus on two things that make life very hard:

1) A small test script that looks up a turnout (successfully) checks its status (thrown or closed), logs it and sleeps for 0.2 seconds before checking again until it is what I want it to be does not allow me to operate any of my four panels (3x Panel Editor, 1x Layout Editor). The only things that can be operated are the resize buttons on the window and the positioning. So I can't throw the turnout to let the test program complete (the log line appears every 0.2 seconds, so it sort of seems to work). I would have thought that the time.sleep(200/1000.0) would allow me to do things instead of the whole interface being locked up? (BTW: specifically not looking for different ways to do this; I know I should add a listener and make that react, and I will end up doing that anyway - I am trying to understand why the simple thing I'd like to do cannot work)

2) When I make one of my frequent coding errors, the result is the same as described above - interface locked up except for the sizing/positioning of windows). I get no error logged. Nothing on standard output or standard error, and nothing in the console. Zilch. This leaves me having to guess where I could have gone wrong, instead of being able to look at a stack dump. For instance: I thought in my optimism that the variables 'turnouts' and 'sensors' where predefined when importing jmri, so I was happily using them. That caused the lock-up with no message at all. Finding the cause of that took me several frustrating days. I hope to turn this back into a hobby!

Any help will be greatly appreciated.

Wouter

PS: using JMRI 4.14 on Linux Mint 18.3.
--
Bob Jacobsen
rgj1927@...






--
Bob Jacobsen
rgj1927@...










Locked Re: SoundPro

 

HI Al,

The .spj file can be accessed by audio editor.? I use an opensource editor called Audacity.? You can get it here.??? ? or here??.

When you use it, you will need to choose, [Import Audio] and then choose Raw Audio.? On the next screen select 11k sampling rate and 8 or 16 bit depth depending on your spj. file.

The .spj file is simply a single audio file.? If you open the spj in SoundPro the timings will correspond to the timings in the editor file.? I used this to pull apart some spj. files to create my own .vsd files.? Using Audacity you can select portions of this file, copy, create new file and paste.? Then export the file as .wav.? be sure to set the proper bit depth.? All your files need to be the same bit depth.? ?I will not share any I've made as I'm doing this for my own use and sharing will violate the intellectual property rights of the sound file owners.


Locked Re: JMRI Not Identifying Locomotives Properly

 

Perhaps there is a solution by looking at the User1 and User2 settings for differentiation? That maybe a good compromise solution. I could then go back to the duplicate numbers and give them different values in the user cv's to correct the issue.?


Locked Re: Ops and Roster question

 

I haven¡¯t found a good way either, although I usually get them set up in DecoderPro first and then manually enter them into Locomotives in Ops. There may be a way to do a single entry import into Locomotives but I haven¡¯t found it. Of course the other option is to delete everything in Locomotives and then reimport the whole roster from DecoderPro, but that seems daunting.


Locked SoundPro

 

I would like to use soundpro to access a spj file and copy the associated wav files. How do I access SounPro from JMRI? Is there an Icon that can be added so the program can be accessed? Thanks for any help,
Al Babinsky


Locked Re: Trouble with JMRI to JMRI client/server

 

Thanks Steve and Bob,

The Loconet over IP server generally works from the iMac to the RPI.? The status window on the RPI shows running and the client count 1.

Using the Loconet sim on the RPI, and the LocoBuffer (PS) as the command station type on the iMac (client) I am able to
manipulate the panel (which has to be on both computers) though the sensor states get out of synch, i.e. I am triggering routes
for yard ladders and though the switch positions are correct for the 'activated route' picked on the client the server shows a different active
sensor.? Do not think that it will be a problem as the virtual panel used by the yard master will be the 'system of record'.

I will go down to the club and try it 'for real' to see if there is still an issue.

Much appreciated,
Martin Booker


Locked Re: PanelPro icon sets question

 

Hey Nick,?
? ? ?In the scenario you describe above, you have two options.? The first option would be to not do anything with the last signal at the entrance to the yard.? Since it is in a pair with the previous signal, it should show up and not be a red x.? You can directly control the signal by clicking on it.? Two aspects are all that would be needed.? Stop and something else depending on your desires.?

The second option is a little more complicated and would produce more realistic results.? In this scenario, you would need to create a virtual signal mast that would be the destination mast for the signal at the yard entrance.? Set the virtual mast to stop.? That will allow the signal at the yard entry to display approach.? Then to control the yard signal, set up a sensor and have the signal mast logic include that sensor.? If you turn the sensor on, the signal will go to red.? If the sensor is off the signal will "clear" and show approach allowing a train to enter the yard.?

Greg McCartney


Locked Re: Trying to get on top of jython

 

Indeed, Dave, I have.

I've now created a WoutersPythonbug directory in ProblemsBeingWorkedOn which contains just three tiny scripts, together showing that there is, as far as I can make out, really a bug here.

1) jmriShortCuts.py
Simply prints all the objects that should be predefined according to the following documentation link:
(it turns out that 'programmers' (or indeed 'programmer') is not present, which is probably a very minor documentation buglet, but masts, the one I focus on, is. So my environment does set it up correctly for me.

2) miniTest.py
A main test program that simply runs, in its own thread, my object under test.

3) util.py
Totally useless as is, but that's because it has been pruned of everything that could go while still showing the bug. As uploaded, it works, but only because of the assignment statement that creates a valid 'masts' variable. Comment that out, and things go horribly wrong, which they shouldn't if masts were properly preset. Also, edit a signalmast name into this file that is a valid one in your panelfile, instead of EastNorthOuter. I've also included my panelfile, should that be handier to use instead.

Put the three scripts into the resources directory and run:
1) jmriShortCuts.py
proving that the environment sets up the masts variable
?2) miniTest.py
proving that that test shows a validly retrieved signalMast

Comment out the line that should not be in miniTest.py (masts=...)
Restart JMRI to get rid of possibly remaining classes in memory (that bit me at some point)
3) miniTest.py
proving that now it does not work anymore, with all the symptoms listed in the file itself.

I'm using JMRI 4.14 under Linux Mint 18.3

Anything more I can do to help explain why I think this is a bug?

Thanks,
Wouter

On Thu, 3 Jan 2019 at 15:02, Dave Sand <ds@...> wrote:
Wouter,

Do you have "import java" and "import jmri" at the beginning of each python file?

Dave Sand



> On Jan 3, 2019, at 5:37 AM, whmvd <vandoornw@...> wrote:
>
> Hello again, Bob,
>
> Thanks for bearing with me on this.
>
> It didn't go quite as planned when I went looking for the global variables 'turnouts', 'masts' and 'sensors'. Weirdly, turnouts and sensors are there, but masts is not. That is now the only little niggle left. Considering where I was only yesterday, that's a nnumber of huge leaps forward. The error reported is "global name 'masts' is not defined". I can bypass the problem easily by including the following line in my code:
>
> masts = jmri.InstanceManager.getDefault(jmri.SignalMastManager)
>
> but that's really cheating, shouldn't be necessary and keeps the back of my mind worried at what else could go wrong when I continue. Any advice on this?masts = jmri.InstanceManager.getDefault(jmri.SignalMastManager)
>
> Wouter
>
> On Wed, 2 Jan 2019 at 20:31, Wouter van Doorn <vandoornw@...> wrote:
> Hi Bob,
>
> Re 1) Not only did I think that was the way to do it, I was also (and am still) just building my 'library of tricks' to use in the proper, big script later on. This is one of the stages of learning! I have now removed the join, and made the spawned threads daemons, and that now works a *lot* better! Not only do I now get error messages when I need them (hurray!), the user interface no longer locks up, as you predicted (double hurray!).
>
> Re 2) The line you mention is there. I'll see next what happens when I do not create that 'sensors' variable myself. IF it still goes wrong, at least I have an error message now to tell me where and how I goofed.
>
> It's a lot better already, so thank you very much for the help so far. I'll let you know the result of the test once I get to it, which won't be today, but I hope to find time tomorrow.
>
> Thanks again,
> Wouter
>
> On Wed, 2 Jan 2019 at 20:03, Bob Jacobsen <rgj1927@...> wrote:
> 1) Why make the main thread wait with a join?? What does that do for you?
>
> 2) I¡¯m not a Bash expert, but that looks like it should work.? Somehow, Jython isn¡¯t initializing properly for you.? Are you getting a line like this in the log?
>
> 2019-01-02 11:58:29,512 script.JmriScriptEngineManager? ? ? ? INFO? - python 2.7 is provided by jython 2.7.0 [AWT-EventQueue-0]
>
> When I force an error, I get output that starts like:
>
> 2019-01-02 11:58:41,099 jython.InputWindow? ? ? ? ? ? ? ? ? ? ERROR - Error executing script [AWT-EventQueue-0]
> javax.script.ScriptException: NameError: name 'xo' is not defined in <script> at line number 1
>? ? ? ? ?at org.python.jsr223.PyScriptEngine.scriptException(PyScriptEngine.java:202)
>? ? ? ? ?at org.python.jsr223.PyScriptEngine.eval(PyScriptEngine.java:42)
>? ? ? ? ?at org.python.jsr223.PyScriptEngine.eval(PyScriptEngine.java:31)
>? ? ? ? ?at javax.script.AbstractScriptEngine.eval(AbstractScriptEngine.java:264)
>
> Bob
>
> > On Jan 2, 2019, at 8:24 AM, whmvd <vandoornw@...> wrote:
> >
> > Hi Bob ,
> >
> > Thanks for the quick reaction.
> > Re 1: I actually do that in a separate thread - but then the first thread waits while 'join'ing the subthread, so that remains the same problem, really. Do I need to make the subthread a daemon one and let the main thread just go? That would seem to make sense?
> >
> > Re 2: I use 'Run script...' from the Tables menu. If it helps, this is the script I use to start jmri (which should be good enough):
> > =============================
> > #!/bin/bash
> >
> > cd $HOME/JMRI
> > nohup ./PanelPro >>$HOME/Desktop/.PanelPro.log 2>&1 &
> > =============================
> > Everything I log neatly shows up in the file on the desktop. The install is squeaky-clean; everything I do is in the user files area, nothing in the installation directory. VERY interesting that 'sensors' and 'turnouts' should have been predefined...
> >
> > Wouter
> >
> >
> >
> > On Wed, 2 Jan 2019 at 15:52, Bob Jacobsen <rgj1927@...> wrote:
> > 1) There are ways to do this. They start off looking complicated, but you have to remember that asking the program to sleep _actually_ _works_: If you do that in the main program, the main program sleeps so that you can¡¯t click, etc.? Instead, you have to hive your turnout activity into a little separate item (called a ¡°thread¡±) which can run and sleep independently.
> >
> >
> >
> > 2) How are you running your scripts?? When I run something (i.e. while debugging) from a Script Entry window, the syntax error and runtime error messages show up nicely on JMRI System console window. Perhaps you¡¯re running them a different way or there¡¯s something else wrong?
> >
> > Another clue that something is wrong is not seeing ¡°turnouts¡± and ¡°sensors¡± predefined.? They _definitely_ should be.
> >
> > Bob
> >
> > > On Jan 2, 2019, at 7:42 AM, whmvd <vandoornw@...> wrote:
> > >
> > > Hello scripting-gurus,
> > >
> > > For quite a while now, I've been fighting python/jython rather than using it, and frustration is building up. I want to like it, I want to work with it - but it's not making it easy. For now, I'd like to focus on two things that make life very hard:
> > >
> > > 1) A small test script that looks up a turnout (successfully) checks its status (thrown or closed), logs it and sleeps for 0.2 seconds before checking again until it is what I want it to be does not allow me to operate any of my four panels (3x Panel Editor, 1x Layout Editor). The only things that can be operated are the resize buttons on the window and the positioning. So I can't throw the turnout to let the test program complete (the log line appears every 0.2 seconds, so it sort of seems to work). I would have thought that the time.sleep(200/1000.0) would allow me to do things instead of the whole interface being locked up? (BTW: specifically not looking for different ways to do this; I know I should add a listener and make that react, and I will end up doing that anyway - I am trying to understand why the simple thing I'd like to do cannot work)
> > >
> > > 2) When I make one of my frequent coding errors, the result is the same as described above - interface locked up except for the sizing/positioning of windows). I get no error logged. Nothing on standard output or standard error,? and nothing in the console. Zilch. This leaves me having to guess where I could have gone wrong, instead of being able to look at a stack dump. For instance: I thought in my optimism that the variables 'turnouts' and 'sensors' where predefined when importing jmri, so I was happily using them. That caused the lock-up with no message at all. Finding the cause of that took me several frustrating days. I hope to turn this back into a hobby!
> > >
> > > Any help will be greatly appreciated.
> > >
> > > Wouter
> > >
> > > PS: using JMRI 4.14 on Linux Mint 18.3.
> > >
> >
> > --
> > Bob Jacobsen
> > rgj1927@...
> >
> >
> >
> >
> >
> >
> >
>
> --
> Bob Jacobsen
> rgj1927@...
>
>
>
>
>
>
>





Locked Re: Running JMRI From A MacBook Pro

 

Bob

Thank you for the notes. I have done more research and testing, it would appear that I am missing a driver that will connect the JMRI system to a MERG CBUS system via the Macbook's Mojave operating system.

I believe that previous MacBook os versions had the appropriate driver (Because they work) but sadly Mojave does not. This would appear to be the same with Windows 7 and 10 where windows 10 has a driver and Windows 7 does not.?

Steve?

?


Locked Re: JMRI Not Identifying Locomotives Properly

 

¿ªÔÆÌåÓý

I've tried (unsuccessfully) to sleep on this but have realised that we've ended up in an old area of misunderstanding. We need to go back to basics of the problem and what is or is not possible.

The Problem:
On 3 Jan 2019, at 7:57 AM, dcesharkman via Groups.Io <dcesharkman@...> wrote:

I have many locomotives with proper road numbers that overlap with others. For example, I have a Kato NYC PA unit with the number of 4301, but I also have a Kato SD70ACE in MRL with the same number.? I have many instances of this same situation.? There must be a better way to assign the identity of a locomotive so that these miss-identities do not happen. I have 62 of these occurrences. This is where better indexing could keep this from happening.

From this we have interpreted that ?dcesharkman has multiple locos with the same DCC address and he wants the "Identify" button in JMRI (at the top left of the main DecoderPro window or the Roster window in PanelPro) determine (by reading decoder CVs) which is the correct roster entry for those locos that happen to have identical DCC addresses.

What identifying information we can read from decoder CVs:
- The currently-assigned DCC address. This can be done by reading CV29 and then either CV1 or CVs 17 & 18.

- The NMRA-assigned ManufacturerID. This is stored in CV8.

- A version number from CV7. The usage and interpretation of this is up to the manufacturer. In some cases it indicates a decoder model, in other cases it represents a firmware version (which may be user-updatable by manufacturer-supplied hardware/software). In some cases the manufacturer chooses to not use this CV for identification??but instead store identifying information in other CVs, or not at all.

- In some cases (where the manufacturer implements and documents them) we can read what we call a ProductID from special CVs and some calculations.

When we do a "New Loco"->"Read Type from Decoder" we attempt to read ManufacturerID, VersionID and ProductID (if implemented), a task attempted by our IdentifyDecoder Java class,?and try to match these against known values in our decoder definition index file to find a correct decoder definition (characterised by the unique combination of a "family" name and a "model" name).

- In some cases this may lead to a unique identification.

- In many cases this may lead to multiple possibilities, leaving the user to make a manual choice of decoder model. A given decoder model may cover a range of VersionIDs and possibly more than one ProductID. So we can't store either of these in the roster entry.

- In many cases a user already knows the exact decoder model and doesn't even bother with the "Read Type from Decoder " procedure, but simply manually picks the known family/model. As above, a?given decoder model may cover a range of VersionIDs and possibly more than one ProductID. So we can't store either of these in the roster entry.

See:
<>

The identity-related information we store in a Roster Entry.
- The user-created ID string: This is entirely up to to the user but JMRI ensures there are no duplicates in a user's roster. There is no way we can store this into decoder CVs.

- The currently-assigned DCC loco address, as per what has been read and/or written in the relevant NMRA address CVs.

- The "family" and "model" unique combination as per above. (Note that using this we can retrieve the ManufacturerID from our decoderIndex.xml file.)

- Note that (as briefly explained in the following link) we do not directly store ManufacturerID, VersionID or ProductID. To do so will cause problems as one or more of. these are often not reliably and uniquely determined at roster entry creation time and furthermore are subject to change (even in existing decoders) by external events outside our control (such circumstances have occurred and will continue to occur).
<>

- However we do have complete control over our assigned?"family" and "model" names and we have procedures already in place to manage needed changes in both our decoder definitions and a user's existing roster entries.
<>

Can we solve?dcesharkman's problem?
Not completely.
1) We can read the DCC address from the decoder and try to match against roster entries. But that will not yield a unique match in his (or many other cases).

2) We can supplement (1) by using the IdentifyDecoder class to retrieve current values of ManufacturerID, VersionID and ProductID (if applicable) and attempt to derive the "family" and "model" to narrow our list of roster entries from (1). Unfortunately?ManufacturerID, VersionID and ProductID do not always return a single unique match. We may end up with another list.

E&OE

Dave








Locked Re: Trying to get on top of jython

 

Wouter,

Do you have "import java" and "import jmri" at the beginning of each python file?

Dave Sand

On Jan 3, 2019, at 5:37 AM, whmvd <vandoornw@...> wrote:

Hello again, Bob,

Thanks for bearing with me on this.

It didn't go quite as planned when I went looking for the global variables 'turnouts', 'masts' and 'sensors'. Weirdly, turnouts and sensors are there, but masts is not. That is now the only little niggle left. Considering where I was only yesterday, that's a nnumber of huge leaps forward. The error reported is "global name 'masts' is not defined". I can bypass the problem easily by including the following line in my code:

masts = jmri.InstanceManager.getDefault(jmri.SignalMastManager)

but that's really cheating, shouldn't be necessary and keeps the back of my mind worried at what else could go wrong when I continue. Any advice on this?masts = jmri.InstanceManager.getDefault(jmri.SignalMastManager)

Wouter

On Wed, 2 Jan 2019 at 20:31, Wouter van Doorn <vandoornw@...> wrote:
Hi Bob,

Re 1) Not only did I think that was the way to do it, I was also (and am still) just building my 'library of tricks' to use in the proper, big script later on. This is one of the stages of learning! I have now removed the join, and made the spawned threads daemons, and that now works a *lot* better! Not only do I now get error messages when I need them (hurray!), the user interface no longer locks up, as you predicted (double hurray!).

Re 2) The line you mention is there. I'll see next what happens when I do not create that 'sensors' variable myself. IF it still goes wrong, at least I have an error message now to tell me where and how I goofed.

It's a lot better already, so thank you very much for the help so far. I'll let you know the result of the test once I get to it, which won't be today, but I hope to find time tomorrow.

Thanks again,
Wouter

On Wed, 2 Jan 2019 at 20:03, Bob Jacobsen <rgj1927@...> wrote:
1) Why make the main thread wait with a join? What does that do for you?

2) I¡¯m not a Bash expert, but that looks like it should work. Somehow, Jython isn¡¯t initializing properly for you. Are you getting a line like this in the log?

2019-01-02 11:58:29,512 script.JmriScriptEngineManager INFO - python 2.7 is provided by jython 2.7.0 [AWT-EventQueue-0]

When I force an error, I get output that starts like:

2019-01-02 11:58:41,099 jython.InputWindow ERROR - Error executing script [AWT-EventQueue-0]
javax.script.ScriptException: NameError: name 'xo' is not defined in <script> at line number 1
at org.python.jsr223.PyScriptEngine.scriptException(PyScriptEngine.java:202)
at org.python.jsr223.PyScriptEngine.eval(PyScriptEngine.java:42)
at org.python.jsr223.PyScriptEngine.eval(PyScriptEngine.java:31)
at javax.script.AbstractScriptEngine.eval(AbstractScriptEngine.java:264)

Bob

On Jan 2, 2019, at 8:24 AM, whmvd <vandoornw@...> wrote:

Hi Bob ,

Thanks for the quick reaction.
Re 1: I actually do that in a separate thread - but then the first thread waits while 'join'ing the subthread, so that remains the same problem, really. Do I need to make the subthread a daemon one and let the main thread just go? That would seem to make sense?

Re 2: I use 'Run script...' from the Tables menu. If it helps, this is the script I use to start jmri (which should be good enough):
=============================
#!/bin/bash

cd $HOME/JMRI
nohup ./PanelPro >>$HOME/Desktop/.PanelPro.log 2>&1 &
=============================
Everything I log neatly shows up in the file on the desktop. The install is squeaky-clean; everything I do is in the user files area, nothing in the installation directory. VERY interesting that 'sensors' and 'turnouts' should have been predefined...

Wouter



On Wed, 2 Jan 2019 at 15:52, Bob Jacobsen <rgj1927@...> wrote:
1) There are ways to do this. They start off looking complicated, but you have to remember that asking the program to sleep _actually_ _works_: If you do that in the main program, the main program sleeps so that you can¡¯t click, etc. Instead, you have to hive your turnout activity into a little separate item (called a ¡°thread¡±) which can run and sleep independently.



2) How are you running your scripts? When I run something (i.e. while debugging) from a Script Entry window, the syntax error and runtime error messages show up nicely on JMRI System console window. Perhaps you¡¯re running them a different way or there¡¯s something else wrong?

Another clue that something is wrong is not seeing ¡°turnouts¡± and ¡°sensors¡± predefined. They _definitely_ should be.

Bob

On Jan 2, 2019, at 7:42 AM, whmvd <vandoornw@...> wrote:

Hello scripting-gurus,

For quite a while now, I've been fighting python/jython rather than using it, and frustration is building up. I want to like it, I want to work with it - but it's not making it easy. For now, I'd like to focus on two things that make life very hard:

1) A small test script that looks up a turnout (successfully) checks its status (thrown or closed), logs it and sleeps for 0.2 seconds before checking again until it is what I want it to be does not allow me to operate any of my four panels (3x Panel Editor, 1x Layout Editor). The only things that can be operated are the resize buttons on the window and the positioning. So I can't throw the turnout to let the test program complete (the log line appears every 0.2 seconds, so it sort of seems to work). I would have thought that the time.sleep(200/1000.0) would allow me to do things instead of the whole interface being locked up? (BTW: specifically not looking for different ways to do this; I know I should add a listener and make that react, and I will end up doing that anyway - I am trying to understand why the simple thing I'd like to do cannot work)

2) When I make one of my frequent coding errors, the result is the same as described above - interface locked up except for the sizing/positioning of windows). I get no error logged. Nothing on standard output or standard error, and nothing in the console. Zilch. This leaves me having to guess where I could have gone wrong, instead of being able to look at a stack dump. For instance: I thought in my optimism that the variables 'turnouts' and 'sensors' where predefined when importing jmri, so I was happily using them. That caused the lock-up with no message at all. Finding the cause of that took me several frustrating days. I hope to turn this back into a hobby!

Any help will be greatly appreciated.

Wouter

PS: using JMRI 4.14 on Linux Mint 18.3.
--
Bob Jacobsen
rgj1927@...






--
Bob Jacobsen
rgj1927@...







Locked Re: SoundPro Map Engine Start - And UK Sounds

 

Scott,

please see my answer in /g/jmriusers/message/155347

Thanks.

Klaus


Am 03.01.2019 um 10:41 schrieb Scott Rixon:

I keep dipping in and out of SoundPro, I feel there is something?interesting here but it doesn't quite play. Are you able to map the engine start and stop to a function button? I've got whistles etc mapped as I can see that in the config file, but I can't figure out how to do the start/stop.
Thanks,
Scott


Locked Re: Decoder Pro problems

 

I have found this forum to be very confusing and some of the participants to be caustic bullies and am going to stop using it!.?

Mr. Heap, I want to thank you for your time.? I have decided because I can use Digitrax's SoundLoader software and it seems to work correctly that I will go with that, instead.

Good luck and thanks to those of you who were helpful; or, trying to help me!? It is much appreciated.? To those of you with caustic intent...

Mark DeSchane


Locked Re: Decoder Pro problems

 

¿ªÔÆÌåÓý

Mark Deschane,

I sent my responses, including embedded images, it to you via private email (as you requested) around 21 hours ago.

I'll resend it now. Please acknowledge receipt (reply by email or on the list).

--?
Dave in Australia



On 3 Jan 2019, at 10:42 PM, mvdeschane@... wrote:

Dave Heap,

I have not received anything from you today, no image as you suggest, above.? However, thanks for the help you have given me!

Mark Deschane


Locked Re: VSDecoder: Problems with xml and sound #vsdecoder #rpi #ubuntu

 

Scott,

Thanks for your interest!

The function mapping is declared by triggers, right.
A trigger can be a button on a VSD panel as well as a throttle key, or both. Just want to mention that flexiblity of VSD.

A Start/Stop trigger is a little bit different. The difference is the underlying functionality, i.e. some Java code. Such triggers have to be declared in the section (or tag) <sound-event name="ENGINE" ...>.
I've put some more details in the VSD documentation here:


A Start/Stop throttle key works with a JMRI web throttle, so I hope that it also works with Engine Driver and an Android based throttle.

Klaus


Am 03.01.2019 um 10:35 schrieb Scott Rixon:

I've been following your progress with interest. The part I've kind of figured out is this.
I'm going to have a play with configuring the VSD files, including looking at which function buttons (is that the same as "notches" ?) each sound is allocated to. Is there any JMRI or other standard specs for what particular function applies to a particular button ?
In the VSD files you can see the function mapping.
<trigger name="HORN_START" type="BOOLEAN">
<event-name>F2</event-name>
<target-name>WHISTLE</target-name>
<match>true</match>
<action>LOOP</action>
? ? ? </trigger>
F2 is a whistle.
What I can't figure out is the sound stop and start! If I'm controlling from Engine Driver on my Android the engine keeps playing until I open VSD and stop it.


Locked Re: For Andrew (Andy) and his Walthers GP7

 

Hi Marc,
Program track wires are attached to the zephyr. Today, I will move them to the PR4 and use a higher output power supply. I¡¯ll make sure to change preferences to PR4 as programmer instead of interface.? I¡¯ll report back after that.?


On Wed, Jan 2, 2019 at 11:35 PM Marc <forfoum@...> wrote:
Andrew..

1 -? What? are the prog track wires attached too,? the PR4 or the DCS51 ?

2 - If attached to the PR4, what power pack is plugged into the PR4.

Your PREFERENCES need to be setup properly based on your response to above questions.

Marc

--
Andrew Roberts Potomac Sound LLC PO Box 223 Monrovia, MD 21770-0223 (301) 332-6111 Andrew@...


Locked Re: VSDecoder: Problems with xml and sound #vsdecoder #rpi #ubuntu

 

Hi Graham

Thank you very much for the feedback! Nice progress!

Love the simulator mode too. And my wife loves that I'm wearing headphones :)

LocoNet Simulator even allows to send LocoNet packets, e.g. transponding messages. That's the way I'm testing "sound follows loco", a cool VSD feature.

Sounds like you can manage all well regarding the RasPi! We can come back to VSD headless later. I've worked on it just now and I think it's not yet ready for adding it to JMRI.

On the function buttons. Notch sounds are different to sounds triggered by function buttons (a GUI button or a throttle key). Notch sounds in VSD are called Engine Sounds. Others are Configurable Sounds. A detailed specificion is not available. If you "read" a config.xml you will find out the concepts quickly. A good introduction can be found here:


Klaus



Am 02.01.2019 um 23:53 schrieb SettleDown:

Hi Klaus
Thanks for your response in the previous post, Here's some feedback:


Q1. JMRI simulator mode

You can use JMRI without a connection to the layout. This is the simulator
mode. I use the LocoNet Simulator (
) and VSD works fine with it.

Please create a new profile in Edit >> Preferences >> Config Profiles >>
New, if you want to give it a try. After a JMRI restart select "Digitrax"
as the system manufacturer and "LocoNet Simulator" as the
system connection.
Awesome !!? I got that going pretty quickly in my study on my Windows laptop, changed a few settings and tidied up my roster, copied the changed files up to my Google Drive and replaced them from the GD onto the memory stick in the RasPi which runs the layout. Love the simulator mode as it allows me to do heaps "offline".? My wife thought I'd moved the layout into the study, with all the Bells and Whistles going off !


Q2. Throttles

When I add a VSDecoder in VSDecoder Manager, I add a JMRI throttle as
well. One JMRI throttle for each VSDecoder. When I have a connection to my
layout, I prefer physical throttes. The DCC address in VSDecoder and
throttle must match, of course. Using WiThrottle and Engine Driver is a
common way to control locos (up to four, I think). An open VSDecoder
Manager with minimum one VSDecoder is required to control a loco.
Copy that !! What a good idea. I did that in the simulator and also on the layout with monitor/keyboard attached to the RasPi. Then I SSH'd and VNC'd into the RasPi from my Linux laptop and iPad in the garage and removed the monitor/keyboard?(which gets in the way of running the trains.? So now I've got a match-box size computer running everything with remote UI access to change anything !


Q3. "VSD faceless" is not yet part of JMRI. The setup could be something
like:
1) Create and configure a roster for each VSDecoder
2) Put them into a roster group named "VSD"
3) Configure a throttle key for each VSDecoder to start/stop the engine
4) Set JMRI startup: Start Virtual Sound Decoder Manager and Web Server
5) Run JMRI with option apps.JmriFaceless

On your last SD> comment:
It should be possible to auto-start RasPi and JMRI and VSD without any
interaction, and to shutdown as well. On my local test environment I can
drive a loco with VSD sound (simulator mode) via JMRI Web server
(). Open point: how to
shutdown.
I'm going to leave the faceless stuff for now, but I'm already able to start the RasPi from cold or reboot with the following Startup "init-jmri" code in the Pi:
#!/usr/bin/env bash
set -o errexit
if [ `mount | grep google-drive-ocamlfuse | wc -l` -eq 0 ]
then
? echo "mounting google drive"
? google-drive-ocamlfuse ~/google-drive
fi
echo "starting DecoderPro"
$HOME/JMRI/DecoderPro
This code mounts and syncs Google Drive each time i start/reboot the RasPi then starts up VNC server with the required settings, then launches JMRI which has a bunch of internal startup commands which start WiThrottle, Webserver, VSDecoder, roster, turnout-table, turnout panel, etc. so that when I VNC into the Pi a can see and interact with all these windows on the laptop.
As for shutting down, i just ssh a Linux "reboot" command to make a fresh start of JMRI, or else ssh "poweroff" to shut down the RasPi completely.
I'm going to have a play with configuring the VSD files, including looking at which function buttons (is that the same as "notches" ?) each sound is allocated to. Is there any JMRI or other standard specs for what particular function applies to a particular button ?
BTW. Is there any provision for including photos in the jmriusers posts ?? I wanted to include a shot of the RasPi JMRI UI as seen by my iPad.
Cheers
Graham - @SettleDown


Locked Re: Decoder Pro problems

 

Dear Dave Heap,

I'm uncertain why there are now three thread named Decoder Pro problems.? This thread is the one I started and so I will attempt to answer; or, do the things recommended to me at the other Decoder Pro problems threads here.? You requested that I download V4.15.1? This I have done and I have opened it up; but, not done anything in it.? ??


Locked Re: Decoder Pro problems

 

Dave Heap,

I have not received anything from you today, no image as you suggest, above.? However, thanks for the help you have given me!

Mark Deschane