Viam script for writing on a whiteboard using a robot arm.
This uses a 3d-printed custom spring-loaded marker/eraser holder to write on a pane of glass. See contents of stls
folder. The marker holders are the correct width for a marker about 17mm in diameter. Be sure to print with support material.
All marker holders require a 9.1x34.9 compression spring. The "PenHolderRedesigned.stl" file will also print a small button that fits into the end of this spring and should be pushed down into the marker holder and snap into place. The marker should then slide in snugly and the spring should allow variable pressure on the writing surface. I highly recommend also adding a rubber band around the little fingers that hold the marker to prevent them from bending and breaking.
The plane of the glass pane is dynamically generated by specifying three points on the glass, and the correct motions to write on it are derived from that.
This is to write and dynamically update the time formatted using standard seven-segment digits.
This should work on any robot arm running Viam, that has sufficient DOF to follow straight lines. That means the xArm family or a UR5. STL files for marker holders have mounting hole patterns for any xArm.
First, determine the plane of your writing surface. I found the easiest way to do this was to put the arm in freedrive/manual mode, then press the EE mount up against the glass and write down the XYZ location reported by forward kinematics at that position. You'll need to do this three times to get three points to define the plane. Make sure they're nice and far apart to get a more accurate plane.
The three points should be entered into the vars at the top of whiteboard.go, along with your Viam URL and secret for remote control.
Once you have your three points, attach your marker/eraser holder. You may need to adjust the lengths of these in the code depending on the markers and erasers you are using. By default it assumes it's attached with the marker pointing halfway between -Y and +Z in the frame of the arm's EE attachment; if you attach with a different orientation you will have to update the frame of the marker and eraser base frames.
You may want to edit the obstacles passed in, as the current ones reflect a specific example setup which is likely different from your own.
Finally, uncap your monitor and go run whiteboard.go
and see what happens. I recommend standing near your arm's e-stop just in case you put the plane in the wrong spot :)