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

android custom messages - Subscriber handshake failed - Message types don't match

asked 2014-08-14 06:39:22 -0500

stefan gravatar image

updated 2014-08-18 06:41:32 -0500

HI,

i want to display something published in a custom Message on my android device

I get the error:

E/scriberHandshakeHandler﹕ Subscriber handshake failed: Message types don't match.

i had some troubles setting up my textview

rosTextView_speed = (RosTextView_speed<vehicle_model_dynamics>) findViewById(R.id.TextView01);
    rosTextView_speed.setTopicName("veh_vehicle_model_dynamics");
    //public void setMessageType(String messageType) {
    //    this.messageType = messageType;
    //}
    rosTextView_speed.setMessageType(vehicle_model_dynamics._TYPE);
    // T = Return Type
    //public void setMessageToStringCallable(MessageCallable<String, T> callable) {
    //    this.callable = callable;
    //}
    rosTextView_speed.setMessageToStringCallable(new MessageCallable<String, vehicle_model_dynamics>() {
        //Überschreiben der Methode Call in MessageCallable
        // RÜCKGABETYP call (MESSAGETYP)
        //public interface MessageCallable<T, S> {
        //    T call(S message);
        //}
        @Override
        public String call(vehicle_model_dynamics message) {
            //velocity = message.getData();
            Log.v("DEBUG:", "Speed Message Callable");
            return String.valueOf(message.getVelocity());
        }
    });

in rqt i am publishing topic: veh_vehicle_model_dynamics type: ros_messages/vehicle_model_dynamics the velocity value 111 (float64)

i also imported my custom messages

vehicle_model_dynamics.class in custom_msgs-0.0.0.jar

  // IntelliJ API Decompiler stub source generated from a class file
  // Implementation of methods is not available

package custom_msgs;

public interface vehicle_model_dynamics extends org.ros.internal.message.Message {
java.lang.String _TYPE = "custom_msgs/vehicle_model_dynamics";
java.lang.String _DEFINITION = "####################################################\n
#\n# Vehicle Model     Dynamic Information\n#\n# ...\n#\n
# Description: n#\n####################################################\n\n
# ROS Header\nHeader header
\n\n
# Data
\n
qualified_timed_float64 velocity # [m/s] vehicle velocity
\n\n
qualified_timed_float64 acceleration_x                      # [m/s^2] vehicle acceleration X
\n\n
qualified_timed_float64 acceleration_y                      # [m/s^2] 

...

    std_msgs.Header getHeader();

    void setHeader(std_msgs.Header header);

    custom_msgs.qualified_timed_float64 getVelocity();

    void setVelocity(custom_msgs.qualified_timed_float64 qualified_timed_float64);

    custom_msgs.qualified_timed_float64 getAccelerationX();

    void setAccelerationX(custom_msgs.qualified_timed_float64 qualified_timed_float64);

    ...
}

any guesses what is wrong?

Thanks


rosnode info /play_rosbag:

Node [/play_rosbag]
Publications: 
  * /veh_vehicle_model_dynamics [ros_messages/vehicle_model_dynamics]
  * /function_drivinggoal_desired [ros_messages/function_drivinggoal]

contacting node http://192.168.0.95:37820/ ...
Pid: 4151
Connections:
* topic: /rosout
* to: /rosout
* direction: outbound
* transport: TCPROS

...

Connection to /android_gingerbread/ros_text_view_speed_limited missing
Connection to /android_gingerbread/ros_text_view_speed missing

rosnode info /android_gingerbread/ros_text_view_speed_limited:

Subscriptions: 
 * /function_drivinggoal_desired [ros_messages/function_drivinggoal]

contacting node http://192.168.0.199:44133/ ...
Pid: 2328
Connections:
* topic: /rosout
* to: /rosout
* direction: outbound
* transport: TCPROS
* topic: /function_drivinggoal_desired
* to: /play_1408345524838586534 (http://192.168.0.95:37820/)
* direction: inbound
* transport: TCPROS

rosnode info /android_gingerbread/ros_text_view_speed:

Subscriptions: 
* /veh_vehicle_model_dynamics [ros_messages/vehicle_model_dynamics]

contacting node http://192.168.0.199:48483/ ...
Pid: 2744
Connections:
* topic: /rosout
* to: /rosout
* direction: outbound
* transport: TCPROS
* topic: /veh_vehicle_model_dynamics
* to: /play_1408345524838586534 (http://192.168.0.95:37820/)
* direction: inbound
* transport: TCPROS

could the error come from the name of my custom_msgs

could rebuilding the jar as "ros_messages" solve the problem?

edit retag flag offensive close merge delete

3 Answers

Sort by » oldest newest most voted
0

answered 2014-08-18 15:31:45 -0500

stefan gravatar image

renaming my jar into ros_messages did it

so you should always name your rosjava_msg_projects like the folders your messages are organized in!

edit flag offensive delete link more
1

answered 2014-08-18 08:52:46 -0500

paulbovbel gravatar image

You shouldn't have to fiddle around with jars, are you following the tutorial to make a special rosjava message project standin?

http://wiki.ros.org/rosjava/Tutorials...

and

http://wiki.ros.org/rosjava_build_too...

edit flag offensive delete link more
0

answered 2015-06-04 14:41:40 -0500

rpk788 gravatar image

I think the key take away here, which paulbovbel might have been hinting at, is that the _TYPE field in your Java message interface needs to match the type listed in your published topic.

In your example the Interface's _TYPE field listed: "custom_msgs/vehicle_model_dynamics";

but the topic actually published messages of type: ros_messages/vehicle_model_dynamics

It is not necessarily the name of the JAR.

edit flag offensive delete link more

Question Tools

1 follower

Stats

Asked: 2014-08-14 06:39:22 -0500

Seen: 478 times

Last updated: Aug 18 '14