Exporting a Curve from Rhino to V-REP

Prerequisites

Instructions

Open a new design in Rhino. Create a curve somehow, and make sure it is a reasonable size relative to the UR5 robot, like 0.5 meters. For a nice curve import this Gosper curve:

Reminder: make sure this curve is reasonably sized in Rhino, because it will be imported with the same physical dimensions in V-REP. Open up Grasshopper (run the "Grasshopper" command in Rhino). Create Curve, Divide Curve, Python Script, and Panel components. Then hook them up like so:

Select your curve and set the value of the curve component to it (right click on the component and do "Set One Curve". Right click the "K" input to the Divide Curve component and set the value to true. Double click the Python Script component and paste in the Python code:

Right click the panel and set the "Stream Destination" option. This is going to be the CSV file that will be imported into V-REP, so name it something like "my_cool_curve.csv". Now right click the panel again and choose the "Stream Contents" option to actually create the CSV file containing your data.

Open up your robot scene in V-REP. Use the File > Import > Path from CSV... menu item to select the CSV file you created from Grasshopper:

Your cool curve should now be a path in V-REP! Nice work.

To have the robot follow your new path check out the V-REP path following tutorial.