Page 1 of 1

Enhancement to RocJ, looking for Source Code

PostPosted: 07.12.2014, 16:46
by dimastep
Hi Folks,

I am a full-time Java developer and was looking for a way to control my Roco or Marklin Digital Cranes using PC Joystick or gamepad.

So far I didn't find any software on the net that let me do it out of the box, but I did find RocRail and in particular RocJ. As Java is my bread and butter in daily life I realized that I can easily enhance it with such a feature. Needless to say I will release my enhancement back to the community as today there is no way, to my knowlege to control Roco or Marklin Cranes with PC Joystick and that severely restricts the fun of these cranes.

I can't seem to find any sourcecode for it on Launchpad, or anywhere else, even though I believe it was available in the past.

Can the source code for it be made avialable again?

Thanks!

Re: Enhancement to RocJ, looking for Source Code

PostPosted: 07.12.2014, 16:53
by rjversluis
Hi,

the source of all mobile Rocrail clients is no longer public.
Some users forced this step because of trying to omit the need for a Rocrail support key by changing and publishing modified source code.
The support key is essential for keeping the Rocrail Project financially alive.

Re: Enhancement to RocJ, looking for Source Code

PostPosted: 07.12.2014, 17:47
by LDG
Hi dimastep,

joystick and/or gamepad have only a limited set of "input instructions".
ON/OFF can be mapped to switch commands or (loco-)functions and analog input to (loco-)speed commands.
You may use RCP Scripting (prefered, all functionality) or SRCP Scripting (reduced functionality) to write a small translator client ("Interface for Roco or Marklin Digital Cranes to Rocrail").

But Java sometimes has "challenges" (limitations?) in accessing hardware interfaces in a platform independent way (my experience with a Win/Linux/MacOS Java tool using USB) :wink:

Regards,
Lothar

Re: Enhancement to RocJ, looking for Source Code

PostPosted: 07.12.2014, 20:59
by dimastep
Hi Lothar and Rob!

Thanks for your replies!

So, in RocRail itself is there any support for PC-connected joystick or gamepad?
If so, I may then brush up on my C++ skills and do enhancements there.

I know Java isn't 100% friendly with USB and game controllers, but I figured I'll give it a try.
Basically here's what needs to be done. Each joystick axis movement will translate to setting F1, F2, F3 On or Off and then setting throttle proportional to axis movement.
Do you think this doable within RocRail without too much hassle?

Of do you think doing it with RCP scripting is easier still?

Thanks again!

Re: Enhancement to RocJ, looking for Source Code

PostPosted: 07.12.2014, 21:22
by rjversluis

Re: Enhancement to RocJ, looking for Source Code

PostPosted: 07.12.2014, 23:05
by dimastep
Thanks Rob!

That's almost what I was looking for. Though they way I see it was implemented in RocRail won't work out of the box for these cranes.
The cranes expect that each axis movement will not only change the throttle on the decoder but also activate appropriate F1, F2 or F3.
That's the whole idea, user should not be able to toggle F1, F2, F3 manually. He should just control 3 axis and software should take care of the rest.
Obviously there is only one "throttle channel" there so moving multiple asix at the same time won't be able to control speed of each function individually. But that's OK, functionality can be made
to only ever allow one axis activation at a time.

Now it's time for me to actualy buy a Marklin system compatible with RocRail and setup RocRail with Eclipse so that I can implement this new code...