PDA

View Full Version : [Question(s)] Request WidowX Arm Position?



LukeM
06-08-2015, 07:58 AM
Hi there,

I am using a WidowX arm with the provided InterbotixArmLinkSerial Arbotix code. I have written a MATLAB GUI that lets me control the arm (woohoo!), but I am curious if there is someway I can request the arm position using the existing serial communication protocol. Essentially, I want to put the arm to sleep, physically move the arm myself, grab all of the servo positions, and then program the position in. This would also be super useful for just general debugging. It would be fantastic to grab all of those servo positions within the existing armLink code.

I am hoping to write my own kinematic solver using the arm in Backhoe mode.

Thanks!
Luke

kgranat
06-10-2015, 05:08 PM
We currently don’t have currently have a command to get back data from each servo. This is something we would like to implement, but haven’t gotten to it.


If you wanted to implement it, I would try something like this:


https://github.com/Interbotix/ArmLinkLibrary/blob/master/ArmLink/examples/InterbotixArmLinkSerial/InputControl.h#L75-L78
These lines look for the commands for returning analog data from the ArbotiX. So you could do something like




else if(armlink.ext == 0x80){ //128
//IK value response
}
//NEW CODE
else if(armlink.ext == 0x81){ //129
int gripperPosition = GetPosition(8);//this line gets the current position of the gripper(servo ID# 8)
ReportAnalog(armlink.ext, gripperPosition); //report data with current extended value header
}
//END NEW CODE
else if(armlink.ext >= 0xC8){ //200 and above
// read analogs
ReportAnalog(armlink.ext, analogRead(armlink.ext - 0xC8));
}




So basically the idea is that you’ll send 0x81 (129 in decimal) as your extended instruction, then look for the 5-byte packet, just like with the analog data. You’ll need to put the high byte and low byte together to get the actual position of the servo.

You'll either need a different instruction for each joint, or you can one instruction, then read one of the data bytes to determine which servo to get data about.




Please note that I haven’t tested this code, but if you have problems with it, let me know and I can look at it .

bcdebusk
01-08-2017, 08:21 PM
Has there been any progress on this? I'd like to be able to query arm positions as well.

Ideally, commands could also stream arm positions between move instructions. Has anyone looked into this?