├── CMakeLists.txt ├── README.md ├── albums ├── album_1 │ ├── title_1 │ ├── title_2 │ ├── title_3 │ └── title_4 ├── album_2 │ ├── title_1 │ └── title_2 └── album_3 │ ├── title_1 │ ├── title_2 │ ├── title_3 │ ├── title_4 │ └── title_5 ├── asdf └── mp3-controller.asd ├── mp3-controller.asd ├── nodes └── mp3_controller_python.py ├── package.xml ├── src ├── mp3-controller.lisp ├── mp3_controller.cpp ├── mp3_inventory.cpp └── package.lisp └── srv └── MP3InventoryService.srv /CMakeLists.txt: -------------------------------------------------------------------------------- 1 | cmake_minimum_required(VERSION 2.8.3) 2 | project(ros_service_examples) 3 | 4 | find_package(catkin REQUIRED COMPONENTS roscpp roslib message_generation) 5 | 6 | set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++11 -O2") 7 | 8 | add_service_files(FILES 9 | MP3InventoryService.srv) 10 | 11 | generate_messages() 12 | 13 | catkin_package( 14 | CATKIN_DEPENDS roscpp roslib message_runtime) 15 | 16 | include_directories(${catkin_INCLUDE_DIRS}) 17 | add_executable(mp3_inventory src/mp3_inventory.cpp) 18 | add_executable(mp3_controller src/mp3_controller.cpp) 19 | 20 | target_link_libraries(mp3_inventory 21 | ${catkin_LIBRARIES}) 22 | 23 | target_link_libraries(mp3_controller 24 | ${catkin_LIBRARIES}) 25 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | ros_service_examples 2 | ==================== 3 | 4 | ROS service and client examples in CPP, LISP and Python 5 | 6 | 7 | Practical use 8 | ============= 9 | 10 | In order to understand the ROS environment, salvaging it's 11 | parts and looking at it from more than one side can help a 12 | lot. This repository includes a simple "MP3 database server" 13 | which serves album names and included title names to other 14 | ROS nodes on the network. 15 | 16 | 17 | The service server node 18 | ======================= 19 | 20 | The service node is written in C++. It sends the filenames 21 | from within the "albums" folder when requested. When a 22 | client node requests a specific album, the server sends a 23 | list of all filenames included in this album's folder. 24 | A custom message type "MP3InventoryService" is used for 25 | this example. 26 | 27 | 28 | The client nodes 29 | ================ 30 | 31 | Client node source code is given in three programming languages: 32 | 33 | * C++ 34 | * Python 35 | * LISP 36 | 37 | All three client nodes are looking for the service 38 | "mp3_inventory_interaction" on the ROS core and send their 39 | requests to the server node once found. 40 | 41 | 42 | Execution 43 | ========= 44 | 45 | To start the example environment, do the following (assuming, you 46 | have a working ROS core running): 47 | 48 | > roscd ros_service_examples 49 | > rosrun ros_service_examples mp3_inventory 50 | 51 | The first line is important because the inventory server looks for 52 | the directory "albums" in its current working directory. 53 | 54 | The C++ and Python client nodes can also be started using rosrun. 55 | There is no need to "roscd" to any specific directory first. 56 | 57 | Python: 58 | 59 | > rosrun ros_service_examples mp3_controller_python.py 60 | 61 | C++: 62 | 63 | > rosrun ros_service_examples mp3_controller 64 | 65 | To launch the LISP client, be sure to completely set up your Emacs, 66 | LISP and roslisp environment first. After that, you can run the LISP 67 | client node through SLIME: 68 | 69 | > (ros-load:load-system "ros_service_examples" :mp3-controller) 70 | 71 | 72 | Purpose of this example 73 | ======================= 74 | 75 | This example shows the use of custom messages, the exposition of 76 | a service from within a C++ node and the use of this service from 77 | various clients. 78 | The choice of different programming languages was intended explicitly 79 | to 80 | 81 | a) show the differences between their usage and 82 | b) give a rough guide on how to execute these calls. 83 | 84 | Furthermore, the directory structure as shown in this example fits 85 | the use of the ASDF build system for LISP. 86 | -------------------------------------------------------------------------------- /albums/album_1/title_1: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/fairlight1337/ros_service_examples/db7eaa70ad950ed5d3b65de9e910d058bbb00896/albums/album_1/title_1 -------------------------------------------------------------------------------- /albums/album_1/title_2: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/fairlight1337/ros_service_examples/db7eaa70ad950ed5d3b65de9e910d058bbb00896/albums/album_1/title_2 -------------------------------------------------------------------------------- /albums/album_1/title_3: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/fairlight1337/ros_service_examples/db7eaa70ad950ed5d3b65de9e910d058bbb00896/albums/album_1/title_3 -------------------------------------------------------------------------------- /albums/album_1/title_4: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/fairlight1337/ros_service_examples/db7eaa70ad950ed5d3b65de9e910d058bbb00896/albums/album_1/title_4 -------------------------------------------------------------------------------- /albums/album_2/title_1: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/fairlight1337/ros_service_examples/db7eaa70ad950ed5d3b65de9e910d058bbb00896/albums/album_2/title_1 -------------------------------------------------------------------------------- /albums/album_2/title_2: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/fairlight1337/ros_service_examples/db7eaa70ad950ed5d3b65de9e910d058bbb00896/albums/album_2/title_2 -------------------------------------------------------------------------------- /albums/album_3/title_1: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/fairlight1337/ros_service_examples/db7eaa70ad950ed5d3b65de9e910d058bbb00896/albums/album_3/title_1 -------------------------------------------------------------------------------- /albums/album_3/title_2: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/fairlight1337/ros_service_examples/db7eaa70ad950ed5d3b65de9e910d058bbb00896/albums/album_3/title_2 -------------------------------------------------------------------------------- /albums/album_3/title_3: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/fairlight1337/ros_service_examples/db7eaa70ad950ed5d3b65de9e910d058bbb00896/albums/album_3/title_3 -------------------------------------------------------------------------------- /albums/album_3/title_4: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/fairlight1337/ros_service_examples/db7eaa70ad950ed5d3b65de9e910d058bbb00896/albums/album_3/title_4 -------------------------------------------------------------------------------- /albums/album_3/title_5: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/fairlight1337/ros_service_examples/db7eaa70ad950ed5d3b65de9e910d058bbb00896/albums/album_3/title_5 -------------------------------------------------------------------------------- /asdf/mp3-controller.asd: -------------------------------------------------------------------------------- 1 | ../mp3-controller.asd -------------------------------------------------------------------------------- /mp3-controller.asd: -------------------------------------------------------------------------------- 1 | (defsystem mp3-controller 2 | :depends-on (cram-language roslisp ros_service_examples-srv) 3 | :components 4 | ((:module "src" 5 | :components 6 | ((:file "package") 7 | (:file "mp3-controller" :depends-on ("package")))))) 8 | -------------------------------------------------------------------------------- /nodes/mp3_controller_python.py: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env python 2 | 3 | # Software License Agreement (BSD License) 4 | # 5 | # Copyright (c) 2015, Jan Winkler, Institute for Artificial Intelligence, 6 | # Universitaet Bremen. 7 | # All rights reserved. 8 | # 9 | # Redistribution and use in source and binary forms, with or without 10 | # modification, are permitted provided that the following conditions 11 | # are met: 12 | # 13 | # * Redistributions of source code must retain the above copyright 14 | # notice, this list of conditions and the following disclaimer. 15 | # * Redistributions in binary form must reproduce the above 16 | # copyright notice, this list of conditions and the following 17 | # disclaimer in the documentation and/or other materials provided 18 | # with the distribution. 19 | # * Neither the name of the Institute for Artificial Intelligence, 20 | # Universitaet Bremen, nor the names of its contributors may be 21 | # used to endorse or promote products derived from this software 22 | # without specific prior written permission. 23 | # 24 | # THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 25 | # "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 26 | # LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS 27 | # FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE 28 | # COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, 29 | # INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, 30 | # BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; 31 | # LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER 32 | # CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 33 | # LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN 34 | # ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 35 | # POSSIBILITY OF SUCH DAMAGE. 36 | 37 | import roslib 38 | roslib.load_manifest('ros_service_examples') 39 | 40 | import sys 41 | 42 | from ros_service_examples.srv import * 43 | import rospy 44 | 45 | 46 | def mp3_inventory_client(): 47 | rospy.wait_for_service('mp3_inventory_interaction') 48 | 49 | try: 50 | mp3invserv = rospy.ServiceProxy('mp3_inventory_interaction', MP3InventoryService) 51 | albums = mp3invserv("album_list", "") 52 | 53 | print " - Albums:" 54 | for album_item in albums.list_strings: 55 | print " * %s"%album_item 56 | 57 | try: 58 | titles = mp3invserv("title_list", album_item) 59 | 60 | print " Titles:" 61 | for title_item in titles.list_strings: 62 | print " o %s"%title_item 63 | except rospy.ServiceException, e: 64 | print "Service call failed: %s"%e 65 | except rospy.ServiceException, e: 66 | print "Service call failed: %s"%e 67 | 68 | if __name__ == "__main__": 69 | mp3_inventory_client() 70 | -------------------------------------------------------------------------------- /package.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | ros_service_examples 6 | 0.7.3 7 | Semantic Hierarchy Recorder system allowing detailed execution time logging of autonomously performed robot plans on cognitive agents 8 | 9 | Jan Winkler 10 | 11 | BSD 12 | 13 | Jan Winkler 14 | 15 | catkin 16 | 17 | roscpp 18 | roslib 19 | message_generation 20 | 21 | roscpp 22 | roslib 23 | message_runtime 24 | 25 | 26 | -------------------------------------------------------------------------------- /src/mp3-controller.lisp: -------------------------------------------------------------------------------- 1 | ;;; Copyright (c) 2015, Jan Winkler 2 | ;;; All rights reserved. 3 | ;;; 4 | ;;; Redistribution and use in source and binary forms, with or without 5 | ;;; modification, are permitted provided that the following conditions are met: 6 | ;;; 7 | ;;; * Redistributions of source code must retain the above copyright 8 | ;;; notice, this list of conditions and the following disclaimer. 9 | ;;; * Redistributions in binary form must reproduce the above copyright 10 | ;;; notice, this list of conditions and the following disclaimer in the 11 | ;;; documentation and/or other materials provided with the distribution. 12 | ;;; * Neither the name of University of Bremen nor the names of its 13 | ;;; contributors may be used to endorse or promote products derived from 14 | ;;; this software without specific prior written permission. 15 | ;;; 16 | ;;; THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" 17 | ;;; AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 18 | ;;; IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 19 | ;;; ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE 20 | ;;; LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR 21 | ;;; CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF 22 | ;;; SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 23 | ;;; INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN 24 | ;;; CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 25 | ;;; ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 26 | ;;; POSSIBILITY OF SUCH DAMAGE. 27 | 28 | (in-package :mp3-controller) 29 | 30 | (defun mp3-inventory-interaction () 31 | (with-ros-node ("mp3_controller_client_lisp") 32 | (if (not (wait-for-service "mp3_inventory_interaction" 10)) 33 | (ros-warn nil "Timed out waiting for service") 34 | (with-fields (;;(response-string response_string) 35 | (album-list list_strings)) 36 | (call-service "mp3_inventory_interaction" 37 | "ros_service_examples/MP3InventoryService" 38 | :request_string "album_list") 39 | (loop for album across album-list do 40 | (format t "album: ~a~%" album) 41 | (format t " - titles:~%") 42 | (with-fields ((title-list list_strings)) 43 | (call-service "mp3_inventory_interaction" 44 | "ros_service_examples/MP3InventoryService" 45 | :request_string "title_list" 46 | :album album) 47 | (loop for title across title-list do 48 | (format t " * ~a~%" title)))))))) 49 | 50 | (defun mp3-inventory-interaction-client-main () 51 | (mp3-inventory-interaction)) 52 | -------------------------------------------------------------------------------- /src/mp3_controller.cpp: -------------------------------------------------------------------------------- 1 | /********************************************************************* 2 | * Software License Agreement (BSD License) 3 | * 4 | * Copyright (c) 2015, Jan Winkler, Institute for Artificial Intelligence, 5 | * Universität Bremen. 6 | * All rights reserved. 7 | * 8 | * Redistribution and use in source and binary forms, with or without 9 | * modification, are permitted provided that the following conditions 10 | * are met: 11 | * 12 | * * Redistributions of source code must retain the above copyright 13 | * notice, this list of conditions and the following disclaimer. 14 | * * Redistributions in binary form must reproduce the above 15 | * copyright notice, this list of conditions and the following 16 | * disclaimer in the documentation and/or other materials provided 17 | * with the distribution. 18 | * * Neither the name of the Institute for Artificial Intelligence, 19 | * Universität Bremen, nor the names of its contributors may be 20 | * used to endorse or promote products derived from this software 21 | * without specific prior written permission. 22 | * 23 | * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 24 | * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 25 | * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS 26 | * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE 27 | * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, 28 | * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, 29 | * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; 30 | * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER 31 | * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 32 | * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN 33 | * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 34 | * POSSIBILITY OF SUCH DAMAGE. 35 | *********************************************************************/ 36 | 37 | /** \author Jan Winkler */ 38 | 39 | 40 | // System 41 | #include 42 | 43 | // ROS 44 | #include 45 | 46 | // Local 47 | #include 48 | 49 | 50 | int main(int argc, char** argv) { 51 | ros::init(argc, argv, "mp3_inventory_client"); 52 | 53 | ros::NodeHandle nh; 54 | ros::ServiceClient client = nh.serviceClient("mp3_inventory_interaction"); 55 | 56 | ros_service_examples::MP3InventoryService srv; 57 | 58 | std::stringstream sts; 59 | sts << "album_list"; 60 | srv.request.request_string = sts.str(); 61 | 62 | if(client.call(srv)) { 63 | ROS_INFO("OK, sent. Here is the answer:"); 64 | ROS_INFO(" - Response string: '%s'", srv.response.response_string.c_str()); 65 | 66 | if(strcmp(srv.response.response_string.c_str(), "album_list") == 0) { 67 | ROS_INFO(" - Albums:"); 68 | 69 | for(std::string strString : srv.response.list_strings) { 70 | ROS_INFO(" * %s", strString.c_str()); 71 | 72 | // Call server for information about this album (i.e. titles). 73 | std::stringstream sts; 74 | sts << "title_list"; 75 | ros_service_examples::MP3InventoryService srv_titles; 76 | srv_titles.request.request_string = sts.str(); 77 | sts.str(""); 78 | sts << strString.c_str(); 79 | srv_titles.request.album = sts.str(); 80 | 81 | if(client.call(srv_titles)) { 82 | ROS_INFO(" Titles:"); 83 | 84 | for(std::string strTitle : srv_titles.response.list_strings) { 85 | ROS_INFO(" o %s", strTitle.c_str()); 86 | } 87 | } else { 88 | ROS_INFO("Failed to retrieve album titles for album '%s'", strString.c_str()); 89 | } 90 | } 91 | } else { 92 | ROS_INFO("Response string not recognized."); 93 | } 94 | } else { 95 | ROS_INFO("Unable to call()."); 96 | } 97 | 98 | return EXIT_SUCCESS; 99 | } 100 | -------------------------------------------------------------------------------- /src/mp3_inventory.cpp: -------------------------------------------------------------------------------- 1 | /********************************************************************* 2 | * Software License Agreement (BSD License) 3 | * 4 | * Copyright (c) 2015, Jan Winkler, Institute for Artificial Intelligence, 5 | * Universität Bremen. 6 | * All rights reserved. 7 | * 8 | * Redistribution and use in source and binary forms, with or without 9 | * modification, are permitted provided that the following conditions 10 | * are met: 11 | * 12 | * * Redistributions of source code must retain the above copyright 13 | * notice, this list of conditions and the following disclaimer. 14 | * * Redistributions in binary form must reproduce the above 15 | * copyright notice, this list of conditions and the following 16 | * disclaimer in the documentation and/or other materials provided 17 | * with the distribution. 18 | * * Neither the name of the Institute for Artificial Intelligence, 19 | * Universität Bremen, nor the names of its contributors may be 20 | * used to endorse or promote products derived from this software 21 | * without specific prior written permission. 22 | * 23 | * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 24 | * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 25 | * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS 26 | * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE 27 | * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, 28 | * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, 29 | * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; 30 | * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER 31 | * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 32 | * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN 33 | * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 34 | * POSSIBILITY OF SUCH DAMAGE. 35 | *********************************************************************/ 36 | 37 | /** \author Jan Winkler */ 38 | 39 | 40 | // System 41 | #include 42 | #include 43 | #include 44 | #include 45 | #include 46 | #include 47 | 48 | // ROS 49 | #include 50 | #include 51 | 52 | // Local 53 | #include 54 | 55 | 56 | bool mp3_inventory_interaction(ros_service_examples::MP3InventoryService::Request &req, 57 | ros_service_examples::MP3InventoryService::Response &res) { 58 | std::string strDirectory = ros::package::getPath("ros_service_examples") + "/albums"; 59 | ROS_INFO("request string: %s", req.request_string.c_str()); 60 | 61 | if(std::strcmp(req.request_string.c_str(), "album_list") == 0) { 62 | std::string str_temp; 63 | std::stringstream sts; 64 | 65 | DIR* dp; 66 | struct dirent* dirp; 67 | if((dp = opendir(strDirectory.c_str())) != NULL) { 68 | while((dirp = readdir(dp)) != NULL) { 69 | std::string strTempFilename = std::string(dirp->d_name); 70 | 71 | if(std::strcmp(strTempFilename.c_str(), ".") != 0 && 72 | std::strcmp(strTempFilename.c_str(), "..") != 0) { 73 | res.list_strings.push_back(std::string(dirp->d_name)); 74 | } 75 | } 76 | } 77 | 78 | sts.str(""); 79 | sts << req.request_string.c_str(); 80 | res.response_string = sts.str(); 81 | 82 | ROS_INFO("Sending back %ld album(s).", res.list_strings.size()); 83 | } else if(std::strcmp(req.request_string.c_str(), "title_list") == 0) { 84 | std::string strAlbumDirectory = strDirectory + "/" + req.album.c_str(); 85 | 86 | std::string str_temp; 87 | std::stringstream sts; 88 | 89 | DIR* dp; 90 | struct dirent *dirp; 91 | if((dp = opendir(strAlbumDirectory.c_str())) != NULL) { 92 | while((dirp = readdir(dp)) != NULL) { 93 | std::string strTempFilename = std::string(dirp->d_name); 94 | 95 | if(std::strcmp(strTempFilename.c_str(), ".") != 0 && 96 | std::strcmp(strTempFilename.c_str(), "..") != 0) { 97 | res.list_strings.push_back(std::string(dirp->d_name)); 98 | } 99 | } 100 | } 101 | 102 | ROS_INFO("Sending back %ld title(s) for album '%s'.", res.list_strings.size(), req.album.c_str()); 103 | } else { 104 | ROS_INFO("Faulty request string: '%s'", req.request_string.c_str()); 105 | res.response_string = "error_faulty_request_string"; 106 | } 107 | 108 | return true; 109 | } 110 | 111 | 112 | int main(int argc, char** argv) { 113 | ros::init(argc, argv, "mp3_inventory_node"); 114 | ros::NodeHandle nh; 115 | 116 | ros::ServiceServer service = nh.advertiseService("mp3_inventory_interaction", mp3_inventory_interaction); 117 | 118 | ROS_INFO("MP3 Inventory up and running."); 119 | ros::spin(); 120 | 121 | return EXIT_SUCCESS; 122 | } 123 | -------------------------------------------------------------------------------- /src/package.lisp: -------------------------------------------------------------------------------- 1 | ;;; Copyright (c) 2015, Jan Winkler 2 | ;;; All rights reserved. 3 | ;;; 4 | ;;; Redistribution and use in source and binary forms, with or without 5 | ;;; modification, are permitted provided that the following conditions are met: 6 | ;;; 7 | ;;; * Redistributions of source code must retain the above copyright 8 | ;;; notice, this list of conditions and the following disclaimer. 9 | ;;; * Redistributions in binary form must reproduce the above copyright 10 | ;;; notice, this list of conditions and the following disclaimer in the 11 | ;;; documentation and/or other materials provided with the distribution. 12 | ;;; * Neither the name of University of Bremen nor the names of its 13 | ;;; contributors may be used to endorse or promote products derived from 14 | ;;; this software without specific prior written permission. 15 | ;;; 16 | ;;; THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" 17 | ;;; AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 18 | ;;; IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 19 | ;;; ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE 20 | ;;; LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR 21 | ;;; CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF 22 | ;;; SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 23 | ;;; INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN 24 | ;;; CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 25 | ;;; ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 26 | ;;; POSSIBILITY OF SUCH DAMAGE. 27 | 28 | (defpackage mp3-controller 29 | (:nicknames :mp3c) 30 | (:use #:cpl #:roslisp)) 31 | -------------------------------------------------------------------------------- /srv/MP3InventoryService.srv: -------------------------------------------------------------------------------- 1 | string request_string 2 | string album 3 | --- 4 | string response_string 5 | string[] list_strings --------------------------------------------------------------------------------