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 androidcore and rosjavatutorials 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 ofsensor_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 havingconnectedNode.newPublisher()
I haveconnectedNode.newServiceClient()
in my client class, and callingnewMessage()
on the service client does not return asensor_msgs/Image
message but rather a type of request. I do not know how to make asensor_msgs/Image
message.
Another thing I've looked at is the rosjava_tutorial_services
tutorial where it sends two long
s to a service and gets their sums. I don't know how to change the Client
they use because it only sets two long
s, 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!
Asked by mario.morales-rebaza on 2013-06-18 10:53:17 UTC
Comments