Robotics StackExchange | Archived questions

[Solution] Simple way of starting ROSJava Nodes from using rosrun or roslaunch

Dear all!

In the current version of ROS Java it appears that the only way to run a node is to call the ./build/install/$projectName/bin/$projectName executable which is created by the 'installApp' gradle task.

This can be annoying, for instance you may want to run your node using the rosrun utility or using the roslaunch utility.

The purpose of this post is to propose to you a simple way to do it. The solution is simple. I updated the build.gradle file to embed a "deployApp" task (the whole file is given as an attached file here 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)
}

I fact it simply create a symbolic link in the /bin directory. The reason why the file created is named "execute" is because if you use $project.name instead it does not work for some obscure reasons.... (I didn't investigate any further...)

Well, now what you have to do is simply call:

gradle deployApp

Then do:

rosrun pkg_name execute some.package.path.YourNodeClass

If you want to create a basic launch file, simply:

I hope this will help,

Best, Rémi Barraquand

Asked by barraq on 2012-08-27 04:52:36 UTC

Comments

thx, maybe you can rather add a section to http://ros.org/wiki/rosjava_core/Tutorials/rosjava_tutorial_pubsub

Asked by KruseT on 2012-08-27 23:45:21 UTC

Hi KruseT, I posted an "Enhancement Issue" on the RosAndroid's googlecode project. The issue in currently in review. I'll update the tutorial when the admin authorize me :)

Asked by barraq on 2012-08-28 02:43:57 UTC

Answers