Creating a ROS srv

Create package

For ROS - Matlab interface tutorials we decide to create new package clopema_matlab_tutorials. If you have not created it before then type following commands in terminal:

roscd
roscreate-pkg clopema_matlab_tutorials
rosws set clopema_matlab_tutorials

Create srv

The next step is to create and build ros srv file. For more information about srv visit http://www.ros.org/wiki/ROS/Tutorials/CreatingMsgAndSrv. To make this tutorial as simple as possible the srv file we will create is same as in ros tutorials.

roscd clopema_matlab_tutorials/
mkdir srv
echo -e "int64 A\nint64 B\n---\nint64 Sum" > srv/AddTwoInts.srv

Open CMakeLists.txt in your favorite text editor. Remove # to uncomment the following line:

#rosbuild_gensrv()

Finally build the srvs:

rosmake