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

Revision history [back]

It turns out that this was working before due to a gradlew trick that creates an executable, linked to the jar file, that I had set up a long time ago, and forgotten. This was based on another post that I found (see the link in the code comment). I added this to my build.gradle:

/*
 * Create a deploy task to make an executable named "execute",
 * that can be used from the roslaunch .launch files.
 * To run this from this directory, do:
 * ../gradlew deployApp
 *
 * see: https://code.google.com/p/rosjava/issues/detail?id=140
 */
task deployApp(dependsOn: 'installApp') << {
  File binDir = new File(project.projectDir, '/bin')
  if (! binDir.isDirectory()) {
    println "Creating $binDir directory"
    binDir.mkdirs()
  }
  File link = new File(binDir,"execute")
  File target = new File(project.projectDir, "build/install/$project.name/bin/$project.name")
  println "Creating symlink from $link.absolutePath to $target.absolutePath"
  ant.symlink(link: link.absolutePath, resource: target.absolutePath, overwrite: true)
}

Then, I can have a launchfile with a node that looks like this, note the type of "execute" for the java node:

<node pkg="my_pub_sub_tutorial" type="execute" name="my_pub_sub_tutorial" args="com.github.rosjava_catkin_package_a.my_pub_sub_tutorial.Talker"/>

and I can roslaunch it like any other node.