Ask Your Question
0

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

1 Answer

Sort by ยป oldest newest most voted
0

answered 2019-11-25 08:46:28 -0500

rosmax gravatar image

Hey there,

unfortunately I didn't manage to create ros services without a complete ROS installation. It seems to be impossible right now.

What one can do is to get a complete ROS environment running, install rosjava on that machine and follow this tutorial to create custom services. One can stop follwoing the tutorial after having run catkin_make your service workspace. The .jar files for your custom services can then be found in: /<your_rosjava_service_workspace>/devel/share/maven/org/ros/rosjava_messages

Note that whenever you want to add a service to your already catkin_made service workspace you will need to delete the devel and build folder before running catkin_make again. Otherwise your new service won't be created.

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: 2019-10-11 05:26:01 -0500

Seen: 94 times

Last updated: Nov 25 '19