Toastie Posted February 18 Posted February 18 Not exactly: The one's (here is to @BrickTronic) complement of your checksum is wrong: 0xFF-0x5B=0xA4, if I am not mistaken. Best Thorsten Quote
AJB2K3 Posted February 18 Posted February 18 1 hour ago, Toastie said: Not exactly: The one's (here is to @BrickTronic) complement of your checksum is wrong: 0xFF-0x5B=0xA4, if I am not mistaken. Best Thorsten Opps, thanks for giving it a look. Quote
Bliss Posted February 19 Author Posted February 19 I updated LegoRcx.py in the Dropbox link. I just added the LastCmdSerStr that you can use to print the last Serial Command String. Example: >>> from legorcx import RCX >>> r=RCX("COM17") >>> r.snd(2) >>> print(r.LastCmdSerStr) b'\x55\xff\x00\x51\xae\x02\xfd\x53\xac' >>> r.snd(2) >>> print(r.LastCmdSerStr) b'\x55\xff\x00\x59\xa6\x02\xfd\x5b\xa4' Quote
AJB2K3 Posted February 19 Posted February 19 3 hours ago, Bliss said: I updated LegoRcx.py in the Dropbox link. I just added the LastCmdSerStr that you can use to print the last Serial Command String. Example: >>> from legorcx import RCX >>> r=RCX("COM17") >>> r.snd(2) >>> print(r.LastCmdSerStr) b'\x55\xff\x00\x51\xae\x02\xfd\x53\xac' >>> r.snd(2) >>> print(r.LastCmdSerStr) b'\x55\xff\x00\x59\xa6\x02\xfd\x5b\xa4' Thanks bud. Quote
AJB2K3 Posted February 19 Posted February 19 (edited) Yes my checksum and complimentary bit calculations are wrong, I used 256 for 0xFF when it should have been 255! EDIT: Yes, once I use the correct number, it works. Here is the normal (1st and 3rd) and flipped (2nd and 4th) ser.write(b'\x55\xFF\x00\x59\xA6\x01\xFE\x5A\xA5') ser.write(b'\x55\xFF\x00\x51\xAE\x01\xFE\x52\xAD') ser.write(b'\x55\xFF\x00\x59\xA6\x02\xFD\x5B\xA4') ser.write(b'\x55\xFF\x00\x51\xAE\x02\xFD\x53\xAC') Edited February 19 by AJB2K3 Quote
Toastie Posted February 19 Posted February 19 8 hours ago, AJB2K3 said: EDIT: Yes, once I use the correct number, it works. Congratulations! And this is also owing to @BrickTronic! I looked up one's and two's complement on the webs - it still is sooo confusing to me. All websites I found talk about signed bytes/integers. There is even a one's complement calculator website ^^, which works perfectly well, but only in the range 0 to 127 - and of course -128 to 0. There is no -128 on the RCX ...well it depends of course on the universe. On the RCX it is 0-255. In the signed world, where such complements make total sense, it is the same range, but expressed as -128 to 127 ... On the RCX it is simply 255 - x. Which flips all bits. In the signed world, 128 is impossible. But the RCX lives in the unsigned world ... Well. Just cool you got it to work!!!! All the best Thorsten Quote
AJB2K3 Posted February 20 Posted February 20 Indeed created a table from 00 to FF and realised you can work out the sums and complimentary bytes by just moving around the chart Quote
AJB2K3 Posted February 21 Posted February 21 @Bliss I'm not sure if its just me or your code but when I run from legorcx import RCX r=RCX("COM1") r.mot(r.A).pow(6) r.mot(r.A).on() print(r.LastCmdSerStr) I get the output byte string b'\x55\xff\x00\x10\xef\x10\xef' but If I try this string in a serial write import serial #ser.write(b'\x55\xff\x00\x10\xef\x10\xef') Nothing happens. Quote
Bliss Posted February 21 Author Posted February 21 @AJB2K3, indeed, something in my code, l'll try to fix and let you know... Thanks for the report. Quote
AJB2K3 Posted February 21 Posted February 21 3 minutes ago, Bliss said: @AJB2K3, indeed, something in my code, l'll try to fix and let you know... Thanks for the report. Glad it wasn't just me. Thanks. I have mentioned you and your project in my book. Quote
Bliss Posted February 21 Author Posted February 21 @AJB2K3, I fixed the legorcx.py in the dropbox and updated the readme as well. Now you can just issue the command r.LastCmdSerStr. No need to use print(). Example: >>> r.mot(r.A).pow(6) >>> r.LastCmdSerStr() b'\x55\xff\x00\x13\xec\x01\xfe\x02\xfd\x06\xf9\x1c\xe3' >>> r.snd(2) >>> r.LastCmdSerStr() b'\x55\xff\x00\x51\xae\x02\xfd\x53\xac' >>> r.mot(r.A).on() >>> r.LastCmdSerStr() b'\x55\xff\x00\x21\xde\x81\x7e\xa2\x5d' >>> r.mot(r.A).off() >>> r.LastCmdSerStr() b'\x55\xff\x00\x29\xd6\x41\xbe\x6a\x95' Quote
AJB2K3 Posted February 22 Posted February 22 Ok, I forgot to import time. Once I imported time. the byte codes started working. Quote
Gunners TekZone Posted February 22 Posted February 22 13 hours ago, AJB2K3 said: in my book. Book? WIP I am guessing. Where would one eventually find this? Quote
AJB2K3 Posted February 22 Posted February 22 2 hours ago, Gunners TekZone said: Book? WIP I am guessing. Where would one eventually find this? Very WIP and don't know yet, still early. Quote
AJB2K3 Posted March 1 Posted March 1 A little bit of progress on my IDE. Thanks to @Bliss for his work with his RCX lib Quote
AJB2K3 Posted Tuesday at 07:34 PM Posted Tuesday at 07:34 PM I now have the Interface B and the RCX working from the IDE. Quote
Toastie Posted Tuesday at 09:41 PM Posted Tuesday at 09:41 PM 1 hour ago, AJB2K3 said: I now have the Interface B and the RCX working from the IDE. That is >really< cool!!! Now, I personally (it is just me!) would like to get this into the clear. Your IDE, as a main goal, is designed to >control< the various LEGO PBricks and interfaces from, well, the IDE, right? Or do you also want to universally program the PBricks and interfaces? Interfaces would be A and B, right? PBricks would be CodePilot, MicroScout, Cybermaster, RCX, Scout, correct? NXT and EV3, as well as Spike/PUp are more or less up to date or do you want to include these as well? The interfaces are essentially stationary and act as remotely controlled devices, in addition delivering input data, whereas the PBricks are designed to operate autonomously = run programs to respond to sensor data on their own. In other words: Your IDE is designed to do two principal things: a) run programs on the interface controlling device and b) provide means of downloading programs to the different PBrick targets. Is this the goal? Very interesting project!!! All the best Thorsten Quote
Bliss Posted Tuesday at 10:02 PM Author Posted Tuesday at 10:02 PM @AJB2K3, I tried to run you project (Python3 main.py and have encountered many problems like having all the dependencies installed like PyQt6-WebEngine etc. So now I have a window that appears but I don't have the white area and grey menu bar on the left as in your screen caps. On the right, I do have the Interface and port scanning etc but this does not work and sometime, when I click the combo box, which I guess should present a list of com ports, shows a white area that grows infinitely. But it does not show any ports. Am I missing something? I'm on Windows 11. Thanks Quote
RenLUG - Central Florida Posted Tuesday at 10:29 PM Posted Tuesday at 10:29 PM Oh, this is great. I still have the rcx I won in a robotics competition as a kid. Haven't touched it in years, would be nice to be able to do something with it. Quote
AJB2K3 Posted Wednesday at 07:26 AM Posted Wednesday at 07:26 AM (edited) 9 hours ago, Toastie said: That is >really< cool!!! Now, I personally (it is just me!) would like to get this into the clear. Your IDE, as a main goal, is designed to >control< the various LEGO PBricks and interfaces from, well, the IDE, right? Or do you also want to universally program the PBricks and interfaces? Interfaces would be A and B, right? PBricks would be CodePilot, MicroScout, Cybermaster, RCX, Scout, correct? NXT and EV3, as well as Spike/PUp are more or less up to date or do you want to include these as well? The interfaces are essentially stationary and act as remotely controlled devices, in addition delivering input data, whereas the PBricks are designed to operate autonomously = run programs to respond to sensor data on their own. In other words: Your IDE is designed to do two principal things: a) run programs on the interface controlling device and b) provide means of downloading programs to the different PBrick targets. Is this the goal? Very interesting project!!! All the best Thorsten @Toastie At the moment its just to "remote control" all devices like in a GBC but would like to add the ability to download programs. I need to sort out some of the sensor port blocks and then move on to Cybermaster and Wedo1.0. @Bliss Did you just download the main.py file or did you download all the files? Download the Archive.zip folder and extract into a folder called hello-uli. Beyond that I don't have win11 to test. There is an installer file but its only for linux that's sorts out those issues including the creation of VM. @RenLUG - Central Florida Thank you Edited Wednesday at 07:28 AM by AJB2K3 Quote
Bliss Posted Wednesday at 02:01 PM Author Posted Wednesday at 02:01 PM (edited) 6 hours ago, AJB2K3 said: @Bliss Did you just download the main.py file or did you download all the files? Download the Archive.zip folder and extract into a folder called hello-uli. Beyond that I don't have win11 to test. There is an installer file but its only for linux that's sorts out those issues including the creation of VM. In your github, I clicked on <> Code and selected Download Zip which downloaded a file named ULI.ZIP which contains all you MAIN project folders and files even some zip files like uli.zip and archives.zip which I do not need... So this does not work in windows 11 latest python 3.14. But I guess the idea will be to access you IDE from the Web eventually? I tried to open the index.html into a browser (Chrome) and the IDE appears too but the IFACE_1 always shows "Scanning..." and the combo box has nothing inside. Actually there should be a "Connect" button that opens the webserial popup to select a com port... Edited Wednesday at 02:07 PM by Bliss Quote
AJB2K3 Posted Wednesday at 04:33 PM Posted Wednesday at 04:33 PM 2 hours ago, Bliss said: In your github, I clicked on <> Code and selected Download Zip which downloaded a file named ULI.ZIP which contains all you MAIN project folders and files even some zip files like uli.zip and archives.zip which I do not need... So this does not work in windows 11 latest python 3.14. But I guess the idea will be to access you IDE from the Web eventually? I tried to open the index.html into a browser (Chrome) and the IDE appears too but the IFACE_1 always shows "Scanning..." and the combo box has nothing inside. Actually there should be a "Connect" button that opens the webserial popup to select a com port... No, there should NOT be a connect and it causes connection issues. The only time a connection is activated is when the code is running. No, not web based as WEBUSB causes way to many problems. It should need Python 3.14, QT6, Pyserial, Node.js Do you get any messages in the command line console that should be running OS of the app? Quote
Bliss Posted Wednesday at 05:26 PM Author Posted Wednesday at 05:26 PM (edited) @AJB2K3, I think I got all requirements alright Python 3.14, QT6, pySerial, Node.js. In the Command Windows that I run as an Admin, after I lunch the Python3 main.py, I get the following message: js: Uncaught ReferenceError: QWebChannel is not defined. In the Index.html, you have: <script src="javascript/qwebchannel.js"></script> <script src="javascript/blockly_compressed.js"></script> <script src="javascript/blocks_compressed.js"></script> <script src="javascript/python_compressed.js"></script> <script src="javascript/en.js"></script> <script src="blocks/blocks.js"></script> <script src="blocks/generator.js"></script> <script src="javascript/app.js"></script> but qwebchannl.js, en.js are not in the javascript folder. blocks folder does not exist in your project on github. However I can see these missing blocks folder is in the ULI.zip that is present in you main github project. I don't think it is the proper way to use github as the main code project should be the one up to date... But I can't find the location of en.js and qwebchannel.js... Archive.zip seems to have all needed files though? Edited Wednesday at 06:01 PM by Bliss Quote
AJB2K3 Posted Wednesday at 06:04 PM Posted Wednesday at 06:04 PM 34 minutes ago, Bliss said: @AJB2K3, I think I got all requirements alright Python 3.14, QT6, pySerial, Node.js. In the Command Windows that I run as an Admin, after I lunch the Python3 main.py, I get the following message: js: Uncaught ReferenceError: QWebChannel is not defined. In the Index.html, you have: <script src="javascript/qwebchannel.js"></script> <script src="javascript/blockly_compressed.js"></script> <script src="javascript/blocks_compressed.js"></script> <script src="javascript/python_compressed.js"></script> <script src="javascript/en.js"></script> <script src="blocks/blocks.js"></script> <script src="blocks/generator.js"></script> <script src="javascript/app.js"></script> but qwebchannl.js, en.js are not in the javascript folder. blocks folder does not exist in your project on github. However I can see these missing blocks folder is in the ULI.zip that is present in you main github project. I don't think it is the proper way to use github as the main code project should be the one up to date... But I can't find the location of en.js and qwebchannel.js... That would be my fault for not checking that I uploaded them, sorry. Just uploaded them now. As we discussed earlier, we are both not very fluent with Github. I have a folder on my computer for local testing and when I get a stable version then I copy to GitHub. Quote
Bliss Posted Wednesday at 06:46 PM Author Posted Wednesday at 06:46 PM It starts better now, I can see the white area in the IDE and the Grey Bar on the Left side but when I click on an item on the left bar, like INTERFACE_B or SIMPLE RCX etc, I get errors in the cmd window: When I click on INTERFACE_B: js: Blockly.Workspace.getAllVariables was deprecated in v12 and will be deleted in v13. Use Blockly.Workspace.getVariableMap().getAllVariables instead. js: Uncaught TypeError: Invalid block definition for type: interface_b_init when I clicked in the white area: js: Uncaught Error: FocusManager state changes cannot happen in a tree/node focus/blur callback. When I clicked on SIMPLE RCX: js: Uncaught TypeError: Invalid block definition for type: rcx_init Clicked on PYSERIAL: js: Uncaught TypeError: Invalid block definition for type: serial_close Clicked on LOOP: js: Uncaught TypeError: Invalid block definition for type: wait_seconds Clicked on LOGIC and MATH, TEXT, VARIABLES does not give errors and I can wee some blocks on the right... But eventually, after I clicked many times on the ones that gives error I get no matter on what I click: js: Uncaught Error: Block not present in workspace's list of top-most blocks. Quote
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.