Ask Your Question
0

How to generate service .class files in rosjava?

asked 2017-03-10 04:42:45 -0500

ysg gravatar image

I am new to ros and rosjava. I am going through basic tutrials of ros and rosjava. I have followed below steps. 1. Created a rosjava pakage.

> mkdir -p myjava/src
> cd myjava/src
> catkin_create_rosjava_pkg testpkg1
> cd ..
> catkin_make
> source devel/setup.bash

Then created rosjava project inside this package

>cd rosjava_catkin_package_a
>catkin_create_rosjava_project subproject1
>cd ../..
>catkin_make

So now I have testpkg1 inside which is java project subproject1. I want to try my own service example given in tutorials. So I created msg folder and srv folder inside my package testpkg1 but outside project subproject1. Inside the msg and srv are my .msg and .srv files respectivey. Structure below.

testpkg1
  >msg
      >Num.msg
  >srv
      >AddSum.srv
  >subproject1
  >package.xml,CmakeList.txt,gradlew,build.gradle etc

I made below changes in package.xml

 <build_depend>message_generation</build_depend>
 <build_depend>std_msgs</build_depend>
 <run_depend>message_runtime</run_depend>
 <run_depend>std_msgs</run_depend>

I made changes in CMakeList.txt

find_package(CATKIN REQUIRED std_msgs message_generation)
add_message_file(
DIRECTORY msg
Files
Num.msg
 )
 add_Service_files(
 DIRECTORY srv
 Files
 AddSum.srv
 )
 generate_messages(DEPENDENCIES std_msgs)
catkin_package(DEPENDENCIES message_runtime std_msgs)

I didnot make any changes to build.gradle. After sourcing I am trying catkin_make. The build gets succeeded however I only see AddSum.h files, AddSumRequest.h, AddSumResponse.h and same, .py ,.js,.lisp files I am not able to see any .java files for same and .class files too. Should this files get generated in this same step or am I missing something? i have also tried

genjava_message_artifacts --verbose - p testpkg1

but it is still not generating any java related files.. I do see the .class files for Listener and Talker but not for AddSum srv.

Any help will appreciated! Thanks..

edit retag flag offensive close merge delete

Comments

At a first glance I can't see what's wrong with the code. I guess that if you could create the rosjava pkg you have the build tools sourced. Have you found a solution? Take a look at this commit for reference: https://github.com/jubeira/tango_ros/...

jubeira gravatar imagejubeira ( 2017-09-27 12:58:12 -0500 )edit

1 Answer

Sort by ยป oldest newest most voted
0

answered 2017-11-06 08:51:18 -0500

jubeira gravatar image

updated 2018-09-17 11:05:01 -0500

While the tutorial is built, this issue can be used as a reference: https://github.com/rosjava/android_co... .

Note that generating new messages and services is not related with rosjava in particular: the mechanism is the same used for regular ROS, but adding the Java generators. That can be done, for example, installing rosjava from source and sourcing the workspace. Then, using catkin_make on a package will also generate the .class artifacts for that package.

Also, see this example using services: https://github.com/jubeira/rosjava_sr... .

EDIT: see http://wiki.ros.org/rosjava_build_too...

edit flag offensive delete link more

Your Answer

Please start posting anonymously - your entry will be published after you log in or create a new account.

Add Answer

Question Tools

2 followers

Stats

Asked: 2017-03-10 04:42:45 -0500

Seen: 242 times

Last updated: Sep 17 '18