Author Topic: Storing Vision data into a position variable  (Read 152 times)

0 Members and 1 Guest are viewing this topic.

Offline amotobb

  • Newbie
  • *
  • Thank You
  • -Given: 0
  • -Receive: 0
  • Posts: 1
Storing Vision data into a position variable
« on: October 04, 2018, 03:16:18 PM »
I am very new to Motoman robots so bear with me,

I am sending vision data in bytes XYZ & Rx Ry Rz via profinet communication to a Dx100 controller. I want that byte to be stored in a position variable. How do I do that? Is there a convert instruction? Do I have to convert it mathematically in the job?

I don't know if it makes any sense? I'm just looking for a general direction to go in.


Offline 95devils

  • Hero Member
  • *****
  • Thank You
  • -Given: 0
  • -Receive: 141
  • Posts: 864
Re: Storing Vision data into a position variable
« Reply #1 on: October 04, 2018, 06:18:14 PM »
Don't know how much data you are sending for each.  I typically do a word for X, a word for Y, and a byte for RZ.  I also send over a bit for each to determine positive or negative.  I also check the value of each against 0 and against the previous value.  Those sections are not in the sample below.  You would need to massage the instructions to fit where the data is coming in.   Because of resolution, I had to multiply by 10 on this cell.  You may not need to do this, you may need it, or you may have to multiply by 100.

The DIN reads in a byte of data. 

' Read in X data
DIN B040 IG#(31)
DIN B041 IG#(32)
SET D040  EXPRESS B041 * 256 + B040
MUL D040 10
' check X positive
MUL D040 -1
' Read in Y data
DIN B042 IG#(33)
DIN B043 IG#(34)
SET D041  EXPRESS B043 * 256 + B042
MUL D041 10
' check Y positive
MUL D041 -1
' Read in Theta data
DIN B044 IG#(35)
DIN B045 IG#(36)
SET D042  EXPRESS B045 * 256 + B044
' check theta positive
MUL D042 -1
' Set up pick shift variable
SETE P001 (1) D040
SETE P001 (2) D041
SETE P001 (6) D042

Alcohol:  The cause and solution to all life's problems