Vention-GPT helps me code my robot

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 the moveRelative function. Add the following code to the ui 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, and defaultValue as per your requirements.

Vention-GPT: Next, modify the “XYZ” sequence to use the value from this input. Replace the distance parameter in the moveRelative 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 the moveRelative instructions now references the distanceInput 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 :tada:

Enjoy!

Link to Vention-GPT

13 Likes

I think this will be a gamechanger for me when I get a chance to use machine logic. I’m not the worlds best programmer.

7 Likes

This is a great idea @jesse-li - GPTs are so powerful at coding and can be easy to train specifically by updating product documentation. Would be a great addition to have it available directly on the pendant also - that way users could type their support queries right there.

2 Likes

Perfect! I am looking forward to my next project with MachineLogic involved to use Vention-GPT. Thanks for your effort!

2 Likes