For the animation question (.mpd fragment)
0 MOTOR_AXLE 33 1 -3.14159265/2+calc_atan2(200+80*calc_ecos(0,0.041666666),168+80*calc_esin(0,0.041666666))+calc_angle(140,calc_dist(200+80*calc_ecos(0,0.041666666),168+80*calc_esin(0,0.041666666)),240)
1 16 120 -320 -10 1 0 0 0 1 0 0 0 1 hammer.ldr
0 MOTOR_AXLE 32 1 3.14159265+calc_angle(140,240,calc_dist(200+80*calc_ecos(0,0.041666666),168+80*calc_esin(0,0.041666666)))
1 16 -20 -318 -35 1 0 0 0 1 0 0 0 1 arm_complicated.ldr
0 MOTOR_AXLE -1
0 MOTOR_AXLE -1
where:
function calc_angle( A,B,C) { return Math.acos( (A*A+B*B-C*C)/(2*A*B) ); }
function calc_dist( X,Y) { return Math.sqrt( X*X+Y*Y); }
function calc_atan2( X, Y) { return Math.atan2( X,Y); }
function calc_esin( ref, scale ) { return Math.sin( Mec.eRot[ref]*scale ); }
function calc_ecos( ref, scale ) { return Math.cos( Mec.eRot[ref]*scale ); }
I'm not happy with current solution, it seems to be extremly complicated. I am definetly going to change it to more sane way... but not sure if I will go as far as to get "generic" constraint-based algorithm.
Engine rotation control is left to NXT-style programming language at the bottom of the page. My idea is to expose simple NXT-style language to user (I want it to be used by childrens) while hiding internal complications.
Regards,
Jakub
0 MOTOR_AXLE 33 1 -3.14159265/2+calc_atan2(200+80*calc_ecos(0,0.041666666),168+80*calc_esin(0,0.041666666))+calc_angle(140,calc_dist(200+80*calc_ecos(0,0.041666666),168+80*calc_esin(0,0.041666666)),240)
1 16 120 -320 -10 1 0 0 0 1 0 0 0 1 hammer.ldr
0 MOTOR_AXLE 32 1 3.14159265+calc_angle(140,240,calc_dist(200+80*calc_ecos(0,0.041666666),168+80*calc_esin(0,0.041666666)))
1 16 -20 -318 -35 1 0 0 0 1 0 0 0 1 arm_complicated.ldr
0 MOTOR_AXLE -1
0 MOTOR_AXLE -1
where:
function calc_angle( A,B,C) { return Math.acos( (A*A+B*B-C*C)/(2*A*B) ); }
function calc_dist( X,Y) { return Math.sqrt( X*X+Y*Y); }
function calc_atan2( X, Y) { return Math.atan2( X,Y); }
function calc_esin( ref, scale ) { return Math.sin( Mec.eRot[ref]*scale ); }
function calc_ecos( ref, scale ) { return Math.cos( Mec.eRot[ref]*scale ); }
I'm not happy with current solution, it seems to be extremly complicated. I am definetly going to change it to more sane way... but not sure if I will go as far as to get "generic" constraint-based algorithm.
Engine rotation control is left to NXT-style programming language at the bottom of the page. My idea is to expose simple NXT-style language to user (I want it to be used by childrens) while hiding internal complications.
Regards,
Jakub