Keyboard Shortcuts
Likes
- Jmriusers
- Messages
Search
Locked
Re: id tags not found error though they seem to be there
¿ªÔÆÌåÓýOn Dec 23, 2019, at 5:33 AM, Randall Wood via Groups.Io <rhwood@...> wrote:
Hmmm... I had to go back and look... the first Route implementation was introduced on June 11,2004. ?The first reporter was July 18, 2004, so yes, routes predate reporters, but only by 5 weeks.... which really means that they came about at the same time, in the grand scheme of things. ?( our release schedule wasn¡¯t the same as it is now, it would take some more digging to verify if they were introduced in the same release version or in two different, but successive, ones... ) Paul |
Locked
Re: id tags not found error though they seem to be there
On Dec 23, 2019, at 10:52 AM, ahouse3761 <trainmail1@...> wrote:Ok, I will look at this when I get a chance. Pau |
Locked
Re: Running a python script in JMRI
#scripting
Inobu,
It helped me, thanks. -- Mike Heintzman Modeling the P&PU since 1953 |
Wayne,
I can't tell from your post if you use JMRI or not. If you use JMRI, setting up routes is much much easier than if you have to use the Digitrax throttle to do it. The DS64 manual has a copy of a worksheet in it that is helpful is mapping the routes out. The DS64 will allow 8 routes, but there is?something you need to be aware of if you aren't already. Route number 1, also know as the top route, can cause issues if you don't know how it works. The 1st route turnout number becomes the route number of each route. If turnout 50 is the first turnout in the route 1 position?in the DS64, then the route number is?50. This is where a problem can occur. IF EACH TURNOUT NUMBER IN?THE ROUTE 1 POSITION? OF ALL THE DS64'S IS DIFFERENT, THEN YOU SHOULD NOT HAVE A PROBLEM. BUT, IF THE TURNOUT NUMBER OF THE TURNOUT IN THE TOP, OR 1ST ROUTE POSITION IS THE SAME ON MORE THAN ONE DS64, THIS WILL CAUSE A PROBLEM. If turnout 50 is the top or 1st turnout on more than one route, then each time a route is selected that 50 is the top turnout, then EVERY route that has 50 in the top position will try and throw. From my experience one of two things will happen, multiple routes will throw or the Loconet will be flooded with commands. The simplest way to keep this from happening is to use a DIFFERENT virtual turnout number in the top position of every route. The downside to this is that now you only have 7 routes that you can use rather than 8. I hope I haven't confused you with this, but it cost me a lot of time before I figured it out. Clay Smith |
Production version 4.18 of JMRI/DecoderPro is available for download.
This is a new production release containing changes since last July. If you are currently using JMRI 4.9.6 or earlier, we strongly recommend that you first update to JMRI 4.12 and make sure that's running OK before updating to this release. There have been a number of changes in serial port support, panel file format and configuration options since those earlier releases, and moving to the stable JMRI 4.12 release is a good way to work through any possible problems. <> (In the future, we¡¯ll probably saying that about this one too) If you use JMRI on Linux or Mac and are updating from JMRI 4.7.3 or earlier, there¡¯s a necessary migration step. (Not needed on Windows) Please see the JMRI 4.12 release note for details: <> For more information on the issues, new features and bug fixes in 4.18 please see the release note: <> Note that JMRI is made available under the GNU General Public License. For more information, please see our copyright and licensing page. <> The download links, along with lots of other information which we hope you'll read, can be found on the release note page: <> Bob -- Bob Jacobsen rgj1927@... |
Locked
Re: Running a python script in JMRI
#scripting
Could you do the combining separately, in an audio editor, to create a new wav file outside JMRI? Then, at the appropriate time, just select that file and play it.
Bob On Dec 23, 2019, at 10:53 PM, tim_p1964@... wrote:-- Bob Jacobsen rgj1927@... |
Locked
Re: Running a python script in JMRI
#scripting
Hi Matt
was just contemplating that way around the issue, there would i say be around a max of 8 files all very small in size wav files, I can add all the files to the JMRI audio buffers and play them using a script but when i try to combine or get them to follow one another they all play together??? i am thinking of a script that could read a list of file indicators indicating which files to play in which order determined by the rest of the program just need to find the command? to check when one file has finished and play the next file. Tim |
Locked
Display throttle panel/frame from script
Hi, having issued a self.getThrottle is there a way to cause the throttle to be visible from a script.
Thanks Jim. |
Locked
Re: Running a python script in JMRI
#scripting
Tim,
I'll need to take a closer look, but you might be able to achieve what you're after by using the queueAudioBuffer method available within the Audio framework in JMRI. In essence, you would load each file segment into JMRI as AudioBuffer objects then queue then accordingly based upon your logic to a suitable configured AudioSource and then play the sequence. This removes the need to mash together individual fragments into a single wav file, rather queues each segment one after the other and plays in order. Roughly how many individual sound segments are we talking about? Best regards, Matt H |
Locked
Re: Running a python script in JMRI
#scripting
Randall Wood
Some notes about scripting in JMRI:
|
Locked
Re: Running a python script in JMRI
#scripting
Hi
The issue is not the playing of the Wav file from JMRI when a sensor is triggered, this I can do. the issue is that of having several wav files that are selected and combined depending on the value of the memory in the block section that the sensor is attached to, and other vales such as turnouts.? That is what the script is supposed to do. eg combining the following, "the train"+"approaching"+"platform 1" +"is the"+"10:42"+"virgin trains"+"service to"+"London Paddington" to give " the train approaching platform1 is the 10:42 virgin trains service to london paddington" so as a train triggers the sensor the logic works out what train it is and which platform depending on the sensors and turnouts and produces the correct sound file. all trains have unique rfid tags that JMRI stores in the memory of the block as the train moves from block to block. Tim |
Locked
Re: Running a python script in JMRI
#scripting
TIm,
Create SensndExample_1.py file from the test code below the ** , save it in your directory C:/Users/tim_p/sounds/Peter/ In Panel Pro, Panel, select Run Script - go to the Peter directory and run the SensndExample_1.py. Python is now running in the background. Go to Tools, Table Sensor and create sensor 473 in my case I used LS473 When its created just click the active button and listen. Click the inactive button it silent. In the if statement you can see where the playback is in a loop via the...... snd.loop() command. that the active/inactive states are registered.? Now you can replace the "Crossing.wav" with your General01.wav and link the sensor representing the station. Step by step you can get this going. I can believe how much time I wasted on an indentation issue in the original file. When you posted up your log I thought duh!!? Looked at the log and found the dent space, the file worked.? It would be crazy to do the coding outside of JMRI when its already done. Thanks for the question as it got me to do something I should have done long time ago. ? ? Inobu * ?? # It listens for changes to a sensor, # and then plays a sound file when sensor active import jarray import jmri # create the sound object by loading a file snd = jmri.jmrit.Sound("resources/sounds/Crossing.wav") class SensndExample(jmri.jmrit.automat.Siglet) : ??????? # Modify this to define all of your turnouts, sensors and ??????? # signal heads. ??????? def defineIO(self): ??????????????? ??????????????? # get the sensor ??????????????? self.Sen1Sensor = sensors.provideSensor("LS473") ??????????????????????????????? ??????????????? # Register the inputs so setOutput will be called when needed. ??????????????? self.setInputs(jarray.array([self.Sen1Sensor], jmri.NamedBean)) ??????????????? return ??????? # setOutput is called when one of the inputs changes, and is ??????? # responsible for setting the correct output ??????? # ??????? # Modify this to do your calculation. ??????? def setOutput(self): ??????????????????????????????? ??????????????? if self.Sen1Sensor.knownState==INACTIVE: ??????????????????????? snd.stop() ??????????????? elif self.Sen1Sensor.knownState==ACTIVE: ??????????????????????? snd.loop() ??????????????? ??????????????? return ??????? # end of class definition # start one of these up SensndExample().start() |
Andrew,
On 24 Dec 2019, at 3:50 PM, andrew.woolman <apwool@...> wrote:No need to reinstall and it's almost certain that port will stay at cu.SLAB_USBtoUART, so just give it a try. But system console is your friend... If you get the same symptoms, you've ruled out the NCE USB as the cause :( Dave in Australia |
Locked
Re: Running a python script in JMRI
#scripting
Tim,
It's funny I had the same thing in mind. I have been playing around with this today between tasks. JMRI uses jmri.jmrit.Sound to play the wav file. You are trying to pull up the wave module and JMRI does not know what that is hence the failure.? Your best bet is to just what is already in JMRI.? Jython is what's there. I don't think stringing the wav file is going to work very well from an audio or play back perspective. Trying to get the acoustics in all the wav files itself will be difficult. This is the py file I'm trying to get working to do the same thing.? I got the others (Samplesound.py ) to work but not this one. This uses the Siglet which is different This is what you .? This is the file to get going. SensndExample.py ? # It listens for changes to a sensor, # and then plays a sound file when sensor active import jarray import jmri # create the sound object by loading a file snd = jmri.jmrit.Sound("resources/sounds/Crossing.wav") class SensndExample(jmri.jmrit.automat.Siglet) : ??????? # Modify this to define all of your turnouts, sensors and ??????? # signal heads. ??????? def defineIO(self): ??????????????? ??????????????? # get the sensor ??????????????? self.Sen1Sensor = sensors.provideSensor("473") ??????????????????????????????? ???????????????? # Register the inputs so setOutput will be called when needed. ???????????????? self.setInputs(jarray.array([self.Sen1Sensor], jmri.NamedBean)) ??????????????? return ??????? # setOutput is called when one of the inputs changes, and is ??????? # responsible for setting the correct output ??????? # ??????? # Modify this to do your calculation. ??????? def setOutput(self): ??????????????????????????????? ??????????????? ??????????? if self.Sen1Sensor.knownState==ACTIVE: ??????????????????????? snd.play() ??????????????? ??????????????? ??????????????? return ??????? # end of class definition # start one of these up SensndExample().start() ? . |
Locked
Re: Running a python script in JMRI
#scripting
Hi guys
this is the relevant section of the JMRI session window that shows whats wrong i think. javax.script.ScriptException: ImportError: No module named wave in <script> at line number 3 ??? 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(Unknown Source) ??? at jmri.script.JmriScriptEngineManager.eval(JmriScriptEngineManager.java:263) ??? at jmri.jmrit.jython.InputWindow.buttonPressed(InputWindow.java:283) ??? at jmri.jmrit.jython.InputWindow.lambda$2(InputWindow.java:133) ??? at javax.swing.AbstractButton.fireActionPerformed(Unknown Source) ??? at javax.swing.AbstractButton$Handler.actionPerformed(Unknown Source) ??? at javax.swing.DefaultButtonModel.fireActionPerformed(Unknown Source) ??? at javax.swing.DefaultButtonModel.setPressed(Unknown Source) ??? at javax.swing.plaf.basic.BasicButtonListener.mouseReleased(Unknown Source) ??? at java.awt.Component.processMouseEvent(Unknown Source) ??? at javax.swing.JComponent.processMouseEvent(Unknown Source) ??? at java.awt.Component.processEvent(Unknown Source) ??? at java.awt.Container.processEvent(Unknown Source) ??? at java.awt.Component.dispatchEventImpl(Unknown Source) ??? at java.awt.Container.dispatchEventImpl(Unknown Source) ??? at java.awt.Component.dispatchEvent(Unknown Source) ??? at java.awt.LightweightDispatcher.retargetMouseEvent(Unknown Source) ??? at java.awt.LightweightDispatcher.processMouseEvent(Unknown Source) ??? at java.awt.LightweightDispatcher.dispatchEvent(Unknown Source) ??? at java.awt.Container.dispatchEventImpl(Unknown Source) ??? at java.awt.Window.dispatchEventImpl(Unknown Source) ??? at java.awt.Component.dispatchEvent(Unknown Source) ??? at java.awt.EventQueue.dispatchEventImpl(Unknown Source) ??? at java.awt.EventQueue.access$500(Unknown Source) ??? at java.awt.EventQueue$3.run(Unknown Source) ??? at java.awt.EventQueue$3.run(Unknown Source) ??? at java.security.AccessController.doPrivileged(Native Method) ??? at java.security.ProtectionDomain$JavaSecurityAccessImpl.doIntersectionPrivilege(Unknown Source) ??? at java.security.ProtectionDomain$JavaSecurityAccessImpl.doIntersectionPrivilege(Unknown Source) ??? at java.awt.EventQueue$4.run(Unknown Source) ??? at java.awt.EventQueue$4.run(Unknown Source) ??? at java.security.AccessController.doPrivileged(Native Method) ??? at java.security.ProtectionDomain$JavaSecurityAccessImpl.doIntersectionPrivilege(Unknown Source) ??? at java.awt.EventQueue.dispatchEvent(Unknown Source) ??? at java.awt.EventDispatchThread.pumpOneEventForFilters(Unknown Source) ??? at java.awt.EventDispatchThread.pumpEventsForFilter(Unknown Source) ??? at java.awt.EventDispatchThread.pumpEventsForHierarchy(Unknown Source) ??? at java.awt.EventDispatchThread.pumpEvents(Unknown Source) ??? at java.awt.EventDispatchThread.pumpEvents(Unknown Source) ??? at java.awt.EventDispatchThread.run(Unknown Source) Caused by: Traceback (most recent call last): ? File "<script>", line 3, in <module> ImportError: No module named wave Tim |
Locked
Re: Running a python script in JMRI
#scripting
Hi Guys
Thanks for the replies. i have previously tried adding import JMRI and import java, makes no difference. the premise for the script is that i want to be able to combine various short wave files into one so as to be able to play the one file as a train arrival announcement.? e.g. "the train arriving"+"at platform 1"+ "is the" etc etc.which files would depend on which train etc etc. whilst i can do the logic and read the sensors and block values. I can also play the wav file from within JMRI. what i cant do is get the combine wav script to run in jmri. the missing library appears to be this one in this link the question is how can i add this functionality into JMRI or how do I get JMRI to run it as a python shell type script? Tim |
Locked
Re: Running a python script in JMRI
#scripting
LOL,
Maybe I should read the thread completely to understand the objective. At least I got script tested an done. lol. Inobu ? |
Locked
Re: Running a python script in JMRI
#scripting
Tim, Others on this list will have to provide help concerning your wave questions. A few general remarks concerning Jython and JMRI might help. 1 Insert two lines at the head of your script:
Use lower case. To be safe, it is a good idea to include those two lines in all of your JMRI scripts. If they are not needed (almost never for jmri), at least they seem to do no harm. 2 Your "print" commands will only print to the JMRI "Script Output" window. If you get anything there, provide us with a copy of that text pasted into your next posting. 3 Provide us with a copy of the text in your "JMRI System Console" window or equivalently the text of your "Sessions.log" file. In either case, again cut and paste but do not attempt to append a file. Extra footnote, when attempting to provide us with code, make use of the Groups.io feature called "Github Flavored Markdown Guide" available when composing messages from within the Groups.io window when logged in. In particular, the use of triple copies of the backquote character "`" before and after the code snippet helps the readability. Cliff in Baja SoCal |