## For instruction on writing tutorials ## http://www.ros.org/wiki/WritingTutorials #################################### ##FILL ME IN #################################### ## for a custom note with links: ## note = ## for the canned note of "This tutorial assumes that you have completed the previous tutorials:" just add the links ## note.0=[[rosjava/Anatomy of a RosJava Package|Anatomy of a RosJava Package]] ## note.1=[[rosjava/Tutorials/hydro/Installation|Installation]] ## descriptive title for the tutorial ## title = Creating Rosjava Packages ## multi-line description to be displayed in search ## description = Script wizards for conveniently creating rosjava packages and projects. ## the next tutorial description (optional) ## next = ## links to next tutorial (optional) ## next.0.link=[[rosjava_build_tools/Tutorials/hydro/WritingPublisherSubscriber(Java)|Writing a Publisher and Subscriber]] ## next.1.link= ## what level user is this tutorial for ## level= BeginnerCategory ## keywords = rosjava #################################### <> <> == Overview == This tutorial will teach you how to use the `catkin_create_rosjava_xx` scripts to populate rosjava packages and subprojects. A typical workspace will look like (refer to [[rosjava/Anatomy of a RosJava Package|anatomy of a rosjava package]] for more details): {{{ /src /rosjava_catkin_package_a /rosjava_gradle_subproject_a /rosjava_gradle_subproject_b /rosjava_gradle_subproject_c /rosjava_catkin_package_b /rosjava_gradle_subproject_d /rosjava_gradle_subproject_e /rosjava_gradle_subproject_f }}} == Preparation == You will need a [[rosjava/Tutorials/hydro/Installation|ros environment]] for your rosjava installation to utilise these scripts. Specifically, after installation (as described in the previous link), the example below will only work after running `source rosjava/devel/setup.bash` or something equivalent. == RosJava Catkin Packages == Create an empty workspace and populate it with a couple of rosjava catkin packages: {{{ > mkdir -p src > cd src > catkin_create_rosjava_pkg rosjava_catkin_package_a > catkin_create_rosjava_pkg rosjava_catkin_package_b > cd .. > catkin_make > source devel/setup.bash }}} At this point, there is nothing yet to compile, so catkin_make just configured a `setup.bash` for you. A single rosjava catkin package includes the following important files: * ''CMakeLists.txt'': configures gradle builds under the hood and sets up install rules. * ''package.xml'' : used to string/sequence compilation of separate gradle projects with catkin_make. * ''build.gradle'' : the (super) project gradle build rules customised for rosjava. * ''settings.gradle'' : the place to list all your subprojects (like CMake's add_subdirectory). == RosJava Gradle Subprojects == === Binary Projects (App) === Create a simple example application with talker and listener. {{{ > cd src/rosjava_catkin_package_a > catkin_create_rosjava_project rosjava_gradle_subproject_a > cd ../.. > catkin_make }}} For more details about java binary (app) projects, continue with the [[rosjava_build_tools/Tutorials/hydro/WritingPublisherSubscriber(Java)|Writing a Simple Publisher and Subscriber Tutorial]]. === Library Project (Jar) === Create a simple library jar with a single compiled class, Dude. {{{ > cd src/rosjava_catkin_package_a > catkin_create_rosjava_library_project rosjava_gradle_subproject_a > cd ../.. > catkin_make }}} For more details about java library projects, continue with the [[rosjava_build_tools/Tutorials/hydro/Building RosJava Libraries|Building RosJava Libraries Tutorial]]. === Message Projects (Msg) === With regards to creating msg projects, you might wish to read the rosjava documentation on how rosjava handles [[rosjava/Messages|messages]] and in particular [[rosjava/Tutorials/hydro/Unofficial Messages|unofficial message packages]]. == Faster Compiles == You can of course keep doing entire workspace recompiles every time you make an edit with catkin_make, but you can speed things up. Just as running ''make'' in build project folders for c++ will only make the targets you're interested in, you can do the same for rosjava with ''gradle''. * Source `devel/setup.bash` - this makes sure all the environment variables are correctly set. * From the root of your gradle super projects run './gradlew tasks' and pick the task you want to build (hint: check CMakeLists.txt). * From a gradle subprojects, use '../gradlew' instead. == Video Tutorial == <> ## AUTOGENERATED DO NOT DELETE ## TutorialCategory ## FILL IN THE STACK TUTORIAL CATEGORY HERE