Difference between revisions of "Matlab Fanuc Kinect"
From ESE497 Wiki
Jump to navigationJump to searchLine 1: | Line 1: | ||
Special thanks for Andrew Schoer, Joshua Remba, Pradosh Kharel and Ian Sekiguchi for contributing to this page. | Special thanks for Andrew Schoer, Joshua Remba, Pradosh Kharel and Ian Sekiguchi for contributing to this page. | ||
*[[media:MatlabFanucKinect.zip|MatlabFanucKinect.zip]] | *[[media:MatlabFanucKinect.zip|MatlabFanucKinect.zip]] | ||
− | + | Source Code Description: | |
− | + | *Calibration.m: | |
− | ***% Script to calibrate the Kinect Camera to the Fanuc Robot | + | ******% Script to calibrate the Kinect Camera to the Fanuc Robot |
− | ***% Moves robot to 64 locations and locates X in Kinect image and then computes | + | ******% Moves robot to 64 locations and locates X in Kinect image and then computes |
− | ***% the transformation matrix between the Kinect and Robot. Creates CalibrationDone.mat | + | ******% the transformation matrix between the Kinect and Robot. Creates CalibrationDone.mat |
− | ***% which contains transformation matrix T. Stores image data for post processing in | + | ******% which contains transformation matrix T. Stores image data for post processing in |
− | ***% calibrationInput.mat | + | ******% calibrationInput.mat |
*Kinect2SharedMem2Matlab.m: | *Kinect2SharedMem2Matlab.m: | ||
− | % Example script to acquire images from the Kinect camera in Matlab | + | ******% Example script to acquire images from the Kinect camera in Matlab |
− | % ------------------------------------------------------------------------- | + | ******% ------------------------------------------------------------------------- |
− | % Kinect class uses a slightly modified Microsoft Kinect SDK application | + | ******% Kinect class uses a slightly modified Microsoft Kinect SDK application |
− | % DepthWithColor-D3 and SharedMemDLL.dll to stream images from the Kinect camera | + | ******% DepthWithColor-D3 and SharedMemDLL.dll to stream images from the Kinect camera |
− | % to this script. This script initializes the shared memory and then launches | + | ******% to this script. This script initializes the shared memory and then launches |
− | % DepthWithColor-D3.exe. DepthWithColor-D3 connects to the % shared memory | + | ******% DepthWithColor-D3.exe. DepthWithColor-D3 connects to the ******% shared memory |
− | % and starts streaming RGB and depth images to it. | + | ******% and starts streaming RGB and depth images to it. |
− | % This is preferable to using the KinectForWindowsExample.m because | + | ******% This is preferable to using the KinectForWindowsExample.m because |
− | % DepthWithColor-D3 aligns the RGB and Depth images. | + | ******% DepthWithColor-D3 aligns the RGB and Depth images. |
*Matlab2Fanuc.m: Send a series of movements to the Fanuc Robot using TCP/IP. Run LabVIEWMatlabFanuc\LabVIEWMatlabFanuc.vi and LV_COM_FRM on the Fanuc Robot first. | *Matlab2Fanuc.m: Send a series of movements to the Fanuc Robot using TCP/IP. Run LabVIEWMatlabFanuc\LabVIEWMatlabFanuc.vi and LV_COM_FRM on the Fanuc Robot first. | ||
− | % Example script to move robot with Matlab commands. Runs on computer | + | ***% Example script to move robot with Matlab commands. Runs on computer |
− | % connected to Robot or on a remote computer | + | ***% connected to Robot or on a remote computer |
− | % ------------------------------------------------------------------------- | + | ***% ------------------------------------------------------------------------- |
− | % Launch the teaching pendant program LV_COM_FRM before launching this script. | + | ***% Launch the teaching pendant program LV_COM_FRM before launching this script. |
− | % See: http://classes.engineering.wustl.edu/ese497/index.php/Fanuc_How_Tos,_FAQ,_etc.#FAQ | + | ***% See: http://classes.engineering.wustl.edu/ese497/index.php/Fanuc_How_Tos,_FAQ,_etc.#FAQ |
− | % for detailed instructions. | + | ***% for detailed instructions. |
− | % ------------------------------------------------------------------------- | + | ***% ------------------------------------------------------------------------- |
− | % Messages are sent from this script to the LabVIEWMatlabFanuc.exe to | + | ***% Messages are sent from this script to the LabVIEWMatlabFanuc.exe to |
− | % communicate the new position of the robot. The first 4 bytes of | + | ***% communicate the new position of the robot. The first 4 bytes of |
− | % the message are the length of the message in ASCII and that the message | + | ***% the message are the length of the message in ASCII and that the message |
− | % is floating point numbers delimited by commas. You need to wait until it | + | ***% is floating point numbers delimited by commas. You need to wait until it |
− | % receives an 'Ack' message back from LabVIEW. | + | ***% receives an 'Ack' message back from LabVIEW. |
− | % ------------------------------------------------------------------------- | + | ***% ------------------------------------------------------------------------- |
− | % If this is the computer that also communicates with the robot, then set | + | ***% If this is the computer that also communicates with the robot, then set |
− | % host to 'localhost'. In this case, the script will launch | + | ***% host to 'localhost'. In this case, the script will launch |
− | % LabVIEWMatlabFanuc.exe. This is the application that receives message | + | ***% LabVIEWMatlabFanuc.exe. This is the application that receives message |
− | % over TCP/IP from this script and communicates the coordinates to the | + | ***% over TCP/IP from this script and communicates the coordinates to the |
− | % program running on the robot. | + | ***% program running on the robot. |
− | % If this is NOT the computer that communicates with the robot, then set | + | ***% If this is NOT the computer that communicates with the robot, then set |
− | % host to 'fanucomp.seasad.wustl.edu' or whatever the IP is for that | + | ***% host to 'fanucomp.seasad.wustl.edu' or whatever the IP is for that |
− | % computer. You will have to manually run LabVIEWMatlabFanuc.exe on that | + | ***% computer. You will have to manually run LabVIEWMatlabFanuc.exe on that |
− | % computer and set the IP to this computer's address. You have to stop the | + | ***% computer and set the IP to this computer's address. You have to stop the |
− | % application to change the IP. The application also starts minimized so | + | ***% application to change the IP. The application also starts minimized so |
− | % you'll have to find it in the taskbar. | + | ***% you'll have to find it in the taskbar. |
− | % ------------------------------------------------------------------------- | + | ***% ------------------------------------------------------------------------- |
− | % Matlab to LabVIEW communication based on | + | ***% Matlab to LabVIEW communication based on |
− | % http://www.mathworks.com/matlabcentral/fileexchange/42567-matlab-and-labview-data-exchange-over-tcp-ip | + | ***% http://www.mathworks.com/matlabcentral/fileexchange/42567-matlab-and-labview-data-exchange-over-tcp-ip |
− | % Modified to pre-pend the length the the xmit string and to return the | + | ***% Modified to pre-pend the length the the xmit string and to return the |
− | % received message as a string | + | ***% received message as a string |
− | % ------------------------------------------------------------------------- | + | ***% ------------------------------------------------------------------------- |
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− |
Revision as of 18:57, 27 October 2015
Special thanks for Andrew Schoer, Joshua Remba, Pradosh Kharel and Ian Sekiguchi for contributing to this page.
Source Code Description:
- Calibration.m:
- % Script to calibrate the Kinect Camera to the Fanuc Robot
- % Moves robot to 64 locations and locates X in Kinect image and then computes
- % the transformation matrix between the Kinect and Robot. Creates CalibrationDone.mat
- % which contains transformation matrix T. Stores image data for post processing in
- % calibrationInput.mat
- Kinect2SharedMem2Matlab.m:
- % Example script to acquire images from the Kinect camera in Matlab
- % -------------------------------------------------------------------------
- % Kinect class uses a slightly modified Microsoft Kinect SDK application
- % DepthWithColor-D3 and SharedMemDLL.dll to stream images from the Kinect camera
- % to this script. This script initializes the shared memory and then launches
- % DepthWithColor-D3.exe. DepthWithColor-D3 connects to the ******% shared memory
- % and starts streaming RGB and depth images to it.
- % This is preferable to using the KinectForWindowsExample.m because
- % DepthWithColor-D3 aligns the RGB and Depth images.
- Matlab2Fanuc.m: Send a series of movements to the Fanuc Robot using TCP/IP. Run LabVIEWMatlabFanuc\LabVIEWMatlabFanuc.vi and LV_COM_FRM on the Fanuc Robot first.
- % Example script to move robot with Matlab commands. Runs on computer
- % connected to Robot or on a remote computer
- % -------------------------------------------------------------------------
- % Launch the teaching pendant program LV_COM_FRM before launching this script.
- % See: http://classes.engineering.wustl.edu/ese497/index.php/Fanuc_How_Tos,_FAQ,_etc.#FAQ
- % for detailed instructions.
- % -------------------------------------------------------------------------
- % Messages are sent from this script to the LabVIEWMatlabFanuc.exe to
- % communicate the new position of the robot. The first 4 bytes of
- % the message are the length of the message in ASCII and that the message
- % is floating point numbers delimited by commas. You need to wait until it
- % receives an 'Ack' message back from LabVIEW.
- % -------------------------------------------------------------------------
- % If this is the computer that also communicates with the robot, then set
- % host to 'localhost'. In this case, the script will launch
- % LabVIEWMatlabFanuc.exe. This is the application that receives message
- % over TCP/IP from this script and communicates the coordinates to the
- % program running on the robot.
- % If this is NOT the computer that communicates with the robot, then set
- % host to 'fanucomp.seasad.wustl.edu' or whatever the IP is for that
- % computer. You will have to manually run LabVIEWMatlabFanuc.exe on that
- % computer and set the IP to this computer's address. You have to stop the
- % application to change the IP. The application also starts minimized so
- % you'll have to find it in the taskbar.
- % -------------------------------------------------------------------------
- % Matlab to LabVIEW communication based on
- % http://www.mathworks.com/matlabcentral/fileexchange/42567-matlab-and-labview-data-exchange-over-tcp-ip
- % Modified to pre-pend the length the the xmit string and to return the
- % received message as a string
- % -------------------------------------------------------------------------