mindstorm ev3を利用した2自由度マニピュレータの制御
古いコメントを表示
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 件のコメント
michio
2019 年 2 月 10 日
質問の投稿、ありがとうございました。
回答の内容で課題や疑問が解決されましたら、
ぜひ「この回答を採用」ボタンのクリックをお願いいたします。
採用された回答
その他の回答 (0 件)
カテゴリ
ヘルプ センター および File Exchange で インストールとライセンスの紹介 についてさらに検索
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!