Hi Vention community!
Here’s a tool I made to code my machine: “Vention-GPT.” To use it for your machine, click this link to talk to it yourself!
Snippet from my conversation today (some names edited for confidentiality):
Me: Here’s my MachineLogic code for my Vention robot. Write the code for me to change the movement in the “XYZ” routine to be dynamically changed on a UI. [attached .json file]
Vention-GPT: Based on the provided MachineLogic code for your Vention machine, we’ll update the “XYZ” sequence to allow dynamic control of movement via a UI. To achieve this, we need to add a user input element in the UI and modify the “XYZ” sequence to use the value from this input.
First, add a slider or input field to the UI for user input. This widget will let the user specify the distance for themoveRelative
function. Add the following code to theui
section:
"ui": {
"tabs": [
{
"name": "Group 1",
"widgets": [
{
"type": "numberInput",
"name": "distanceInput",
"label": "Movement Distance",
"defaultValue": 120,
"min": 0,
"max": 500
}
]
}
]
}
Vention-GPT: This code adds a number input field with the label “Movement Distance”. The default value is set to 120, with a range from 0 to 500. You can adjust the
min
,max
, anddefaultValue
as per your requirements.
Vention-GPT: Next, modify the “XYZ” sequence to use the value from this input. Replace the
distance
parameter in themoveRelative
instructions with a reference to the new UI element. The updated “XYZ” sequence will look like this:
"name": "XYZ",
"type": "Sequence",
"robotParameters": {
"clips": []
},
"parameters": {},
"instructions": [
{
"category": "waitFor",
"name": "amountOfTime",
"parameters": {
"milliseconds": 1000
}
},
{
"category": "motor",
"name": "home",
"parameters": {
"axis": "129a9s8d9b-saeg23-a3-12t"
}
},
{
"category": "motor",
"name": "home",
"parameters": {
"axis": "swa34nw-34-w43hjw35-33we"
}
},
{
"category": "waitFor",
"name": "amountOfTime",
"parameters": {
"milliseconds": 1000
}
},
{
"category": "motor",
"name": "moveRelative",
"parameters": {
"axis": "alwjeo-23n-3234b43-23t",
"distance": "${distanceInput}"
}
},
{
"category": "motor",
"name": "moveRelative",
"parameters": {
"axis": "q34nan-zsdrtwe-4676789-se",
"distance": "${distanceInput}"
}
}
]
Vention-GPT: In this updated sequence, the
distance
parameter in themoveRelative
instructions now references thedistanceInput
value from the UI. Whenever the user changes this value, it will directly affect the distance the motors move in the “XYZ” sequence.
In less than 15 minutes, I was able to troubleshoot Vention-GPT’s code and get it running, adding a new UI element to my Vention machine. After extensive testing with some sample products, I added it to the machine’s stable code
Enjoy!