A non-transitory computer-readable medium having instructions stored thereon that, when executed by a control circuit of a robot control system, causes the control circuit to perform camera calibration by:
- generating a movement command for outputting to a communication interface of the robot control system, wherein the communication interface is configured to communicate with a robot having a base and a robot arm with a calibration pattern disposed thereon, and with a camera having a camera field of view;
- outputting the movement command to the communication interface, wherein the communication interface is configured to communicate the movement command to the robot to cause the robot arm to move the calibration pattern to at least one location in the camera field of view;
- receiving a calibration image from the communication interface, wherein the communication interface is configured to receive the calibration image from the camera, the calibration image being an image of the calibration pattern at the at least one location in the camera field of view, and wherein the calibration pattern includes a plurality of pattern elements having respective defined pattern element locations in a pattern coordinate system, wherein the pattern coordinate system is a coordinate system defined with respect to a location and orientation of the calibration pattern;
- determining a plurality of image pattern element locations from the calibration image, wherein the plurality of image pattern element locations indicate respective locations at which the plurality of pattern elements appear in the calibration image;
- determining an estimate of a first intrinsic camera parameter and an estimate of a second intrinsic camera parameter based on the plurality of image pattern element locations and based on the defined pattern element locations;
- determining, based on the estimate of the first intrinsic camera parameter and the estimate of the second intrinsic camera parameter, an estimate of a first transformation function for describing a spatial relationship between the camera and the calibration pattern;
- determining a simulated calibration image, which is a simulated image of the calibration pattern, based on the estimate of the first transformation function, on the estimate of the first intrinsic camera parameter, and on the estimate of the second intrinsic camera parameter,
- determining a difference between the simulated calibration image and the calibration image,
- adjusting the estimate of the first transformation function based on the difference so as to generate an adjusted estimate of the first transformation function,
- determining, based on the adjusted estimate of the first transformation function, an estimate of a second transformation function for describing a spatial relationship between the camera and a location that is stationary relative to the base of the robot,
- wherein the instructions, when executed by the control circuit, further cause the control circuit, after the camera calibration is performed, to receive a subsequent image from the communication interface, wherein the communication interface is configured to receive the subsequent image from the camera, and wherein the instructions, when executed by the control circuit, further cause the control circuit to output a subsequent movement command for controlling placement of the robot arm, wherein the subsequent movement command is based on the subsequent image and based on the estimate of the second transformation function.