mindstorm ev3を利用した2自由度マニピュレータの制御
Afficher commentaires plus anciens
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 commentaire
michio
le 10 Fév 2019
質問の投稿、ありがとうございました。
回答の内容で課題や疑問が解決されましたら、
ぜひ「この回答を採用」ボタンのクリックをお願いいたします。
Réponse acceptée
Plus de réponses (0)
Catégories
En savoir plus sur インストールとライセンスの紹介 dans Centre d'aide et File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!