Asked — Edited
Resolved Resolved by DJ Sures!

Different Pages In Blockly

I'd like to request to have multiple pages in Blockly, this way I can keep things nice and organized. Also on each page could we have it basically full page so I don't have to zoom in and out constantly. The selections of create new variable, camera etc could all be located in in small squares that could be pulled up as needed. When you running multiple bots with different conversations it just plain takes a lot of room. At the end of each page it could ask would you like this to connect to page (2 or 3 etc) and then you link them all together or have multiple things happening at once.

It sure would have been nice to have this and then just continue onto the next page. Very limiting as is. As I'm build more complex robots need more room in Blockly to handle all of the programming. Does it not make sense to be able to add more pages in Blockly as you would with other programming languages?


Related Hardware EZ-B v4
Related Control Stepper Servo

ARC Pro

Upgrade to ARC Pro

Stay at the forefront of robot programming innovation with ARC Pro, ensuring your robot is always equipped with the latest advancements.

PRO
Belgium
#1   — Edited

hi automation man

i think you can use multiple scripts with Blockly , script-1 or 2 or 3 an so on . you just give them a name or number . i think you need the file manager .

User-inserted image

#2  

I appreciate the help but I already do make multiple separate files with Blockly, which is not the same as having one very long program. It would be nice to have it go to next page after say 50 lines per page rather than scrolling in and out at 350th line on the page.

#3  

Oh, I see. You want to be able to make one long script (not several) and not have to zoom or scroll. You want to have the one long script go page to page like a book?

I may be wrong but I think Blockly is not a development or creation of Synthiam. I think it's a stand alone program provided by another company and Synthiam has the rights to use it. If so Synthiam may not have the ability to change or improve it.

Again, I may be wrong here but I see on the web that Blockly is a project developed by Google.

#4  

I appreciate your input Dave, from what I've seen there is not much that DJ can't do, just a matter of time and interest of doing it. He has already made many quality changes to it along the way. It would be very helpful though. My recent robot picked up 100lbs with its 6 ft arm extended-can do more if I needed it to. The precision and repeatability is way up there too. My 8 yr old grandson had an hour before his soccer game so I showed him how to program it to pick up a tape measure from one location to put it in another location. Having fun with it.

PRO
Synthiam
#5  

Unfortunately, Dave is correct on how much Blockly can be altered - as there's no way to create what you're requesting. Additionally, several logical issues exist regarding how a "multi-page blockly" couldn't work. Specifically, there's no way to guess the direction of execution or how the bits of code between pages would be organized and converted into actual code. The creation of variables is incapable of being a specific global assignment. This is because variables are defined as needed or created as a group at a place where you initialize their values.

Nomad's suggestion of multiple Blockly scripts is how traditional programming is structured for a reason. In short, there's a reason why programming environments are designed the way they are because your use case is not everyone else use case.

I can empathize with your struggle to organize large amounts of code - and I will put some effort into a creative solution that can help you - but it won't be immediate.

I hope that helps with your concern - but I'm sure I can develop some solutions to help with your project over time. In the meantime, continue providing feedback because that will help inspire some ideas.

#6  

DJ,  I appreciate your help and explaining it as I now understand the reasoning behind it all. The multiple pages is not a necessity but a larger screen to work on may be an option. Here is a suggestion, similar to when your programming in other languages you can have the full screen available so that it is easy to scroll down. Looking at the screen while in Blockly there is only ably 40% of the screen to work on. If it were possible to have only what is necessary when programming in Blockly (blocks) and a way to get back to the typical screen. All of the other icons could be made into smaller icons.The camera eats up a large part of the screen and is not really necessary because you could get back to the typical screen, or maybe you tap on the icons to expand them as needed. I can envision a 90% screen available with the other icons taking up the other 10%

#7   — Edited

User-inserted image User-inserted image I have figured out a way to break things up into smaller scripts and reorganize them as needed so I guess having larger Blockly screen is not needed. The robot is now easily capable of getting me a beer (joking with my wife that is the minimum requirement) and doing many other things. It's running smooth as silk between locations, although I have some holes in my Sheetrock as warwounds along the way One item that would help is ControlCommand(Stepper Servo", "Set as Home", "V21"): which I know is in Javascript which is fine. I plan on using the Block ControlCommand block (which is written in Javascript) to zero out each axis. It states that the string is not formatted correctly, seems like it is right to me. Can you explain the proper formatting to zero out V21. Thanks

