ROS Subscriber in Android
I would like to make a Subscriber on my Android-Application which can subscribe the batterydata from the robotino. These Data should be displayed on the apply. In this project i have two nodes which the predecessor make it. In one of then they subscribe the camera an, which I use the source code to hope they working for my extra function, but they show nothing. Here my Sourcecode for the subscription
@Override
public void onStart(ConnectedNode connectedNode) {
// Battery Subscriber
battery_subscriber = connectedNode.newSubscriber(GraphName.of(topic_basename + "battery_status"), std_msgs.Float64._TYPE);
battery_subscriber.addMessageListener(new MessageListener<std_msgs.Float64>() {
@Override
public void onNewMessage(Float64 message) {
batterystatus = callable.call(message);
}
}); public Float64 getBatterystatus() { return batterystatus;
}
In my MainActivity I call the "getBatterystatus" to receive the data from the battery:
pTextBatteryStatus = (TextView) findViewById(R.id.robot_battery);
pTextBatteryStatus.setText(String.valueOf(NodeTeleopPublisher.getBatterystatus()));
I publish some data but my app is crashing all the time. My Question is: How make a simple Subscriber for my Android-Application?
Edit: Thank you for your answer. I hope that is the errorlog what are your need. The app crash doesnt make some error. I think the problem is the part from the messageListener.
05-24 15:03:03.659 28077-28077/? E/HAL: load: couldn't find symbol HMI
05-24 15:03:03.660 28077-28077/? E/memtrack: Couldn't load memtrack module (Invalid argument)
05-24 15:03:03.660 28077-28077/? E/android.os.Debug: failed to load memtrack module: -22
05-24 15:03:03.708 28077-28077/? E/HAL: load: id=fm != hmi->id=fm
05-24 15:03:03.708 28077-28077/? E/fm_if.c: find the id:fm and begins to open the devices
05-24 15:03:04.954 28092-28092/? E/HAL: load: couldn't find symbol HMI
05-24 15:03:04.955 28092-28092/? E/memtrack: Couldn't load memtrack module (Invalid argument)
05-24 15:03:04.955 28092-28092/? E/android.os.Debug: failed to load memtrack module: -22
05-24 15:03:05.003 28092-28092/? E/HAL: load: id=fm != hmi->id=fm
05-24 15:03:05.003 28092-28092/? E/fm_if.c: find the id:fm and begins to open the devices
05-24 15:03:05.785 27146-27174/? E/ExternalAccountType: Unsupported attribute readOnly
05-24 15:03:05.785 27146-27174/? E/CSP_ExceptionCapture: Unsupported attribute readOnly
05-24 15:03:05.901 5459-5497/? E/LogCollectService: Level = 256
05-24 15:03:11.144 28104-28104/? E/HAL: load: couldn't find symbol HMI
05-24 15:03:11.144 28106-28106/? E/HAL: load: couldn't find symbol HMI
05-24 15:03:11.144 28106-28106/? E/memtrack: Couldn't load memtrack module (Invalid argument)
05-24 15:03:11.144 28104-28104/? E/memtrack: Couldn't load memtrack module (Invalid argument)
05-24 15:03:11.144 28106-28106/? E/android.os.Debug: failed to load memtrack module: -22
05-24 15:03:11.144 28104-28104/? E/android.os.Debug: failed to load memtrack module: -22
05-24 15:03:11.202 28106-28106/? E/HAL: load: id=fm != hmi->id=fm
05-24 15:03:11.202 28104-28104/? E/HAL: load: id=fm != hmi->id=fm
05-24 15 ...
can you copy the error that is making the application crash here? How are you executing the node that has that code? The code of the node looks alright (see https://github.com/rosjava/rosjava_co... ).