Cosmik42 Posted January 13, 2019 Author Posted January 13, 2019 And here it is! V0.4 is out - 01/14/19 Major update includes: - SBrick support - Global code editor You can download the latest build (V0.4) here: https://www.dropbox.com/sh/t4pf1758ewenid6/AABye7-Fnb4QPwvuyuPZm06ma?dl=1 Quote
Lok24 Posted January 14, 2019 Posted January 14, 2019 Hi Cosmik42, just started and wanted to let you know that it is - amazing? Here's a litlle video (22sec) Quote
Cosmik42 Posted January 14, 2019 Author Posted January 14, 2019 (edited) 56 minutes ago, Lok24 said: Hi Cosmik42, just started and wanted to let you know that it is - amazing? Here's a litlle video (22sec) Very cool! Actually I am very likely to drop the 'train' word in 'The Lego train Project' for the word 'automation', because this little project is much wider than that at this point. You have no idea how awesome it is to see this video after so many hours of coding :) Edited January 14, 2019 by Cosmik42 Quote
Toastie Posted January 14, 2019 Posted January 14, 2019 31 minutes ago, Cosmik42 said: Very cool! Actually I am very likely to drop the 'train' word because this little project is much wider than that at this point. @Cosmik42 This is really cool. Yes, I believe that this project is far beyond "Trains". You should go and post in the "LEGO Mindstorms and Robotics" forum. They are going crazy on programming there. You may get even more input for your wonderful work. What I believe should come eventually for the "Train" theme is an UI that is leaned towards the train theme. This could include "tiling" your actual track layout as for example the very nice 4DBrix nControl Software is doing. E.g. clicking on a tile within the layout representing a switch point, which then actually graphically shows the switch direction is more intuitive than slider controls and/or buttons. However that is a rather extensive programming business as you need to keep track of what element is doing what kind of work (switch drive, street lights, train) etc. Here is my UI you know already - and which shows the ancient VB6 design elements of 2003. Well - has grown over the years as my LEGO brick collection has as well. But as of now I believe you are developing solid communication software first and you may then migrate into making it train layout friendly. If at all. What you have achieved so far for all LEGO fans running the new generation remote control/programming hardware. All the best, Thorsten Quote
Cosmik42 Posted January 14, 2019 Author Posted January 14, 2019 (edited) 3 hours ago, Toastie said: This could include "tiling" your actual track layout as for example the very nice 4DBrix nControl Software is doing. E.g. clicking on a tile within the layout representing a switch point, which then actually graphically shows the switch direction is more intuitive than slider controls and/or buttons. This is my dream! Especially as I am working on a generic anti-collision system for trains, so having a map editor would put it even more to life. But being an ex-video-game programmer, I know that this kind of editor can eat a lot of time to make ... Edited January 14, 2019 by Cosmik42 Quote
Toastie Posted January 14, 2019 Posted January 14, 2019 1 minute ago, Cosmik42 said: This is my dream! Well, as far as I believe, there is nothing more powerful than dreams in this world. Dreams can overcome any borders, challenges, and surely any time constraints. So dream on (I do it myself). It gives life a "meaning". All the best, Thorsten Quote
Lok24 Posted January 15, 2019 Posted January 15, 2019 (edited) Hi, just a little bit testing, but I'm totally lost in C# - made some code snippet like "MainBoard.WriteLine(DateTime.Now.ToString("h:mm:ss tt"));" If I use a sensor-event (color) to execute it is always executed twice? And how to choose the other colors? And third problem: How to call "MyGlobalFunction" in such an event? No Idea for the syntax Sorry for having so many questions... Edited January 15, 2019 by Lok24 Quote
Cosmik42 Posted January 15, 2019 Author Posted January 15, 2019 5 hours ago, Lok24 said: If I use a sensor-event (color) to execute it is always executed twice? It should not. How do you display the time when it's not through a trigger? It is possible this code triggered at the same time as the event itself? 5 hours ago, Lok24 said: And how to choose the other colors? After many test putting a color detector under a train, only these 3 colors were reliably discovered. But given the video you show, you would be able to discover all other color when not using it in a train scenario. 5 hours ago, Lok24 said: How to call "MyGlobalFunction" Simply write MyGlobalFunction(); Quote
Unfinished_Projects Posted January 15, 2019 Posted January 15, 2019 First of all, amazing work and thank you for sharing! I was trying it out last night with my powered up equipped horizon express, and it works great! I have one question, what does "Exception while connecting Object reference not set to an instant of an object." mean? It keeps popping up, but doesn't seem to affect anything. Thanks in advance, Unfinished_Projects Quote
Lok24 Posted January 15, 2019 Posted January 15, 2019 (edited) 29 minutes ago, Cosmik42 said: It should not. How do you display the time when it's not through a trigger? It is possible this code triggered at the same time as the event itself? I have a red plate of app. 15cm length on the track, here's an example, as you see the message "Action triggered" appers only once, the "Writeline" twice: 29 minutes ago, Cosmik42 said: After many test putting a color detector under a train, only these 3 colors were reliably discovered. But given the video you show, you would be able to discover all other color when not using it in a train scenario. I can only select these three colors in the drop-down field? 29 minutes ago, Cosmik42 said: Simply write MyGlobalFunction(); That was my idea! But: And here's the translation: Compiling code ...Compiling failed.Error (CS0120): An object reference is required for the non-static field, method, or LegoTrainProject.DynamicCode.MyGlobalFunction () property.Error (CS1998): This async method lacks the 'await' operators, so it runs synchronously. You should consider using the await operator or await Task.Run (...) to wait for non-blocking API calls or perform CPU-bound tasks on a background thread. Edited January 15, 2019 by Lok24 Quote
Lok24 Posted January 15, 2019 Posted January 15, 2019 (edited) And here's your project used for a shuttle train, please note the smooth acceleration.... https://youtu.be/RWmmEqOEAD0 Edited January 15, 2019 by Lok24 Quote
supertruper1988 Posted January 15, 2019 Posted January 15, 2019 From an automation standpoint, could a sensor be placed under the track point up and then each train is color coded underneath? This would allow for say, a station where you could have a main line and then trains are "sorted" into tracks for loading. Quote
Cosmik42 Posted January 16, 2019 Author Posted January 16, 2019 14 hours ago, Unfinished_Projects said: I have one question, what does "Exception while connecting Object reference not set to an instant of an object." mean? It keeps popping up, but doesn't seem to affect anything. Thank you for the kind words and happy to read the software works for you! This error means that at some point the program tried to access an object that wasn't initialized. Can you give me more context as of when this pops up? Finally, thank you for the donation! Quote
Cosmik42 Posted January 16, 2019 Author Posted January 16, 2019 14 hours ago, Lok24 said: I have a red plate of app. 15cm length on the track, here's an example, as you see the message "Action triggered" appers only once, the "Writeline" twice: Oh my!! Indeed, it was my bad. A piece of code left after a debug! 14 hours ago, Lok24 said: I can only select these three colors in the drop-down field? For now yes. I will try to extend this during the weekend! 14 hours ago, Lok24 said: 14 hours ago, Cosmik42 said: Simply write MyGlobalFunction(); That was my idea! But: Ok, I have changed the declaration which was wrong. All functions made this way should be static! So in the 'Global Code' section make sure to edit it to this: public static void MyGlobalFunction() { // Execute your code here } Thank you so much for the throughful testing! I will drop a new later today that fixes all these issues! 14 hours ago, Lok24 said: And here's your project used for a shuttle train, please note the smooth acceleration.... https://youtu.be/RWmmEqOEAD0 This is beautiful! <3 11 hours ago, supertruper1988 said: From an automation standpoint, could a sensor be placed under the track point up and then each train is color coded underneath? This would allow for say, a station where you could have a main line and then trains are "sorted" into tracks for loading. @supertruper1988, absolutely! Quote
Lok24 Posted January 16, 2019 Posted January 16, 2019 (edited) Thanks for the moment, i'll tried that withe the "static" (think i did that already yesterday, and it worked, stay tuned) The debug-Mode: sounds familiar to me Can you imagine what happens if you have different RampMotor commands, which are executed twice parallel? Funny! Donation is difficult, cause I got no PayPal.... Edited January 16, 2019 by Lok24 Quote
Cosmik42 Posted January 16, 2019 Author Posted January 16, 2019 Just now, Lok24 said: Donation is difficult, cause I got no PayPal.... Do not worry! Your videos are fullfiling to watch :) Quote
Lok24 Posted January 16, 2019 Posted January 16, 2019 11 hours ago, supertruper1988 said: From an automation standpoint, could a sensor be placed under the track point up and then each train is color coded underneath? This would allow for say, a station where you could have a main line and then trains are "sorted" into tracks for loading. Hi, yes, sure, it's another appraoch. Needs all tracks to be buld in a certain height, of course. But for a station you could perhaps use only sensor half a meter before the first switch! Quote
Bartosz Posted January 16, 2019 Posted January 16, 2019 15 hours ago, Lok24 said: And here's your project used for a shuttle train, please note the smooth acceleration.... https://youtu.be/RWmmEqOEAD0 Off-topic, so don't shoot, but I like the rolling stock. Any close-up photos? :) Quote
Unfinished_Projects Posted January 16, 2019 Posted January 16, 2019 6 hours ago, Cosmik42 said: This error means that at some point the program tried to access an object that wasn't initialized. Can you give me more context as of when this pops up? It pops up continuously starting right after the program is launched. Powered up hub can still be connected and controlled as normal it seems. Thanks again, Unfinished_Projects Quote
Cosmik42 Posted January 16, 2019 Author Posted January 16, 2019 1 hour ago, Unfinished_Projects said: It pops up continuously starting right after the program is launched. Powered up hub can still be connected and controlled as normal it seems. Thanks again, Unfinished_Projects Oh this was extremely useful! It looks like you have some weird bluetooth device around you. I just added an extra test to avoid this log. I will share a new version later tonight! Quote
Giottist Posted January 16, 2019 Posted January 16, 2019 Hey folks, What about the idea to support Cosmik42 by writing a tutorial for the software? Does anybody here has knowledge to set up a Wiki for instance? (or something similar ...) Quote
Lok24 Posted January 16, 2019 Posted January 16, 2019 1 hour ago, Cosmik42 said: It looks like you have some weird bluetooth device around you. Nice topic! the program gathers all LEGO(?)-BT-devices. What if the neighbour starts his LEGO-boost? What when used at an exhibition with a dozen of devices around? Idea: implementing a list of "allowed" adresses As your program doesn't use any .ini-files for the user you could set up such a list in any form in the "global" routine? Quote
XGBC Posted January 16, 2019 Posted January 16, 2019 couldnt you make it so that you manualy pair with your devices in the program? So that no other devices than yours will pair or did i missunderstand something about how the hubs work? Hope this helps XGBC Quote
Cosmik42 Posted January 16, 2019 Author Posted January 16, 2019 Really excited to share with you V0.5! Full support of SBrick Plus and PF Sensors. Introducting an Anti-Collision system that works with simple distance detectors Bug fix: Code was executed twice on sensor event Bug fix: Better handling of faulty device connection You can download the build here: https://www.dropbox.com/sh/4r7tbnbbvnevfhm/AADsny98v7uzdr0IU9mvvymqa?dl=1 Quote
Toastie Posted January 16, 2019 Posted January 16, 2019 This is what I am doing (a very, very nice software company in the US - "/n software" - granted me a personal license of their BLEClient activeX control they have developed for all major program languages - believe it or not, also for VB6 - my lifetime programming environment. VB6 was phased out by Microsoft in 2002 or so, when surpassed by dot net stuff. Well not for me though … have instead migrated my VB6SP6 from Win2000 to XP to Win7 to Win10/64bit). And believe it or not that BLEClient connects to all LEGO BLE devices like a charm - so I can continue my 14 years development of a TrainControl program … I am so grateful for that! And this is what I am doing: Instead of scanning for devices I am directly connecting to the unique device address of each BLE server. You can find out that address in multiple ways - in Win10, when you scan for new devices in the corresponding system section, you can fetch that address easily - or you may use the Bluetooth LE Lab or Bluetooth LE explorer. Best regards, Thorsten 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.