Show HN: Program “Greppy”, a 2-wheeled robot, using a new robotics language
yoga.dev
yoga.dev
Do you know any robots which can be used in such game?
This would also be very nice for game development as Bret Victor demonstrated multiple times.
great!
Game engines like Unity also let you tweak a lot of things interactively, but more by making those things be assets rather than code. But I never really liked that style. (For that matter, I don't like CSS being separate from the page content either.)
So I want Dynamicland for robots.
> The compiler extracts anything marked as a parameter into a separate data structure, with a link to the location in the source code they came from. When the IDE renders the Yoga code, it shows the parameters as sliders.
Turning code into data that can be represented in another way. I guess the idea is from projectional editors, where the code is projected onto different representations depending on the context and what the user wants to accomplish.
Does anyone know of other work along similar lines? Programming the robot is also cool and I'm curious if this idea can be applied to other types of programming where a simplified projection of the program can make code more accessible to non-programmers.
It actually compiles 2 versions of each function: call them foo and foo.grad. foo.grad takes the same arguments as foo, and also a gradient for each output argument. It then computes gradients for each input argument.
The algorithm is simple: traverse the expression tree in the usual order you'd use for emitting code, and remember the order. Then traverse in reverse order, propagating gradients as you go.
The tedious bit is writing the gradients for every built-in op. For an operation like + it's simple: each argument gets the same gradient as the result:
void ExprAdd::backprop(YogaContext const &ctx, GradientExprSet &grads, ExprNode *g)
{
grads.addGradient(ctx, args[0], g);
grads.addGradient(ctx, args[1], g);
}
For something like divide it's a bit grosser: void ExprDiv::backprop(YogaContext const &ctx, GradientExprSet &grads, ExprNode *g)
{
// https://en.wikipedia.org/wiki/Quotient_rule
grads.addGradient(ctx, args[0], ctx.mkExpr<ExprDiv>(g, args[1]));
grads.addGradient(ctx, args[1], ctx.mkExpr<ExprNeg>(
ctx.mkExpr<ExprMul>(g,
ctx.mkExpr<ExprDiv>(
args[0],
ctx.mkExpr<ExprPow>(
args[1],
ctx.mkExpr<ExprConstDouble>(2.0))))));
}
More at https://gitlab.com/umbrellaresearch/yoga2/-/blob/master/jit/... if you're curious.The real-time requirement is fairly hard. The robots I work on use a 1 kHz feedback loop, so it has 1 mS in which to recalculate everything.
Caffe is pretty efficient if you can supply batches of values, but the overhead is high when running real-time.
What robot did you want to tinker with