Universal Robots Forum

QR Code string application

Good afternoon.

I’m looking to pull the QR code strings from scanned QR codes using the Wrist Camera and run a segment of code based on which QR code string is read from the QR code (Example: “Machine_1” and “Machine_2”. I’ve got a working program using 2 different codes (QR and Datamatrix) but ideally I’d like to just use a QR code with different strings. I’ve attached some images of the code we’re currently running and was wondering if there’s a way to implement this.

Also: What recommendations do you guys have for lighting? Some of the blocks marked for detection using Cam Locate aren’t being picked up randomly, I assume because of lighting. What type of bulbs/harshness should I look for?


  • Tomas

I have just done something similar using just QR Codes.

the camera will save the whole string into variable rq_code
you need to breakdown the elements within the string to get the information you need.
I wrote a script to get the data I needed.

you can find the script manual here.Universal Robots - Script manual - e-Series - SW 5.10

def QR_decode():
global qr_tempOD = str_find(rq_code_string,“OD”)
global qr_Dia = to_num(str_sub(rq_code_string,(qr_tempOD)+3,4))
global qr_tempWidth = str_find(rq_code_string,“WIDTH”)
global qr_Width = to_num(str_sub(rq_code_string,(qr_tempWidth+6),2))
global qr_OFA_place = str_find(rq_code_string,“OFA”)
global qr_new_part_no = str_sub(rq_code_string,(qr_OFA_place+4),15)
global qr_part_len = str_find(qr_new_part_no,“1U”)
global New_Part_No = str_sub(qr_new_part_no, 0,(qr_part_len-2))
end #QR_decode

regards to lighting. This can have a huge impact on detecting parts or codes. you need a constant light source.
part material can also affect the cameras ability to detect parts (Shiny surfaces are particularly difficult to locate with some cameras eg Robotiq (Speaking from experience) try red of blue light from multiple locations to reduce shadow or reflection.
sometimes its better to back light the part so you just see it in negative.

hope this helps!

Hi Mr. Hammerton,

Are you still using the Robotiq Wrist Camera for your scanning jobs or have you opted for a 3rd party one? If so which one?
Thanks for the Script, I’ll look into it!

I’m still using the Robotiq wrist cam at the moment. its pretty good for barcode and qr code detection.
but my be looking for a fixed 3d camera in the future for part location.