ROS Resources: Documentation | Support | Discussion Forum | Index | Service Status | ros @ Robotics Stack Exchange
Ask Your Question

ROS Java Problem with sensor_msgs

asked 2014-08-25 09:35:25 -0500

christian.blesing gravatar image


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.

edit retag flag offensive close merge delete

2 Answers

Sort by ยป oldest newest most voted

answered 2014-08-25 09:41:00 -0500

gvdhoorn gravatar image

updated 2014-08-25 09:50:25 -0500

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?

edit flag offensive delete link more

answered 2014-11-02 09:03:31 -0500

Remi gravatar image

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

edit flag offensive delete link more

Question Tools

1 follower


Asked: 2014-08-25 09:35:25 -0500

Seen: 1,558 times

Last updated: Aug 25 '14