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

mario.morales-rebaza's profile - activity

2016-10-26 02:12:43 -0500 received badge  Student (source)
2013-08-19 00:09:18 -0500 received badge  Notable Question (source)
2013-08-19 00:09:18 -0500 received badge  Famous Question (source)
2013-06-24 04:38:32 -0500 received badge  Popular Question (source)
2013-06-18 10:53:17 -0500 asked a question Using Android's Camera to send picture to Service

The core of this question is: how do I send messages from my android device to a service running on my desktop? There's a couple of basic tutorials in android_core and rosjava_tutorials but no documentation online to guide me through it.

I'm using rosjava and android to send a picture taken from an android phone to a service running on my ubuntu machine. I've already gone through the tutorial android_tutorial_camera where you stream sensor_msgs/CompressedImage's from the phone to the desktop and it works, but here's what I want to do and can't figure out:

  • I want to send a single sensor_msgs/Image message, not a stream of sensor_msgs/CompressedImage's. I actually don't know the difference between the two types of messages, but in any case I only want to take a single picture with the camera and send it, not stream live.
  • The tutorial uses a Publisher to send the messages, but I need to use a service, not a topic. Thus, instead of having connectedNode.newPublisher() I have connectedNode.newServiceClient() in my client class, and calling newMessage() on the service client does not return a sensor_msgs/Image message but rather a type of request. I do not know how to make a sensor_msgs/Image message.

Another thing I've looked at is the rosjava_tutorial_services tutorial where it sends two longs to a service and gets their sums. I don't know how to change the Client they use because it only sets two longs, which they do simply by: request.setA(2); request.setB(2); (the 2s are just placeholder numbers they send) whereas in my case I have request.setImage() except I don't know what parameters to put inside setImage().

Please let me know if I need to provide any more information. I've already tested the service on my machine and it works, and I've also tested sending an empty message from the phone to the service and that also works, but now I need to send a picture!