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

asked 2012-08-27 04:52:36 -0500

barraq gravatar image

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"
  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:

<launch> <node pkg="$pkg_name" name="$pkg_name" type="execute" args="some.package.path.YourNodeClass" output="screen"> </node> </launch>

I hope this will help,

Best, Rémi Barraquand

edit retag flag offensive reopen merge delete

Closed for the following reason Question does not follow our guidelines for questions. Please see: http://wiki.ros.org/Support for more details. by tfoote
close date 2013-07-17 12:49:33


KruseT gravatar image KruseT  ( 2012-08-27 23:45:21 -0500 )edit

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 :)

barraq gravatar image barraq  ( 2012-08-28 02:43:57 -0500 )edit