!!

Not Registered?

Welcome!  Please register to view all of the new posts and forum boards - some of which are hidden to guests.  After registering and gaining 10 posts you will be able to sell and buy items on our N'porium.

If you have any problems registering, then please check your spam filter before emailing us.  Hotmail users seem to find their emails in the Junk folder.


Thanks for reading,
The NGF Staff.

Author Topic: JMRI help required  (Read 168 times)

0 Members and 1 Guest are viewing this topic.

Offline MarshLane

  • Trade Count: (0)
  • Full Member
  • ***
  • 2mm Association Number: 5440
  • Posts: 147
  • Country: gb
    • Awards
JMRI help required
« on: September 16, 2020, 07:25:39 PM »
Evening all,
I am looking at options for computer control of some parts of the new layout.  TrainController is great in many respects but to restrictive in others, I have looked and iTrain and don't think I can do what I want with it, I am therefore looking at going down the road of some custom software to interact with Loconet (for loco control) and CBUS for accessory control.  I would also like to prove to myself that I can do it!

Why go down that road? Well, some of what I want to do isn't straight forward, and also the operations side needs to communicate with some other software for a number of other aspects of the layout long term. I also find as I get older, that I am able to understand, bug fix and adapt code I have written myself, rather than trying to work out what somebody else was thinking. 

Current thinking is to use C++ (although Java would be an option) on a PC, but it occurred to me that I'm not the first to do this, so the basic aspect of connecting a PC to LocoNet (in the first phase) and communicating with it had to have been done before.  I am wondering therefore, whether parts of JMRI can be used as a 'translator API/Interface' and thought there may be somebody on here who could either a) given me a bit of insight into JMRI, or b) point me towards the right forum?

I was previously a member of MERG, but currently am not. I have looked through the JMRI pages and I am not convinced its usable, but I could (quite easily) just be missing something.  Any help either on here or as a PM would be appreciated.

Thanks guys
Rich

Online njee20

  • Trade Count: (+4)
  • Full Member
  • ***
  • N Gauge Society Number: 22598
  • Posts: 7120
  • Country: gb
    • Awards
Re: JMRI help required
« Reply #1 on: September 16, 2020, 10:15:40 PM »
JMRI, being open source, is great in some areas, and less well developed in others. It's also only really limited by your capability if you're so inclined!

Accessory control works pretty well, the actual automation of stock is less well formed, but can definitely be done. Nigel Cliffe of this parish is extremely knowledgable, and is involved in its development.

Offline sprogman

  • Trade Count: (0)
  • Full Member
  • ***
  • N Gauge Society Number: 17786
  • 2mm Association Number: 4557
  • Posts: 396
  • Country: gb
    • Awards
Re: JMRI help required
« Reply #2 on: September 17, 2020, 09:23:06 AM »
JMRI can certainly connect to Loconet and CBUS at the same time. It should also be possible to use CBUS cabs to control trains via Loconet. There is a thread about this on the MERG forum at the moment :) Others are far more knowledgeable than me on this.

JMRI has some automation features but you can also write your own scripts in Jython, which is basically Python in a Java environment.

If you want to use C++ and JMRI then you would need some kind of bridge between C++ and Java. JMRI already has a Loconet server that you should be able to connect to. That may be all you need if you can then bridge the layout control to CBUS using JMRI's existing features.

Offline Nigel Cliffe

  • Trade Count: (0)
  • Full Member
  • ***
  • Posts: 811
  • Country: gb
    • Awards
Re: JMRI help required
« Reply #3 on: September 17, 2020, 10:18:58 AM »
If writing your own LocoNet interface, you run into a documentation issue.  The LocoNet Personal Edition documentation (the public stuff) is only the basics.  There is more to the LocoNet protocol, but only available to license holders (talk to Digitrax about a license).   

I think using JMRI or RocRail as a starting point will be quicker - the basics to interface to LocoNet and CBUS are all present and working.  The question is then which is the easier to extend. 

If using CBUS for part of the system, then none of the commercial packages are any use.  They don't talk CBUS and are highly unlikely to ever change to supporting CBUS.

JMRI has two forums,  "jmriusers" where users ask questions over all levels of complexity, and "jmri-developers" where the development team talk code and code management issues.   Both are reasonably open to new participants. 



As a slightly-sideways illustration of extending software.  David Townend of the McKinley Railway(*) found TrainController couldn't do all he needed.  So, new software written which provides another layer of management.  That communicates with TrainController using sensor messages (to trigger events in TrainController) and turnout messages (for TrainController to report what it has done).   A similar approach to communicating with existing software packages might work for you.

(* possible the largest and most complicated automated model railway in the UK ).

- Nigel

Offline MarshLane

  • Trade Count: (0)
  • Full Member
  • ***
  • 2mm Association Number: 5440
  • Posts: 147
  • Country: gb
    • Awards
Re: JMRI help required
« Reply #4 on: September 17, 2020, 11:33:21 PM »
Guys,
Thanks for the background there.  I think @Sprogman and @Nigel Cliffe have answered the question, that it is feasible to run a layer of customer software on top of JMRI, and basically use JMRI as the comms platform to link in CBUS and LocoNet. I just need to work out how the best way of doing that is now.

My original thought was to use TrainController in a similar way to how you describe David Townend has worked, but as flexible as it is, plans have moved on and TC is not adaptable enough for what I want.  My plans are long-term and I openly acknowledge overly complex for a model railway(!) but having coming from a big railway background it is a level that I want to go to. Before anyone says I am being overly ambitious, yes I know I am! But the principals of this have been in the subject of doodles, bits of random coding and aspirations for a few years now.  I know there will be times that I fail and it goes wrong, but I always think we should never stop learning.

So really all I want is JMRI to interface with CBUS/LN and pass the message data to/from my software, which sounds like it is feasible.  Nigel - yes I agree with you that using JMRI will be a quicker starting point.  I spoke with Digitrax about two years back, and had a great phone conversation with one of their technical guys, not sure how I got to him now(!), but he sent me a large document on Loconet and the protocol which I think covers everything - and isn't the personal edition.  This formed the basis of my start from scratch thing, but why reinvent that part of the wheel ... so I'll continue to dig around in the documentation and see how I can connect into the JMRI Loconet Server.

Cheers guys

Rich

 

Please Support Us!
September Goal: £60.00
Due Date: Sep 30
Total Receipts: £71.00
Above Goal: £11.00
Site Currency: GBP
118% 
September Donations

anything
SimplePortal 2.3.5 © 2008-2012, SimplePortal