How to add custom service types in android studio with rosjava without ROS installation

asked 2019-10-11 05:26:01 -0500

rosmax gravatar image

updated 2019-10-11 05:27:15 -0500

Hey folks,

I ran into a problem that seems unsolvable to me. I am using ROS Kinetic and Android 8.0. As mentioned in the title I am using ROS without a complete installation using a maven repository.

I am developing an Android app that implements a Client/Server structure. The server runs on a Linux machine whereas the client runs on my Android device. The client should request data from the server using a service type (obviously). In the maven repository I could find a predefined service called AddTwoInts which I can add to my project as a dependency. By looking into that dependency that service is made up of 3 java interfaces: AddTwoInts, AddTwoIntsRequest, AddTwoIntsResponse. Using that service causes no problem and my app runs as expected. However when I try to write my own service with the exact same content as the AddTwoInts service example (the service name was changed of course) by creating 3 new Interfaces and change the configuration of my rosnodes to that new service type I get the following error:

org.ros.exception.RosMessageRuntimeException: java.lang.NoSuchFieldException: No field _DEFINITION in class foo

But there is indeed a _DEFINITION field in my custom service class (as there is one in the AddTwoInts service). I do not understand why this field is not found.

I also do not understand how the AddTwoInts service works then. Where is the difference between mine and that one? In my project there aren't any .srv files (same for the dependency). As told before that AddTwoInts service only consists of 3 interfaces, working completely fine. How does AddTwoInts becomes usable?

Thanks in advance,

rosmax

edit retag flag offensive close merge delete