I noticed that currently there is no "standard" way of calling a rosjava node in the regular ROS way (i.e. rosrun [package] [node] [params]).
After trying this out a little bit, I figured that we are just one step away from there (I updated the tutorials a bit). Basically, after following the standard steps to create a package, you can use rosrun like this:
# rosrun [package] [rosjava project] [node class full name]
rosrun rosjava_catkin_package_a my_pub_sub_tutorial com.github.rosjava.rosjava_catkin_package_a.my_pub_sub_tutorial.Talker
Because Gradle creates an executable script which calls RosRun class in rosjava, with the class to execute as its parameter.
The problem is that the task installApp actually creates two executable scripts inside the package. rosrun will then ask the user which one to execute instead of executing it directly.
[rosrun] You have chosen a non-unique executable, please pick one of the following:
1) /home/juan/rosjava_test_ws/src/package/project/build/scripts/project
2) /home/juan/rosjava_test_ws/src/package/project/build/install/project/bin/project
3) /home/juan/rosjava_test_ws/src/package/project/build/scripts/project
4) /home/juan/rosjava_test_ws/src/package/project/build/install/project/bin/project
If we could just eliminate the scripts under scripts directory, rosrun would work right away.
Two quick solutions come to my mind. The first one is to tweak the rosjava project template to delete them, adding something like this:
installApp.doLast {
file('build/scripts').deleteDir()
}
The second one would be to use a custom plugin instead of application (i.e. ros-java-application), which would add the application plugin and a new task ("cleanup" or something like that). Then, tweak the CMakeLists to call this new cleanup task after installApp.
Perhaps there is a better option to tweak installApp directly from a plugin instead of using the project level build.gradle, but I really don't know how to do that in a clean way.
To sum up, this would allow using rosrun just like a regular ROS package right after using catkin_make and sourcing the workspace.
If this sounds good, I offer myself to create a PR with the fixes. Thoughts?
/cc @adamantivm @ernestmc
I noticed that currently there is no "standard" way of calling a rosjava node in the regular ROS way (i.e.
rosrun [package] [node] [params]).After trying this out a little bit, I figured that we are just one step away from there (I updated the tutorials a bit). Basically, after following the standard steps to create a package, you can use
rosrunlike this:Because Gradle creates an executable script which calls
RosRunclass in rosjava, with the class to execute as its parameter.The problem is that the task
installAppactually creates two executable scripts inside the package.rosrunwill then ask the user which one to execute instead of executing it directly.If we could just eliminate the scripts under
scriptsdirectory,rosrunwould work right away.Two quick solutions come to my mind. The first one is to tweak the rosjava project template to delete them, adding something like this:
The second one would be to use a custom plugin instead of
application(i.e.ros-java-application), which would add the application plugin and a new task ("cleanup" or something like that). Then, tweak theCMakeListsto call this new cleanup task afterinstallApp.Perhaps there is a better option to tweak
installAppdirectly from a plugin instead of using the project levelbuild.gradle, but I really don't know how to do that in a clean way.To sum up, this would allow using
rosrunjust like a regular ROS package right after usingcatkin_makeand sourcing the workspace.If this sounds good, I offer myself to create a PR with the fixes. Thoughts?
/cc @adamantivm @ernestmc