How can I create a service on ROS java? Details?

asked 2016-01-29 01:28:31 -0600 gravatar image

updated 2016-01-30 08:43:55 -0600

gvdhoorn gravatar image

I looked over the question: How can I create a service on rosjava?

but it seemed to be a bit dated and I wasn't able to add a new service.

I'm able to implement the AddTwoInts service but having difficulty on creating a new Service 'SendSmsMessage'.

I added a SendSmsMessage.srv to my local ~/rosjava_test_msgs git repo. I did a:

cmake .

but don't see any files to use else where.

I added SendSmsMessage.srv to my local ~/rosjava_bootstrap git repo:

    AddTwoInts.srv               EmptyReqSrv.srv     EmptySrv.srv    
    MultipleAddTwoInts.srv    StringString.srv         ConstantsMultiplex.srv 
    EmptyRespSrv.srv          ListReturn.srv           SendSmsMessage.srv     <<<----

and ran gradle which updated /opt/ros/indigo/share/maven/

I expected it to update: /opt/ros/indigo/share/rosjava_test_msgs/srv

but it still only has AddTwoInts.srv. Why is that?

I don't see any code for SendSms in /opt/ros/indigo but there are logs of files for AddTwoInts:

$ find . -name "SendSms*" -print

$ find . -name "AddTwo*" -print

in rosjava_core/rosjava/build.gradle whe have:

      compile 'org.ros.rosjava_messages:rosjava_test_msgs:[0.2,0.3)'

I assume that get a jar file from:


but that jar file still only has AddTwoInts.class and not my new SendSmsMessage class:

AddTwoInts.class               AddTwoIntsResponse.class 
CompositeB.class              TestArrays.class                      TestPrimitives.class
AddTwoIntsRequest.class       CompositeA.class         
Composite.class                TestHeader.class                     TestString.class

There is are two .idea files referring to rosjava_test_msgs-0.2.1.jar:

   <option value="/opt/ros/indigo/share/maven/org/ros/rosjava_messages/rosjava_test_msgs/0.2.1/rosjava_test_msgs-0.2.1.jar" />



So I suppose the most important problem is ~/rosjava_bootstrap not generating a java file for SendSmsMessage.srv. I do see a message_generation/src/test/java/org/ros/internal/message/ mentioning testAddTwoInts but I doubt a bit this is the problem.

$ git grep AddTwoInts 
message_generation/src/test/java/org/ros/internal/message/  public void testAddTwoInts() {
message_generation/src/test/java/org/ros/internal/message/             serviceDescriptionFactory.newFromType("test_msgs/AddTwoInts");

I'd appreciate some enlightenment on this. Seems a bit complicate and I haven't seen any documentation on this whole process of adding a service that seems to go into this stuff that I'm seeing.

edit retag flag offensive close merge delete