Dobot calibration program
This example program requires that Pickit is installed and set up with your robot. For installation instructions, refer to the Dobot installation and setup article.
Before following the Dobot specific instructions in this article, make sure you first understand the process of executing a robot-camera calibration as explained on Calibration.
Note
If you want to perform perform robot-camera calibration infrequently, you don’t need to write a calibration robot program. You can teach the calibration poses manually using the robot pendant and the Collect current pose button of the calibration wizard.
If, on the other hand, you expect to run calibration multiple times, an automated calibration program makes sense. You can run it whenever the camera has moved with respect to its fixture. This is the case when you’re setting up your application and the camera location is not yet fully decided. It can also be the result of calibration validation detecting an unexpected change.
Example program: pickit_calibration
Attention
The example programs contain robot poses that must be adapted to every new robot or application.
For pickit_calibration, you must teach all the P1, P2, … P10 poses, and set CAMERA_MOUNT for your setup.
When executing such programs for the first time, do so at low speed to check for potential collisions.
This example program is the src0.lua file of the pickit_calibration project, in Application > Script programming.
It runs a complete multi-pose calibration: it configures the calibration, detects the calibration plate at ten taught poses, and computes the result.
-- Multi-pose calibration: moves through P1..P10 and finds the calibration plate at each pose.
-- Run on its own, not together with a picking program. The Pickit background service must be running.
-- Teach P1..P10 (the current poses are for a specific robot cell)
-- Choose camera mount: CAMERA_MOUNT_FIXED (fixed camera) or CAMERA_MOUNT_ON_ROBOT (camera on the robot).
local CAMERA_MOUNT=CAMERA_MOUNT_FIXED -- or CAMERA_MOUNT_ON_ROBOT
local SETTLE_MS=1000 -- Wait() starts after the move has finished
local points={P1,P2,P3,P4,P5,P6,P7,P8,P9,P10}
for index=1,10 do
local point=points[index]
assert(type(point)=="table" and type(point.pose)=="table",
"Teach calibration point P"..index)
end
assert(pickit_is_running(),"Pickit is not in ROBOT mode: enable it in the Pickit web interface")
assert(pickit_configure_calibration(METHOD_MULTI_POSE,CAMERA_MOUNT,{0,0,0,0,0,0}),
"Calibration configuration failed")
for index=1,10 do
print("Calibration: moving to P"..index)
MovJ(points[index],{a=10,v=10,cp=0})
Wait(SETTLE_MS)
print("Calibration: finding plate at P"..index)
pickit_find_calibration_plate()
end
print("Calibration: computing transform")
assert(pickit_compute_calibration(),"Calibration computation failed")
print("Calibration OK; position error mm: "..PickitCalErrPos
.."; angular error deg: "..PickitCalErrAng)
Below, each step of the program is explained.
Set the camera mount
At the top of the program, set CAMERA_MOUNT to:
CAMERA_MOUNT_FIXEDif the camera is mounted on a fixed structure.CAMERA_MOUNT_ON_ROBOTif the camera is mounted on the robot.
Teach calibration points
The calibration program requires ten poses to be defined (P1 - P10), with the calibration plate in view of the camera.
The poses can be taught with any tool and user coordinate system.
For more information on how to define these poses, see the article on Multi poses calibration.
If one of the poses is not taught, the program stops before moving the robot, with the message Teach calibration point P<n>.
Configure the calibration
pickit_configure_calibration tells Pickit which calibration configuration to run.
The example program first checks that Pickit is in robot mode, then calls it with the multi-pose method and the selected camera mount.
Detect the calibration plate
The robot moves to each pose in turn, at 10% speed.
At each pose, pickit_find_calibration_plate triggers a detection of the calibration plate.
This only locates the plate, it does not compute the calibration.
The Wait(SETTLE_MS) before each detection lets the robot stand still for one second, so that the plate is detected while the robot is not moving.
Compute the calibration
After the last pose, pickit_compute_calibration computes the calibration from the ten collected plate detections.
Until this call succeeds, nothing has been calibrated.
On success, the program logs the position error (mm) and the angular error (deg) of the calibration.
The calibration result can also be read from the Pickit web interface.
If the computation fails, the program stops with the message Calibration computation failed.
Execute the calibration program
Make sure the calibration plate is in place and the robot speed is set to a low value. Then enable robot mode in the Pickit web interface and run the program.