How can body segments be moved to precise angles in snake robot? I want to create an EV3 robot similar to this:



I've glanced at the mentioned papers. To me it seems that some simpler equations to govern the motors will work also.

I have 9 segments, articulated by 8 motors (two intelligent bricks daisy-chained).

I want the angles of the segments to be proportional to a sine. Doing some calculations in some graphing software, this should be sufficient to have the snake move in a wave.

However, there seems to be no robust, reliable way to set an angle on an EV3 motor. I have a MoveTo myblock, where I use the motor first as angle sensor, calculate the difference to the desired angle and then set the motor "on" for that amount. I also tried setting the power proportional to the difference. But I do not succeed is setting the angle accurate enough, it starts drifting or overshoots. I can't synchronize all the segments that way.

Is it feasible to attempt this in the graphic programming language that comes with the ev3 software or do I need to look to something more advanced?

Any hints would be appreciated.

Edit: Made some headway, rather than putting the motor "On" for a number of degrees, I simply place the motor "On" with a power proportional to the error between the measured angle and desired angle. Works good enough for now. This is the P in a PID-controller, adding an integration and derivative part might help.
The problem I'm currently facing is the weight distribution, the segment that is the head of the snake doesn't have a motor and hence is much lighter. I need to find a better set of factors to multiply the errors with for each motor. I'm confident I'll succeed in this by trial and error whenever I find the time.
You could use worm gears, or worm gears, or compound worm gears, because you can slow the rotation down as much as you want, which means you can have super fine rotation.

An extreme example of this would be the 120 years timer here

This uses a compound worm gear and spur gear train.

Worm gears also have a lot of torque in a small space.

if you want the snake to sway left but then automatically sway right then just hook do something like this but like the following: 

The red pin goes to the snakes body which should 'sway' because of the linkages converting rotary motion into oscillating motion. just make sure that the other half of the snakes body is anchored to the motors housing other wise it will be a retarded snake :)