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!