PRO
Synthiam
#8  

Haha, a robot joking with your wife is definitely a high priority! Certain ControlCommands are unavailable in Blockly because they are 3rd party robot skills or have complex syntax. Blockly has some limitations, making it a great learning tool, but unfortunately, it is not a replacement for syntax programming when it comes to complex syntax. I've been aware of that limitation for some time, and maybe I'll be able to come up with a solution. In the meantime, you can create several smaller scripts as "Functions" in javascript scripts and launch those from blockly.

#9  

Ok I understand on how Blockly is limited but how would you write it if using Javascript. In the above picture it shows a button that can be pushed on the desktop and the underlying code is in Javascript. Being able to push a button to zero it (position 1) even would help. If this is not possible I will move on the next scenario with relays wheres it whenever it loses power and re powers up it goes to 1 but trying to do it in code first. Seems like somehow it would be able to clear itself with code.

PRO
Synthiam
#10  

I created a new Blockly block that accepts raw javascript. It'll be in the next release...

User-inserted image

I'm not quite sure if i understand your last response. Are you asking how to have an initialization script when the robot connects to move a servo to a position? You can do that in this document, which explains how to create an initialize script: https://synthiam.com/Support/Tips-to-Make-a-Robot/initialize-servos

If you're asking about "how to have a button do something", then you can create a custom interface using Interface Builder with a button. The button can execute any code that you add to it: https://synthiam.com/Support/Skills/Remote-Control/Interface-Builder?id=16063

#11  

I really like and appreciate how you can make these additions on the fly and that one is going to come in handy. I primarily work with the Stepper servo skill and in there it mentions how you can zero it (position 1) with a script, ok how do you write the script for V21 to be zeroed.   Currently there is a ControlCommand block in Utility which I think is essentially very similar to the block you just made. While inside the ControlCommand block you switch the type of code to Javascript to handle the proper syntax needed. This is what I thought was close but it doesn't work     ControlCommand("Stepper Servo", "Set as Home", "V21"):

#12  

There is a big difference between making a button and pushing make it go to location 1 and having a button to zero it. The difference in the first scenario is you may be at location 1252 and if you push the button it will go towards location 1 (and may hit some things along the way), wheres a zeroing button may be at position 1252 if you push the button it the internal counter actually resets to location 1 and the exterior position on the screen goes to 1 so there is no movement at all. This comes in handy when you are doing your own controlled homing (one axis at a time) with infrared switches etc.

#13  

I understand that DJ said you can add a button to a custom interface with code to set the current position as home. You can put any code behind the button to be executed. In your requested example, the javascript code would be...


ControlCommand("Stepper Servo", "SetAsHome", "ID");

You can replace the ID with the stepper servo ID. For example,


ControlCommand("Stepper Servo", "SetAsHome", v21);

The code you are pasting for SetAsHome is incorrect because it has spaces where the correct command does not. You can find control commands by right-clicking in the javascript editor or viewing the cheat sheet. Here are two examples pasted...

PS, for further reading, these examples are documented on the ControlCommand() manual page here: https://synthiam.com/Support/Programming/control-command

  1. In this case, the editor has been right-clicked with the mouse, and the popup of ControlCommands is visible. I navigated to the stepper servo robot skill to view the supported ControlCommand() list. User-inserted image

  2. In this example, I'm using the Cheat Sheet and navigated to the Stepper servo to view the supported ControlCommand() list. User-inserted image

Lastly, I was having difficulty following this thread because the topic changed, and there were 30 robot skills selected. Please select only the robot skills regarding this question; otherwise, it is time-consuming for us to filter through to understand and answer promptly. Thanks for understanding!

#14  

Thank you, I think you solved it. That is all that was asking -how to set as home a certain Virtual ID. This is all very obvious to you but the "  " is misleading to me as you actually take them out of there on the ID but leave them on the other parameters.

