Close

Record & Playback challenge

A project log for Sixi robot arm

Open, 3D printed, multi axis robot arm

dan-royerDan Royer 06/30/2019 at 02:140 Comments

The good news is that I can play back and record robot movement and robot tool behavior.

I do not yet have a way to recording adding and removing robots, or moving whole robots (base frame of reference).

I have a more serious challenge dealing with GUI clicks that change the tool on the robot.

In Java, as I understand it, the main render loop is in a thread and GUI click events are in another. 

On GUI click , I use a ServiceLoader to enumerate classes derived from DHTool available for my robot, then setup an undoable event to change the tool on the robot.  This action could happen at any time, which makes recording the tool change events (in the render loop) as a stream unreliable.

if I use the enumerator to create an array of possible tools and store them in the dhrobot then they have index numbers (easy to say "current tool=x" in the stream).  This add a problem that if a new tool is added i have to be careful to not change the old index numbers.  Seems unreliable - I can see future me changing the tool order on a whim and breaking other people's recordings.  On the plus side, it solves the reliability problem - a button click makes a *request to change tools*, and the tool change actually happens in the render loop immediately after the request is recorded/played back.

Also i'm not sure how the undoable action system would work with a recording.  if the recording is played back, what does that do to the undoable sequence?  What if I play the same recording 50 times?

The last option is to disable tool change completely during recording and playback, but I still need a way to set the tool once at the start of the recording. ...but if I can set it once in a recording I might as well let the user do it whenever they like.

Discussions