THE ANNIN ROBOTICS FORUM HAS MOVED TO A NEW COMMUNITY. 👉
How does one format...
 
Notifications
Clear all

How does one format a serial command for the AR3?

2 Posts
2 Users
0 Reactions
46 Views
Avatar of Neyvin J De Leon
(@neyvin-j-de-leon)
New Member
Joined: 2 months ago
Posts: 1
Topic starter  

I am trying to gain a strong understanding of how to communicate with robots by deciphering how to send commands to the AR3 directly through the serial monitor. Do you know how I can command the robot to move an arbitrary amount? I just need one working example for any joint. I have tried the following but it doesn't look like I got the format quite right:

 

MJ99 A99 B99 C99 D99 E99 F99 G99 H99 I99 J99 K99 L99 M99 N99 O99 P99 Q99 R99 S99 T99 U99 V99 W99 X99 Y99 Z99

 

I realize Chris already built a superb GUI to eliminate the need to do this, I just love taking a peek under the hood 🙂



   
Quote
Chris Annin
(@chris-annin)
Member Admin
Joined: 2 months ago
Posts: 535
 

Hello, if you look on line 4493 you will find commandCalc where after the kinematics are calculated it send the arduino the steps for each motor

 

here is the bit of code I refer to on line 4493

commandCalc = "MJA"+J1dir+J1steps+"B"+J2dir+J2steps+"C"+J3dir+J3steps+"D"+J4dir+J4steps+"E"+J5dir+J5steps+"F"+J6dir+J6steps+"T"+TRdir+TRstep+"S"+newSpeed+"G"+ACCdur+"H"+ACCspd+"I"+DECdur+"K"+DECspd+"U"+str(J1StepCur)+"V"+str(J2StepCur)+"W"+str(J3StepCur)+"X"+str(J4StepCur)+"Y"+str(J5StepCur)+"Z"+str(J6StepCur)+"\n"

if Code == 0:

ser.write(commandCalc.encode())

 

MJ stand for Move Joint, then A for joint 1 then the direction and then the number of steps to move. So if you input MJA0200 it would move joint 1 forward 200 steps. Or if you sent MJA1200 it would move joint 1 backward 200 steps. Then you could tack on B for joint 2, C for joint 3 and so on.



   
ReplyQuote
Share:
Upload your Photo