3 ms·
Even a vastly simplified 2D robotics is unexpectedly difficult. I ran a simplified 2D robotics contest to automate code where the task was a simple 2D javascri
by logicallee 2y ago
Even a vastly simplified 2D robotics is unexpectedly difficult.
I ran a simplified 2D robotics contest to automate code where the task was a simple 2D javascript canvas with a robot that had just two segments that could move (the arm and elbow). A piece of fruit was placed somewhat randomly within its reach, and when its hand was close enough it could be instructed to grasp the fruit. (No grasping code needed to be written, the hand just needed to be close enough) The task was then to bring it to its mouth.
There were no sensors involved, the positions were available as global values.
About twenty people looked at the contest (number of concurrent viewers on the dedicated subreddit I posted it on) but nobody submitted a successful entry. When I tried to solve it myself, I found I couldn't automate the task either, neither geometrically nor with a neural network, which turned out to be too difficult to train. The closest I got was being able to grasp the fruit about 7 out of 8 times or so (I forget the exact number), without being able to bring it to the mouth successfully.
By contrast, solving it by hand on the keyboard (moving the two joints and grasping using keyboard shortcuts) like remote controlling the robot (with a human in the loop) is easy.
I had no idea that even such a toy problem with a tiny 2D universe, only two joints, and perfect information, would prove to be so difficult to automate without a robotics framework.
- anticrymactic 2y agoWhy not post the details here? I'd love to have a go at it
- logicallee 2y agoIt was flagged when I posted it originally, so someone didn't like it. (Maybe because I included a $10 prize as a token motivator.) Here is the contest, you can play with your keyboard with a human in the loop (try to bring the fruit to the head using the listed keyboard shortcuts) or you can try to automate it using javascript: https://news.ycombinator.com/item?id=39949966 https://news.ycombinator.com/item?id=39949966 About twenty people looked at it when I posted it but I didn't have any winning entries and I couldn't solve it myself either. If you are very interested you can see a walkthrough of my attempts to solve it here: https://news.ycombinator.com/item?id=39962620 https://news.ycombinator.com/item?id=39962620 I must emphasize that even this very toy, 2D robotics problem with perfect information is very hard, despite being quite easy for a human in the loop. (I tried it with test users, who could complete the task easily with a human in the loop remote controlling the robot.) Let me know if you have any questions or need help using the test environment or understanding the task. You can give me any other feedback you want as well. The contest is finished (with no winners) and there is no longer any prize.
- blt 2y agoThe problem can't be solved with the information in the global variables. You need to know the arm lengths and the positions of the head and shoulders. The info is all hidden in `draw()` but I don't want to reverse-engineer it.
- logicallee 2y agoThanks, you're right about that. >but I don't want to reverse-engineer it. is kind of my original point :) It's a pain to reverse engineer the geometry. You can copy the variables wherever you want and I would accept it, but it doesn't solve the robotics problem. Feel free to copy and paste the code or refactor it however you want, if you send me a solution I will look at it if it is in the spirit of the contest.
- daemonologist 2y agoI think if you know to search the keywords "inverse kinematics" and a bit of JS, this problem isn't too difficult, although I did bungle the signs in a few places. Someone (more dedicated than I) could also work out the trig from scratch if they didn't have that keyword. Here's a solution: https://editor.p5js.org/jwlarocque/sketches/5tCufh3nw https://editor.p5js.org/jwlarocque/sketches/5tCufh3nw
- logicallee 2y agoThank you, great solution. It matches the spirit of the contest as well. If you want another challenge, you could try to get to that result by doing the equivalent of sending keypresses, further mimicking how a robot works. (You can just copy and paste the keys the keyPressed function calls and check the distances yourself). const angleIncrement = PI / 36; if (key === 'q') { upperArmAngle -= angleIncrement; moves++; } if (key === 'w') { upperArmAngle += angleIncrement; moves++; } if (key === 'a') { lowerArmAngle -= angleIncrement; moves++; } if (key === 's') { lowerArmAngle += angleIncrement; moves++; } if (key === 'g') grab(); // Grab the fruit if (key === 'r') release(); // Release the fruit What order of these statements would you send to get to the fruit, grab it, and then get to the result you show? Good job on completing the contest.
- logicallee 2y agoHere's the code with keypresses being sent: https://editor.p5js.org/robss2020/sketches/46cRgGQtX https://editor.p5js.org/robss2020/sketches/46cRgGQtX