PRO
Synthiam
#15   — Edited

Ah, that's a good observation to that response. The "V21" can be in quotes or not. That's because it is a constant, and constants do not require quotes (although you can use them if you prefer). For example, D3 is a constant that actually contains the integer value 3.

That's because D0 is actually a 0 for port 0. etc... But V0 is actually a value of 24 because it's port 24. This is somewhat documented in the javascript manual under the Constants section here: https://synthiam.com/Support/javascript-api/javascript-overview

You can put the V21 in quotes or not. It won't matter because the value will be used no matter what. But for strings, they must ALWAYS be in quotes. A constant is a variable that contains a value, so in this case, they have their own quotes.

#16  

Those couple posts were very helpful and I fixed Setashome andUser-inserted image

tried it with quotes and without, but it only goes through without. I thought that it worked but when I looked at the location, it was still at 1000 and did not make it the one position.  I made a quick program to keep the variables current, but it did not change.User-inserted imageUser-inserted image

User-inserted image

#17  

I tried it again this morning and maybe it just doesn’t workUser-inserted image Maybe you can just try it on your end and verify that it does work. I did also zero it this morning by using relays and resetting the location to one.

#18   — Edited

Your picture shows the error message which still has set as home with spaces. If you correct the ControlCommand() syntax, it will work for you.

User-inserted image

#19  

I thought I fixed it all yesterday afternoon and it still did not work but I will try it again later tonight

#20  

User-inserted imageUser-inserted image as much as I would really like to say that I got it to work still could not get it I cleared it out and right clicked to pull up Cheat Sheet of script and then typed in V1 for the set as home and the calibrate script, but still could not get it to work  User-inserted image

#21   — Edited

I'm not a Javascript expert at all and have done limited work in it but I'm still seeing a couple spaces in your code. Between the comma and the quote marks on both the SetAtHome and V1. Could this be the problem? I really don't know if that's allowed in Javascript. The Cheat Sheet example in an above post shows no spaces at all in the sentence. Customer support said take out the spaces.

#22  

Appreciate the try Dave and I have just tried taking out the space after the comma and before V21 but it still just does not work. StepperServo skill is great but it is a whole different animal and has nuances that take a while to get used to.

PRO
Synthiam
#23  

A little feedback on what " quotes " means in programming...

Spaces in quotes matter. Spaces outside of quotes don't matter. Think of the word "Quote" as an actual quote of a person speaking. If someone said, "I am wearing a hat,". But you quoted them by saying (in quotes) "I am wearing a banana", then that's not a quote. A quote is a literal thing that should not be changed. You can't change that quote if someone was "quoted" as saying something.

So, if the command is "SetAsHome", but you send "Set As Home" (with spaces), then that's not the same thing. The quoted order is "SetAsHome" without spaces. This is just some information to understand better how programming works with computers. I didn't invent it, so don't shoot the messenger :). Until computers can be programmed by telling them with any localized social language, we're stuck with programming languages.

Now, back to why "SetAsHome" is not working...

Your screenshot shows that you're attempting to set the value 1000 as Home, which would become the new 1 (zero). Home is position 1. So that means if you are in position 1000 and execute "SetAsHome," that will become the new position 1. So if you move to position 1000 again, it will move waaaaaaaaaaaaaaaaaay past position 1 to the new relative 1000 position.

#24   — Edited

Ok so it actually is working! The thing that was throwing me off is that it is not changing the value on the screen. Behind the scenes it is actually changing the value to 1, got it. I will be incorporating sensor switches which will trigger this SetAsHome in a coordinated scenario one axis after another. Is there a library in Synthiam that explains how each ControlCommand works just like you explained it? This is going to open up a whole new world. Thanks! If you'll notice that is V21 and I think I'm up to V28 so far. I have had about 20 Nema 34 motors working in harmony at one time, it's pretty cool.

#25  

Robot skills may provide control commands. If one does, they will be documented in the respective manual. To discover what control commands are available for a robot skill, this was explained to you in an earlier post.

If a manual is missing an explanation of a command, you may ask in that topic. Please ask questions in the relative topic to maintain organization and help train Athena.