Pick & Place application by integrating Matlab & ROS
You can also access the summary of the application from MATLAB File Exchange.
- Turn off all anti-virus software and firewalls before running
- Install ROS Kinetic Kame + Gazebo v7 on Ubuntu Linux 16.04 (or VMware etc)
- Create catkin workspace in home directory etc
$ mkdir ~/catkin_ws_motomini
$ mkdir ~/catkin_ws_motomini/src
$ cd ~/catkin_ws_motomini/src
$ catkin_init_workspace
$ git clone https://github.com/ntl-ros-pkg/motoman_apps.git
$ cd motoman_apps
$ sh install.sh
$ source ~/catkin_ws_motomini/devel/setup.bash
- Execute XACRO to generate URDF (convert COLLADA (.dae) to STL)
$ cd ~/catkin_ws_motomini/src/motoman_pkgs/motoman_robot/motoman_description
$ rosrun xacro xacro --inorder motomini_with_gripper.urdf.xacro > ~/motomini_with_gripper.urdf
$ sudo apt install openctm-tools
$ find . -name '*.dae' | sed 's/.dae$//' | xargs -i ctmconv {}.dae {}.stl
# (However, since some COLLADA files are not converted correctly, those with a capacity of 0 are converted manually to STL using Blender etc.)
$ sed -i 's/.dae/.stl/g' ~/motomini_with_gripper.urdf
- Copy one file and one folder under the ROSFiles folder for MATLAB (If you get files from Ubuntu to Windows, use WinSCP etc.)
~/motomini_with_gripper.urdf
~/catkin_ws_motomini/src/motoman_pkgs/motoman_robot/motoman_description
- Launch the Motomini simulation environment
$ source ~/catkin_ws_motomini/devel/setup.bash
$ roslaunch motoman_mathworks_apps motomini_picking_demo_gazebo_autorun.launch
- Start MATLAB R2019a or later
- Replaced the built-in Indigo message with Kinetic
- Install "Robotics System Toolbox Interface for Custom Messages" from Add-on Explorer.
- Add-on Explorer is started with the following command.
>> roboticsAddons
- Add-on Explorer is started with the following command.
- Download the gazebo_msgs package from below
- https://github.com/ros-simulation/gazebo_ros_pkgs
- use
kinetic-devel
- Extract to custommsg under the ROSFiles folder
ROSFiles/custommsg/gazebo_msgs
ROSFiles/custommsg/gazebo_msgs/msg
ROSFiles/custommsg/gazebo_msgs/srv
ROSFiles/custommsg/gazebo_msgs/package.xml
- Run
rosgenmsg
in MATLAB>> rosgenmsg(fullfile(pwd,'ROSFiles','custommsg'))
- Edit the javaclasspath.txt file according to the message displayed on the command line.
- Put a "before" token at the beginning of the line to use the new one instead of the existing JAR file.
<before> c:\Yaskawa_MotoMini\ROSFiles\custommsg\matlab_gen\jar\gazebo_msgs-2.5.8.jar
- Add to MATLAB path as below
>> addpath(fullfile(pwd,'ROSFiles','custommsg','matlab_gen','msggen')) >> savepath
- Put a "before" token at the beginning of the line to use the new one instead of the existing JAR file.
- Restart MATLAB
- Delete the previously generated file and regenerate it
>> rmdir(fullfile(pwd,'ROSFiles','custommsg','matlab_gen','msggen','+robotics','+ros','+custom','+msggen','+gazebo_msgs'), 's') >> rosgenmsg(fullfile(pwd,'ROSFiles','custommsg'))
- Install "Robotics System Toolbox Interface for Custom Messages" from Add-on Explorer.
- Run startupDemo.m in demo folder (PickAndPlaceDemo)
- Click "MATLAB / Simulink: Pick & Place Application" in the browser
- When showCompleteDemo.m opens, change the IP address on line 14 to the IP address of the machine on which Ubuntu 16.04 is installed
- Open the mainController Simulink model below in the command window
>> open_system('mainController');
- Run showCompleteDemo.m
- Execute with Simulink execution button of mainController, which invoke pick and place
- MATLAB R2019a
- Robotics System Toolbox
- Image Acquisition Toolbox
- Image Processing Toolbox
- Computer Vision Toolbox
- Statistics and Machine Learning Toolbox
- Deep Learning Toolbox
- Reinforcement Learning Toolbox
- Simulink
- Stateflow
- Simscape
- Simscape Multibody
- Optimization Toolbox
- Global Optimization Toolbox
- Parallel Computing Toolbox
- MATLAB Coder
- GPU Coder
- Simulink Coder
- Embedded Coder
- Aerospace Toolbox
- Aerospace Blockset
- Audio Toolbox