Robotics StackExchange | Archived questions

ROS Java Problem with sensor_msgs

Hi,

currently i write a android app which calculates the roll, pitch and azimuth values using the device internal sensors (Samsung Galaxy Nexus). With a little bit of sensor fusion this task works perfectly! I want to publish the calculated values with a publisher running on the smartphone to my laptop where the roscore is running. When i try to define the msg type which should be published i get an error. This is the codeline which will not be accepted by the compiler.

org.ros.message.sensor_msgs.JointState jointState = new org.ros.message.sensor_msgs.JointState();

And this is the error message:

Error:(343, 28) error: cannot find symbol class sensor_msgs
Error:(343, 85) error: package org.ros.message.sensor_msgs does not exist

I have imported the following:

import sensor_msgs.*;
import org.ros.*;

But no import resolves the sensor_msgs build error. I have googled a lot of stuff and every example i have found uses this msg Types without any special imports. But for me this will not work. I'm very new to rosjava and android studio. I hope someone can help me.

Asked by christian.blesing on 2014-08-25 09:35:25 UTC

Comments

Answers

I'm not sure, but I think you're missing a dependency declaration on sensor_msgs. You need to add it in both your manifest (package.xml) as well as the gradle build.gradle file. See the Depending On section on the rosjava/Messages wiki page.


Edit: PS: I might not understand your description completely, but does the android_sensors_driver (store link) not do this?

Asked by gvdhoorn on 2014-08-25 09:41:00 UTC

Comments

I have a similar problem. I am trying to use geometry_msgs.Twist and I have dependency declaration in package.xml as well as build.gradle. But I get compilation error ' Could not find method compile() for arguments [org.ros.rosjava_core:rosjava:[0.1,)] '. Any help is greatly appreciated

Asked by Remi on 2014-11-02 10:03:31 UTC

Comments