This topic contains 15 replies, has 3 voices, and was last updated by
click 2 months, 2 weeks ago.
-
AuthorPosts
-
13/03/2016 at 4:48 pm #27978
Many of you know what is bothering me regarding Robox and software. But something interesting happened recently. I happened to wonder into installation directory of AM and found some radical (I would say for the better) changes: all third party software (read Java jar files) are now taken out in their original for and put in …/AutoMaker/lib dir. And that gave me an idea. Why not replace open source jssc library (java simple serial connector) with my own version which knows how to handle serial ports over network. But of tinkering (last two days) and now I have custom jssc-2.8.0.jar library that has same API as old so AM is happy with it. Only difference is that now it knows how to connect to socket as well as serial port. Next was to make little proxy (which I cheekily put in same jar) which knows how to read data from the socket and redirect to pre-defined (set as an argument) serial port locally (on my RPi sitting next to the Robox). Last bit was to replace “NOT_CONNECTED” string in discovery script to return something like “serialproxy:192.168.1.161/9990” (string is going to change to something more compatible with URIs) in case no local Roboxes found on my Mac. Implementation of jssc I’ve done knows how to handle strings starting with “serialproxy:” and redirect bytes to there…
Result: I am now printing with Robox with my laptop on my lap using wirelsss to monitor print (VLC + RPi camera) and AM is happy for Robox not being directly connected to it. Next is going to be doing the long print while at work knowing that I can use AM to clear errors remotely (and check the progress, etc). Same is going to work perfectly with Linux. Unfortunately not for Windows as discovery process (that Robox is attached or not) is slightly different and someone would need to make an exe file which does the same as my changed RoboxDetector.mac.sh script.
I am happy to share jssc library (or even better - I might spend more time and make code robust enough so it can be fit to be eventually returned to the original lib on github or alternatively forked) and explanation what I did to shell script if anyone is interested. Theoretically it will work perfectly happily having more than one Robox attached to same RPi or different RPis.
13/03/2016 at 6:00 pm #27981I applaud you for this !
java (EE), JavaFX, HTML, GIS) programmer, database wizard, framework inventor, looking for a job ! http://roboxing.com/wizards
21/04/2016 at 10:55 am #29172I’ve just reminded to this topic - as I am, ***finally*** approaching completion of my printer tower (an enclosed custom built rack alike structure in the corner of my new room) I started daydreaming what else I can do with remote printing. One of the things that I would really like to do is test if printer is printing or idle (which I might be able to do resurrecting rbx toolset) and if idle provide ability to physically switch it off (using same RPi that is to monitor it). Also, when detected that there is a print in progress, to switch an extractor to pull the air from semi-airtight enclosure where print was supposed to be sitting in.
That way I would be able to switch the printer on on-demand, switch the extractor as so as head temperature goes over certain threshold and switch the printer off when head temperature is back to ambient and no communication with the printer has been done for certain timeout period. And all of it from anywhere in the world!
Next, after that, would be @pelgrim idea of robotic arm (or something) to push content of the bed out of the printer while keeping door open 🙂
22/04/2016 at 6:17 pm #29294I’ve forked jssc in github:
https://github.com/natdan/java-simple-serial-connector
Let me know if anyone needs compiled jar (a binary).
23/04/2016 at 10:23 pm #29325I had a bit of time to spend on this tonight, but only a bit!
I started creating the Windows wrapper and have at least managed to establish what arguments Automaker passes and what the detector app returns:
C:\Program Files\CEL\Common\bin\RoboxDetector.exe 16D0 081B
returns:
COM8
if connected, and…
NOT_CONNECTED
if not. If you don’t supply sensible command line arguments it returns
ERROR-ARGS
(the 16D0 and 081B are the USB Vendor & Device IDs).
I’ll contine with the next part tomorrow evening 🙂
24/04/2016 at 9:48 am #29331Great!
Here is compiled jssc fork: https://www.dropbox.com/s/to5j90d73amdiuc/jssc-2.8.0.jar?dl=0
You need to replace <AM install dir>/AutoMaker/lib/jssc-2.8.0.jar with it (safe the original just in case) and you’re at that point ready to go as soon as you make your .exe file return:
serialproxy://<ip-or-address-to-raspberry-pi-running-jssc-bridge>:<port> (where port by default is 9990)
when it can connect to <ip-or-address-to-raspberry-pi-running-jssc-bridge>:<port> socket. Otherwise just call in turn original .exe file.
Oh, to run same jssc jar on RPi (or any other linux machine!) you can do it with:
java -cp jssc-2.8.0.jar jssc.Proxy <serial-port>
where <serial-port> is normally /dev/ttyACM0 (no autodetection of robox here but as it will have only one serial interface then I just pass it as an argument). This all can be made much neater if needed. Oh, you can pass switch like -v, -vv or -vvv to increase logging details, or even redirect to log file. I normally run it with:
nohup java -cp jssc-2.8.0.jar jssc.Proxy /dev/ACM0 >robox.log &
so I can log off later. To stop it (or restart it) I just run
ps aux | grep java
and kill it! (kill -9 <process_id>)
I suspect pkill -9 java would do the same. Let me know how are you getting on with it. I’ll write more later…
24/04/2016 at 9:47 pm #29361No joy tonight I’m afraid.
The java app runs fine on the RPi, however the Windows side seems reluctant to work.
I’ve replaced the RoboxDetector.exe with a really simply program that just returns the required string:
int _tmain(int argc, _TCHAR* argv[])
{
printf(“serialproxy://192.168.1.100:9990\n\r”);
return 1;
}(I’ve tried various combinations of return codes and line endings - none made a difference). Using Wireshark I’ve verified that the Windows machine never made any attempted connections to that IP or that port.
I’m not entirely sure the Windows version uses the Java serial library. There’s a file called rxtxSerial.dll in the Automaker directory…. I suspect this is involved somehow. Perhaps not the end of the world though - over the next few days I’ll see if I can snoop the DLL functions called -we may just be able to replace this file.
24/04/2016 at 10:02 pm #29363Okay so I Googled rxtxSerial.dll. Essentially an alternative to jssc, and it’s open source, however I don’t think modification is going to be trivial. There’s a fair amount of code, and I’m not even sure I’ve got the tools to compile it. Will look properly over the coming week.
25/04/2016 at 7:46 am #29373Just to make sure - you didn’t forget to replace <AM install dir>/AutoMaker/lib/jssc-2.8.0.jar with the one I have uploaded? My understanding is that AM would use what is returned from RoboxDetector.exe (“COM8”) and pass it to jssc library. If it is replaced then it will check for existence of “serialproxy://” string at the beginning of it and if so use different classes. I’ll double check jar I have uploaded and see what I can do to increase logging level so you can see if it fails and how. I think you’re on the right track. Oh, and, I don’t mind installing Robox on VM and give it a go on my laptop if you can share that exe file.
I don’t think there’s any need to fiddle with .dlls at this point as everything goes through Java and it is far simpler to start with…
25/04/2016 at 11:03 am #29378The plot thickens…. It appears that the brand new installation of Automaker I’m using on this dev PC isn’t calling RoboxDetector.exe at all (original or otherwise), so that may be why I wasn’t getting anywhere last night.
This evening I’ll try with my normal installation (I’d installed Automaker on a PC I don’t normally use for 3D printing to reduce the chance of catastrophic breakage!).
If you want my RoboxDetector it’s located here. At the moment it’s fairly simple - if the text file RoboxPort.txt exists in the same directory as the detector executable it returns the string from that, otherwise it calls the original detector exe (which needs to be renamed to RoboxDetectorOriginal.exe).
http://fast.whitakernet.com/RoboxDetectorWrapper.zip
25/04/2016 at 11:25 am #29379Very very odd….. just tried the modified executable on my original Automaker install and it runs it fine, so it’s something related to the new installation of Automaker on my dev PC….
So with that in mind I replaced the jssc library and it appears to be working! I can’t verify it with a real printer attached until this evening, but I see it try to open the tcp connection to the correct detination IP when I start Automaker.
No idea what’s going on with my dev PC - will see if a reinstall fixes it.
25/04/2016 at 6:16 pm #29392Just to let you know - the whole thing works a treat!
@click thank you so much - this is a much neater solution than using usbip.
I’m happy to improve the Windows side if you want - perhaps adding some form of auto-discovery protocol or selection menu…. I’ll leave it up to you to decide what makes most sense.
-
AuthorPosts
You must be logged in to reply to this topic.




