title: ROS Error. "Error processing request: signal only works in main thread"
body: <p>I am working with Robot Operating System (ROS) and am attempting to make a server/client where the server will boot up ROS nodes that are specified by the client. To perform the "boot up" I am using roslaunch based on the recommendations found here: <a href="http://wiki.ros.org/roslaunch/API%20Usage" rel="nofollow noreferrer">http://wiki.ros.org/roslaunch/API%20Usage</a></p>
  
  <p>I can run the roscore in a window and then I can run the server which boots up fine. However, as soon as I try to send the node names I want to boot up via the client, I get the following error: </p>
  
  <p><em>"Error processing request: signal only works in main thread"</em></p>
  
  <p>It then points to a bunch of files in various areas that I have not yet tracked down.</p>
  
  <p>I have tried using a simple roslaunch call on each of the launch files I made individually for the nodes I want to launch (in this case turtlesim_node and turtle_teleop_key) and they boot up fine and work by just running roslaunch [package] turtlesim_launch.launch, etc.</p>
  
  <p>Below is the code for my server: </p>
  
  <pre><code>#!/usr/bin/env python
  #Filename: primary_server.py
  
  import rospy
  import roslaunch
  from robot_man.srv import *
  
  class StartUpServer(object):
      def __init__(self):
          self._nodes = []
  
  
      def handle_startup(self, names):
          self._temp = names.nodes.split(",") #This reades in the
          # information from the srv file sent by the client and
          # separates each node/package pair
  
          #This loop separates the input from pairs of 2 corresponding
          # to the package and node names the user inputs
          for i in range(len(self._temp)):
              self._nodes.append(self._temp[i].split())
  
          #This loop will launch each node that the user has specified
          for package, executable in self._nodes:
              print('package is: {0}, executable is: {1}'.format(package, executable))
              node = roslaunch.core.Node(package, executable)
              launch = roslaunch.scriptapi.ROSLaunch()
              launch.start()
  
              process = launch.launch(node)
              print('running node: %s'%executable)
          return StartUpResponse(self._nodes) #I will change this later
  
  
  if __name__ == '__main__':
      rospy.init_node('startup_node')
      server = StartUpServer()
      rospy.Service('startup', StartUp, server.handle_startup)
      print('The servers are up and running')
      rospy.spin()
  </code></pre>
  
  <p>Here is the code for my client:</p>
  
  <pre><code>#!/usr/bin/env python
  #Filename: primary_client_startup.py
  
  import rospy
  from robot_man.srv import *
  
  def main(nodes):
      rospy.wait_for_service('startup')
      proxy = rospy.ServiceProxy('startup', StartUp)
      response = proxy(nodes)
      return response
  
  if __name__ == '__main__':
      nodes = input('Please enter the node packages followed by \
      node names separated by spaces. \n To activate multiple nodes \
      separate entries with a comma &gt; ')
      main(nodes)
  </code></pre>
  
  <p>Here is my srv file:</p>
  
  <pre><code>#This should be a string of space/comma separated values
  string nodes
  ---
  #This should return "success" if node/s start up successfully, else "fail"
  string status
  </code></pre>
  
  <p>And finally, here are the two launch files I have made to launch the turtle simulator:</p>
  
  <p>turtlesim_launch.launch</p>
  
  <pre><code>&lt;launch&gt;
      &lt;node name="turtlesim_node" pkg="turtlesim" type="turtlesim_node" /&gt;
  &lt;/launch&gt;
  </code></pre>
  
  <p>turtle_teleop_launch.launch</p>
  
  <pre><code>&lt;launch&gt;
      &lt;node name="turtle_teleop_key" pkg="turtlesim" type="turtle_teleop_key" /&gt;
  &lt;/launch&gt;
  </code></pre>
  
  <p>I have done a bit of google searching and found no similar problems for ROS (though there are some similar errors for Django and the like but they don't relate).</p>
  
  <p>I appreciate the help!</p>
  
  <p>P.S. It is worth noting that I make it to line 34 when the error occurs (process = launch.launch(node)).</p>