Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Staubli sync external Axis, RoboDK
Hi, i have successfully been able to move a Staubli Tx90XL with robodk, I am using it to create fast camera moves.
Now I need to sync an external axis witch will control focus gear of the camera (this axis need to be sync with robot program of robo dk) 
Could any one throw some light on it, 
I was thinking on a "reference frame" linked to the TCP which calculate distance between to move this external axis in sync with robodk program. 

The External motor use 3v3†Level†UART¨†5v†tolerant†57¨600†Baud†8†data†bits¨†no†parity¨†1†stop†bit
As I spoke to Staubli I got this answer:
"the easiest is to insert an RS232 to UART (TTL) adapter. Like this you will be able to dialog with your tool using the RS232 interface of the CS8C.

In VAL3, you have to create an sio variable that you link to the CS8C serial interface.
You then have to write in VAL3 your own communication drivers following tools manufacturer specification.
And Then link it to RoboDK somehow."

Any one could help here with communication between RoboDK-Val3-External Axis?
(have everything ready, manufacturer communications protocols, rs232 to uart, cable, ...) need the master mind to do the programing, an I would like to pay for your time.
Please contact me over forum or Mail (

It would be easier to control the camera from the computer. You can do so with a USB to RS232 converter. You can find a USB to RS232 converter for $20 or less on Amazon, some computers have RS232 port as well.

Then, you can communicate from a PC through serial using a small Python program like the one attached. This example will move the camera using the RTMOTION UART protocol. You can convert this into a macro in RoboDK so it can take a parameter such as the Zoom, Focus or Iris and update it in your robot program.

This example requires Pyserial, a module that can be easily installed.

# build a new buffer (array of bytes to send 0-255)
buffer = []

# fixed header (do not change)

# Command: 100=focus, 101=IRIS, 102=ZOOM

# DATA (usually a 16 bit int)
buffer.append(0) # byte 1
buffer.append(0) # byte 2

# add terminator packet


# Send buffer to COM3
# requires installing pyserial:
# pip install pyserial
import serial
ser = serial.Serial('COM3', 57600, parity=serial.PARITY_NONE, stopbits=serial.STOPBITS_ONE, bytesize=serial.EIGHTBITS, timeout=0.5)

Let us know if you need help integrating this into your RoboDK project.
sure but how do I sync robot movement with the external motor?

As program run on the Staubli robot, robodk does not know when TX90XL is running or where it is to sync movement.


Also what I see on macros for Paint spray Is just on or off, so this external axis must have different values for different targets and in sync with those targets of the robot program.
Also with progression, wich means if Target1 MoveL is Focus "10" and Target2 MoveL is Focus "90" need to sync, to progressively go from 10 to 90 in time with robot go from Target 1 to target 2.

Could I do it with macro and be able to modify easily those values?
I got communication with the external gear. Over usb, now how do I integrate with robo dk and sync with targets?

Do you mean you've setup your camera as an external axis or you control it from the computer?
i control it with the computer, with a python script, I am able to send commands to move the gear.
Now I need to get the script to the robodk and sync Target1 to this external gear, target2 and so on.
So Target1 lets say has the external axis to 100 then MoveL to target 2 with the external axis move to 234.
How do i integrate the script to robodk to send the orders to the external axis (as each target will have a different external axis value) but also to send to the Staubli robot program and then sync the robot program running with this external axis as the commands are running on the pc but the staubli is running the program.
Could I get realtime info from the robot or something to sync?
Yes, you should be able monitor the robot position and update the camera focus accordingly.

For example, when you move the robot from RoboDK the robot position is monitored and you can see the robot position in RoboDK in real time. Then, you can have an infinite loop to update the focus according to the distance between 2 coordinate systems.

For example, something like this will update the zoom:

frame_cam  = RDK.Item('Camera Frame',ITEM_TYPE_FRAME)
frame_object = RDK.Item('Object Frame', ITEM_TYPE_FRAME)

while True:
# calculate the relationship between 2 coordinate systems
   pose_distance = frame_cam.PoseAbs().inv() * frame_object.PoseAbs()

# calculate the distance
   distance = norm(pose_distance.Pos())
   # Send signal to the camera

This function can be running at the same time you run your programs.

Users browsing this thread:
1 Guest(s)