eye in hand halcon code
时间: 2023-12-31 09:05:12 浏览: 31
Here is a sample code snippet in Halcon for implementing "eye in hand" robotics:
```
* Initialize camera and robot
dev_open_framegrabber('GigEVision',0,0,0,0,0,0,'default','default',-1,'false','default','default','default','default',AcqHandle)
dev_open_socket('x.x.x.x',PortNumber,SocketHandle)
dev_set_cam_param(AcqHandle,'ExposureTimeAbs',20000.0)
* Calibrate camera and robot
gen_cam_par_pose('calibration_data.camparam','calibration_data.pose',CameraPose)
get_robot_param('CalibData',RobotCalibData)
get_robot_param('CalibPose',RobotPose)
* Set up eye-in-hand control
set_robot_cam_trans_pose(CameraPose,RobotPose,RobotCamPose)
set_robot_cam_calib_data(RobotCalibData)
* Move robot to starting position
move_abs_robot(RobotStartPose)
* Perform eye-in-hand operation
while (1)
dev_grab_image(Image)
find_fiducial(Image,FiducialPose)
set_robot_pose(FiducialPose)
grab_robot_pose(RobotPose)
move_abs_robot(RobotPose)
endwhile
```
This code assumes that you have already set up your camera and robot, and have calibrated them using appropriate methods. It then sets up the eye-in-hand control, moves the robot to a starting position, and performs the operation of finding fiducials in the image and moving the robot accordingly to track them.