¿ªÔÆÌåÓý

Locked Starting jmriHeadless with specific "Panel" and "Jython script" #scripting #rpi


 

Greetings,

I think I've got my configuration working to control the Walther 130' DCC-controlled turntable from our LCC control panel. As a reminder, I've got a Raspberry Pi mounted under the module, along with several Tower-LCC nodes (connected by a LCC-Buffer-USB to the Raspberry Pi) and another Serial cable going to the NCE Command Station. I've spent the evening in PanelPro, pressing buttons, making the turntable go where I want it.

NOW, it's time to "productionize" this... to configure it so that I don't need to have Putty and XMing running, all I want to have to do is connect power to the module and the Command Station, and have the R-Pi start up JMRI "Headless" automatically (to many in the club, that's pronounced "automagically.") I'm looking for command-line prompts, and while I've found a couple of useful ones, I don't see how to:
  1. Specify the "Panel" (actually, just a configuration of Sensors listening to the LCC Events, and Turnouts that generate the requisite DCC Events via the Command Station), and
  2. Specify to run a particular Jython script upon startup (it listens to the Sensors, identifies which lead is intended from their UserName, remembers which direction the turntable was facing last time the requested track was selected, and then determines to either Throw or Close the "turnout" to send the turntable a-spinning.)
Basic command (probably to be run via systemd, although I haven't committed yet):
  • /opt/JMRI/jmriHeadless --config=/opt/JMRI/jmri.conf --profile=/home/brian/.jmri/My_JMRI_Railroad.jmri/profile/profile.xml

This specifies the configuration and profile files, per the instructions on the JMRI website.

I've also go:
script:
/home/brian/.jmri/turnoutListener.py
"panel" definition
/home/brian/.jmri/My_JMRI_Railroad.jmri/Turntable.xml

How can I indicate to use those when jmriHeadless is run?

Thanks,

Brian Pickering


Randall Wood
 

You want to do two things:

  • In your profile, using PanelPro, under "Preferences->Start Up", you want to add an Open File (pointing to your Turntable.xml file) and Run Script action (referring to your script)
  • Use the command "/opt/JMRI/jmriHeadless --profile=/home/brian/.jmri/My_JMRI_Railroad.jmri" (the config option points to instructions about which profile to use if --profile is not specified, and the profile is a directory with a potentially large number of files).

You may also want to consider: - Use VNC, not X-over-SSH, to access your Raspberry Pi -- this way, once you configure the default account to auto-login, PanelPro can be configured to be automatically launched by that user, and you can use VNC to connect to the running instance of PanelPro instead of only being able to launch PanelPro after you connect with Putty.


 

¿ªÔÆÌåÓý




On Jun 1, 2019, at 7:01 AM, Randall Wood via Groups.Io <rhwood@...> wrote:

You want to do two things:

  • In your profile, using PanelPro, under "Preferences->Start Up", you want to add an Open File (pointing to your Turntable.xml file) and Run Script action (referring to your script)
  • Use the command "/opt/JMRI/jmriHeadless --profile=/home/brian/.jmri/My_JMRI_Railroad.jmri" (the config option points to instructions about which profile to use if --profile is not specified, and the profile is a directory with a potentially large number of files).

You may also want to consider: - Use VNC, not X-over-SSH, to access your Raspberry Pi -- this way, once you configure the default account to auto-login, PanelPro can be configured to be automatically launched by that user, and you can use VNC to connect to the running instance of PanelPro instead of only being able to launch PanelPro after you connect with Putty.

You can also configure the Raspberry Pi to automatically login as a user and start JMRI in headless mode. ?see, for example?.

The link above mentions executing a script at login. ?This can be a simple call to start JMRI with the appropriate options.

There is some advantage to this, primarily a slight reduction in processor and memory usage ( due to not drawing the GUI ). ?In a memory constrained setting, conservation of memory can be important.

Paul


 

See this link??for auto-start.
--
-splasher in somd
-NCE PowerCab with Rapsberry Pi 3b+ and JMRI 4.21.3 and Engine Driver 2.26.117
-DCC-EX with Arduino Uno w/motor shield, Raspberry Pi 3b+ and JMRI 4.21.3