Asked
Resolved Resolved by DJ Sures!

How To Store A Variable In Blockly

In conversation menu I'm trying to get the person to answer yes or no, and that would go into a variable. After it is in variable if it is equal to yes then make another variable = 150  but for some reason it is not working. Having it match a word rather than true or false would make it a more natural conversation. What is the proper way to do this in blockly? It works great when it is a numerical variable. Also is there a way to have jump down to option 4 if you didn't want to go through 1,2,3?


ARC Pro

Upgrade to ARC Pro

ARC Pro is your gateway to a community of like-minded robot enthusiasts and professionals, all united by a passion for advanced robot programming.

PRO
USA
#2   — Edited

tried out your storing Variable in Blockly, works well

User-inserted image

Also, I enjoyed the Blockly code to take a picture

Add Camera, script (take Picture), soudboard, if you like

Make script:

User-inserted image

Pictures are stored on your computer, my robot pictures

these are global variables

User-inserted image

#3  

Yes this is what I had, will start from scratch and redo it Probably had something to with the global/local variables. Some of the variables were not showing up in variables.  I liked learning about the local and global variables. My variable tracker was not changing. Thanks for the help!

#4  

For some reason I'm still having an issue. Here is the screen shot. It always says Zero from the PC.  These are all global variables and would think it would be fine.

User-inserted image

PRO
Synthiam
#5   — Edited

Here's the manual for the WaitForSpeech command: https://synthiam.com/Support/javascript-api/Audio/waitForSpeech

It says the response is in lowercase.

I would also recommend adding an "else" condition to the IF so that you can handle anything unexpected. It's always good practice to have an ELSE when using an IF. 99% of the time, sound logic practice is to provide an ELSE. In the case above, if the WaitForSpeech times out, then a "timeout" would be returned, but it is not being handled in your condition.

Lastly, the Say PC Wait is good, but I recommend using the string append to combine the "I will be moving the base to" and $base_rotate rather than having two "wait" commands. It's just a bit cleaner. Here's an example screenshot...

User-inserted image

#6   — Edited

Lots of good advice and will implement them all.

Got it working and it's great- It was the uppercase that got me. The pc talking is cleaner now and the else is a catch all which was needed.

Thanks, Don

#7   — Edited

For the next step I think it may need a modification of the Auto Position to be a variable. Once you have selected locations for pickup and final destinations you will want to move that into a variable on the Auto Position so you can select multiple locations and actions as needed. You may have already figured out a way around this though. This seems like a simple but very powerful tool to have. Rather than picking a certain number to put into a variable you would be picking an action and thus picking multiple movements and locations that are done in the movement panel.

PRO
Synthiam
#8   — Edited

Id need more clarification to assist.

  1. Are you asking to programmatically define positions to an existing frame that exists in an action?

  2. or, programmatically create a new frame and add it to a new action, where all other frames are added programmatically as well.

  3. or, programmatically create a new frame and append it to an existing action that already contains frames.

  4. or, execute an existing action that had already been defined with predefined frames?

lastly, how many positions for the start and end of the Auto Position are there?