Create a Basic Robots Program
Step by Step guide to setting up a basic program in the Robots plugin for Grasshopper
Last updated
Step by Step guide to setting up a basic program in the Robots plugin for Grasshopper
Last updated
Sorry this tutorial is not finished yet!
This step by step article will guide you through making a basic robot program for the ABB IRB120 at the MSD Robotics Lab. This article assumes a basic understanding of Rhino & Grasshopper.
Please make sure you have installed Robots for Grasshopper, if you have not, please read the instructions here:
A Robot System specifies what robot we will be programming.
Begin by opening Rhino & Grasshopper, we are going to add the robot system.
Goto the Robots (1) tab in Grasshopper, select Components (2) and pick Robot System (3).
From the dropbox list (4) you may need to select UniMelb-IRB120
Right click on the Load Robot (4) and select preview to turn the preview off, as this will interfere with our simulation later.
If you cannot see UniMelb-IRB120 or the component is red, re-visit "Download & Install Robots for Grasshopper" and make sure you installed the UniMelb.3dm and UniMelb.xml files correctly.
We need to create a tool, we supply it with a name, a mesh, a TCP (Tool Centre Point), weight and centre of gravity.
Goto the Components (1) section and click Create Tool (2)
Next we need to create a physical tool in Rhino.
Create a cylinder that points up that is 20mm in diametre and 100mm high, as shown below.
Next add a panel and connect it to the N (1) of the tool component.
Also add a Point parameter, and an XY Plane (2), connect these as shown to the P.
We need to set the point to the centre of the top of the cylinder as shown in this image:
Add panels for Weight (1) and Centre of Gravity (2)
Make the weight 0.1 (this is 0.1kg) and the centre of gravity 0,0,50 (x,y,z)
Connect the Weight to W and the Centre of Gravity to C
Finally we need to create a mesh out of our geometry.
To do this, create a Brep component, a mesh component and a Mesh Join component.
Connect them together as shown.
Connect Mesh Join to the M
Set Brep to the cylinder we previously made.
We keep our geometry as surfaces and solids in case we need to change it. The mesh join is important to ensure the tool component only see's one mesh. Multiple meshes cause the plugin to generate multiple robot programs.
Place a Tool parameter after the Create Tool
Next we will create a Home Position, the Home Position will be where the robot moves to at the start and end of the program.
Goto the Robots plugin, click Components and click Create Target
Once the Target component is placed. Right click on and and select Joint Target (1)
A joint target allows us to specify 6 joint positions of the robot. This means we can get the robot to go to the exact same position every time.
Also select Speed Input (2) and Zone Input (3)
Next create a Degrees to Radians component
The Degrees to Radians component in Robots is special, and the standard Grasshopper degrees to radians component won't work. This is due to how robot manufacturers define the 0 point of their robot axes.
Connect the Robot System to the R on the Degrees to Radians component.
Create a panel (1) for the axis values. We need to make it Multiline data (2) by right clicking on it.
Enter the numbers as
The create program component is what creates the program, we are doing this now so you can generate a simulation.
Add the Create Program (1) component
Create a panel (1) for the program name. The program name should change with each new version of code you upload to the robot. Always start with a lowercase letter and avoid spaces, use underscores instead.
Connect the panel to N (2).
Connect the robot system to R (2).
Connect the targets to T1 (2).
T1 is the first robot, while T2 would be a second robot. We only have single robots at the moment.
The simulation component allows you to view how the robot acts and allows you to identify errors. It is a good idea to add this early on to catch errors early.
Add the Program Simulation component from the robots plugin.
Connect a slider (1) that goes from 0.00 to 1.00 to T (2). This will be our time simulation. 0.00 being the start and 1.00 being the end of the program.
If there is an error, 1.00 will become where the error first happens.
Connect the P from the program component to the P (2) of the simulation component.
After doing this, you should see a robot in
We will create a tool path for the Robot to follow. The easiest way to do this is to create a curve and divide it into points.
Place a Curve (1) parameter in Grasshopper
Drawing an interpolated curve with InterpCrv (2) on the ground.
Right click on the curve (1) componet and select select one curve. Then select the curve you just drew.
To divide the tool path we will use the Divide Curve component. There are a number of other ways to divide the curve. The point of dividing the curve is to get origins for planes. We then create a plane at that point.
Add the Divide Curve (1) component.
Connect the Crv parameter to the C (1) of the Divide Curve component.
Make a panel (2) and connect it to the N (1) of the Divide Curve component.
Specify the number of points you wish to divide the curve by in the panel. In this case we picked 20.
Create an XY Plane component and connect the P (1) from the Divide Curve component to the O (3) of the XY Plane.
Next we need to add a Rotate Plane (1) component. This allows us to control the rotation of the tool.
Plug a panel (2) into the A (1) of the plane rotate. Here we lave the angle as 0 to begin with.
Since Grasshopper normally works in Radians, we need to right click on the A (1) and specify degrees.