mindstorm ev3を利用した2自由度マニピュレータの制御
Show older comments
matlab及びプログラミング初心者です。
こちらのサイト(https://haribo-tsuntsun.hateblo.jp/entry/2018/12/03/015955)から以下のプログラムを使ってev3を制御しようとしたところ、
「関数または変数 'mymotor2' が未定義です。」というエラーメッセージが表示されましたが、定義の仕方がわかりません。アドバイスいただけないでしょうか。よろしくお願い致します。
%forward kinematics
l1=65;
l2=120;
t1=30; %target theta_1
t2=30; %target theta_2
x=l1*cos(deg2rad(t1))+l2*cos(deg2rad(t1+t2))
y=l1*sin(deg2rad(t1))+l2*sin(deg2rad(t1+t2))
resetRotation(mymotor1)
resetRotation(mymotor2)
motor_move(mymotor1,10,t1)
motor_move(mymotor2,10,t2)
function motor_move(motorname,power,theta)
rotation=readRotation(motorname);
error=theta-rotation;
while(abs(error)>2)
motorname.Speed=error/power+10;
start(motorname);
rotation=readRotation(motorname);
error=(theta-rotation);
end
stop(motorname);
end
1 Comment
michio
on 10 Feb 2019
質問の投稿、ありがとうございました。
回答の内容で課題や疑問が解決されましたら、
ぜひ「この回答を採用」ボタンのクリックをお願いいたします。
Accepted Answer
More Answers (0)
Categories
Find more on インストールとライセンスの紹介 in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!