ROS Resources: Documentation | Support | Discussion Forum | Index | Service Status | ros @ Robotics Stack Exchange
Ask Your Question

Revision history [back]

You can run any program inside a ROS package using rosrun (or equally, a launch file), no matter if it's a ROS node or not. So I would suggest you put the command(s) you use to run your program from the command line into a shell script and use rosrun to run that script.

Example:

my_pkg/scripts/server.sh:

#!/bin/sh
# TODO: set up CLASSPATH, ...
java $1
  1. run from command line:

    rosrun my_pkg server.sh $(rospack find my_pkg)/classes/Server.class

  2. run from launch file:

my_pkg/launch/my_stuff.launch:

<launch>
  <node pkg="my_pkg" type="server.sh" name="server" args="$(find my_pkg)/classes/Server.class" />
</launch>

You can run any program inside a ROS package using rosrun (or equally, a launch file), no matter if it's a ROS node or not. So I would suggest you put the command(s) you use to run your program from the command line into a shell script and use rosrun to run that script.

Example:

my_pkg/scripts/server.sh:

#!/bin/sh
# TODO: set up CLASSPATH, ...
java $1
  1. run from command line:

    $ rosrun my_pkg server.sh $(rospack find my_pkg)/classes/Server.class

    my_pkg)/classes/Server.class
  2. run from launch file:

file (my_pkg/launch/my_stuff.launch:):

<launch>
  <node pkg="my_pkg" type="server.sh" name="server" args="$(find my_pkg)/classes/Server.class" />
my_pkg)/classes/Server.class"/>
</launch>

You can run any program inside a ROS package using rosrun (or equally, a launch file), no matter if it's a ROS node or not. So I would suggest you put the command(s) you use to run your program from the command line into a shell script and use rosrun to run that script.

Example:

my_pkg/scripts/server.sh:

#!/bin/sh
# TODO: set up CLASSPATH, ...
java $1
  1. run from command line:

    $ rosrun my_pkg server.sh $(rospack find my_pkg)/classes/Server.class
    
  2. run from launch file (my_pkg/launch/my_stuff.launch):

    <launch>
      <node pkg="my_pkg" type="server.sh" name="server" args="$(find my_pkg)/classes/Server.class"/>
    </launch>
    

(remember to set the executable bit on server.sh)

You can run any program inside a ROS package using rosrun (or equally, using a launch file), no matter if it's a ROS node or not. So I would suggest you put the command(s) you use to run your program from the command line into a shell script and use rosrun to run that script.

Example:

my_pkg/scripts/server.sh:

#!/bin/sh
# TODO: set up CLASSPATH, ...
java $1
  1. run from command line:

    $ rosrun my_pkg server.sh $(rospack find my_pkg)/classes/Server.class
    
  2. run from launch file (my_pkg/launch/my_stuff.launch):

    <launch>
      <node pkg="my_pkg" type="server.sh" name="server" args="$(find my_pkg)/classes/Server.class"/>
    </launch>
    

(remember to set the executable bit on server.sh)

You can run any program inside a ROS package using rosrun (or equally, using a launch file), no matter if it's a ROS node or not. So I would suggest you put the command(s) you use to run your program from the command line into a shell script and use rosrun to run that script.

Example:

my_pkg/scripts/server.sh:

#!/bin/sh
# TODO: set up CLASSPATH, ...
java $1
$1    # this won't work exactly, you need to add some more 
           # arguments to java (never can remember which)
  1. run from command line:

    $ rosrun my_pkg server.sh $(rospack find my_pkg)/classes/Server.class
    
  2. run from launch file (my_pkg/launch/my_stuff.launch):

    <launch>
      <node pkg="my_pkg" type="server.sh" name="server" args="$(find my_pkg)/classes/Server.class"/>
    </launch>
    

(remember to set the executable bit on server.sh)