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

stefan's profile - activity

2020-12-15 01:06:39 -0500 received badge  Famous Question (source)
2016-05-29 06:45:43 -0500 received badge  Famous Question (source)
2016-05-25 06:45:48 -0500 received badge  Popular Question (source)
2016-05-25 06:45:48 -0500 received badge  Notable Question (source)
2016-05-08 15:27:14 -0500 marked best answer PubSub: Where are Libraries org.ros.android.*

Where in the Project can i find the imported Libraries

org.ros.android.* e.g. *MessageCallable

Haven t found them in external libraries. There are (in rosjava-0.1.6.jar) org.ros.master,org.ros.node,... But i have no clue where in my android_core project to fin org.ros.android.*

Thanks


For Installation i followed the Tutorial


can t find the sources in android studio - android_core (packages view or project view) and also not in my directories

2016-05-08 15:27:08 -0500 marked best answer pubsub tutorial change string

Hello,

i successfully ran the pubsub Tutorial. This Q helped me to see the message in RQT on my Computer.

How can i change the text hello world?

rosTextView.setMessageToStringCallable ((message) -> {return message.getData();});

what is this doing exactly?

when executing the Talker, how does the node know what to publish?

nodeMainExecuter.execute(talker, nodeConfiguration)

Edit:

Thanks for your short explanation.


Edit:

in rosjava - tutorial pubsub i can change the talker.java

Then i do

cd rosjava_core-hydro
./gradlew install

This builds the new libraries. Now i have my lib in

home/user/rosjava_core-hydro/build/libs

i think i ve installed rosjava like this

The referenced libs in the android project are in

opt/ros/hydro/share/maven/org/ros/rosjava_core/    .../rosjava_tutorial_pubsub

How do i get my libs to this root-folder?

Edit: in my android project i can change the root of this lib in

.idea/rosjava_tutorial_pubsub_0_1_6.xml 

root url="jar://$USER_HOME$/rosjava_core-hydro/build/libs/rosjava_tutorial_pubsub-0.1.6.jar!/"

still saying hello world



Final Edit:

Changing something in talker.class in your rosjava

where do i have to do catkin_make or ./gradle install ???? to create the lib

Then using nautilus with sudo to copy the generated lib into the root folder

opt/ros/hydro/share/maven/org/ros/rosjava_core/    .../rosjava_tutorial_pubsub

here exchange the -jar through your new .jar (with talker and listener class) in it

And now the app publishes the text you wrote in the talker.java file

2016-05-08 15:26:31 -0500 received badge  Famous Question (source)
2015-10-06 02:48:35 -0500 received badge  Famous Question (source)
2015-06-26 06:06:08 -0500 received badge  Notable Question (source)
2015-06-09 13:33:20 -0500 received badge  Famous Question (source)
2015-04-13 05:37:31 -0500 received badge  Notable Question (source)
2015-04-13 05:37:31 -0500 received badge  Popular Question (source)
2015-01-16 15:01:22 -0500 received badge  Famous Question (source)
2014-12-10 08:44:17 -0500 received badge  Famous Question (source)
2014-12-02 09:14:16 -0500 received badge  Famous Question (source)
2014-11-25 12:33:55 -0500 received badge  Famous Question (source)
2014-11-02 09:17:48 -0500 received badge  Famous Question (source)
2014-11-02 09:15:38 -0500 received badge  Notable Question (source)
2014-10-27 20:45:29 -0500 received badge  Popular Question (source)
2014-10-22 18:24:23 -0500 received badge  Famous Question (source)
2014-09-25 03:25:21 -0500 received badge  Notable Question (source)
2014-09-12 14:22:10 -0500 received badge  Popular Question (source)
2014-09-10 02:41:30 -0500 received badge  Famous Question (source)
2014-08-19 10:28:29 -0500 received badge  Notable Question (source)
2014-08-19 09:06:36 -0500 answered a question Android pubsub Listener custom message

adding

compile project (':my_package') in pubsub's build.gradle solved my problem in the end

dependencies {
 compile project(':rosjava')
 compile project (':my_package')
}
2014-08-19 07:37:43 -0500 commented answer Installing ROS on Nexus 4

any news from ros on ubuntu touch?

2014-08-19 05:49:50 -0500 asked a question Android pubsub Listener custom message

Hello,

can anybody tell me how to import a custom message into a java Listener for my Android Project?

I modified the Listeners and Talkers in rosjava_core tutorial_pubsub and did ./gradlew install to build a jar out of my files.

I managed to use custom messages in RosTextViews nad know how to build .java or .jar from my custom messages.

How does the Listerner has to look like? Where do i have to put the .java or .jar and how can i import them to this Listener.java?

Thanks

package org.ros.rosjava_tutorial_pubsub;

import org.apache.commons.logging.Log;
import org.ros.message.MessageListener;
import org.ros.namespace.GraphName;
import org.ros.node.AbstractNodeMain;
import org.ros.node.ConnectedNode;
import org.ros.node.NodeMain;
import org.ros.node.topic.Subscriber;

import mypackage.mymessage;    ???????

public class Listener_mycustom_message extends AbstractNodeMain {

public int intVar_a=0;
public int intVar_b=0;


  @Override
  public GraphName getDefaultNodeName() {
  return GraphName.of("APP/listener_mycustom_message");
  }


 @Override
 public void onStart(ConnectedNode connectedNode) {

  final Log log = connectedNode.getLog();
  Subscriber<my_package.my_message> subscriber = connectedNode.newSubscriber("mytopic", my_package.my_message._TYPE);



 subscriber.addMessageListener(new MessageListener<my_package.my_message>() {
  @Override
  public void onNewMessage(my_package.my_message message) {
intVar_a      = message.getVar_a();
    intVar_b      = message.getVar_b();

      }
    });
   }
}

default Listener

package org.ros.rosjava_tutorial_pubsub;

import org.apache.commons.logging.Log;
import org.ros.message.MessageListener;
import org.ros.namespace.GraphName;
import org.ros.node.AbstractNodeMain;
import org.ros.node.ConnectedNode;
import org.ros.node.NodeMain;
import org.ros.node.topic.Subscriber;

public class Listener extends AbstractNodeMain {

 @Override
 public GraphName getDefaultNodeName() {
 return GraphName.of("rosjava_tutorial_pubsub/listener");
 }
  @Override
  public void onStart(ConnectedNode connectedNode) {
    final Log log = connectedNode.getLog();
    Subscriber<std_msgs.String> subscriber = connectedNode.newSubscriber("chatter", std_msgs.String._TYPE);
    subscriber.addMessageListener(new MessageListener<std_msgs.String>() {
    @Override
    public void onNewMessage(std_msgs.String message) {
    log.info("I heard: \"" + message.getData() + "\"");
   }
  });
 }
}
2014-08-18 15:31:45 -0500 answered a question android custom messages - Subscriber handshake failed - Message types don't match

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!

2014-08-18 08:42:26 -0500 received badge  Popular Question (source)
2014-08-14 08:19:27 -0500 received badge  Notable Question (source)
2014-08-14 06:48:00 -0500 answered a question android listener value into a variable

in the onCreate

final Handler handler=new Handler();
final Runnable r = new Runnable() {
        @Override
        public void run() {

            var        =listener.listenervar;
            dosomething(var);

            handler.postDelayed(this,10);

        }
    };

    Thread t = new Thread(){
        @Override
        public void run() {
            try{
                while(true){
                    sleep(1000);
                    handler.post(r);
                }
            }
            catch(InterruptedException e){e.printStackTrace();}
        }
    };
    t.start();

in the listener.java:

package org.ros.rosjava_tutorial_pubsub;

import org.apache.commons.logging.Log;
import org.ros.message.MessageListener;
import org.ros.namespace.GraphName;
import org.ros.node.AbstractNodeMain;
import org.ros.node.ConnectedNode;
import org.ros.node.NodeMain;
import org.ros.node.topic.Subscriber;

public class Listener extends AbstractNodeMain {




public int listenervar=0;


//also possible
public int getlistenervar(){
return this.listenervar;
}


  @Override
  public GraphName getDefaultNodeName() {
    return GraphName.of("HAF_APP/listener_name");
  }



  @Override
  public void onStart(ConnectedNode connectedNode) {

    final Log log = connectedNode.getLog();
    Subscriber<std_msgs.Int32> subscriber = connectedNode.newSubscriber("topic", std_msgs.Int32._TYPE);



    subscriber.addMessageListener(new MessageListener<std_msgs.Int32>() {
      @Override
      public void onNewMessage(std_msgs.Int32 message) {
    listenervar=message.getData();

      }
    });
  }
}
2014-08-14 06:39:22 -0500 asked a question android custom messages - Subscriber handshake failed - Message types don't match

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?

2014-08-14 01:50:38 -0500 edited question Using custom messages in ROSAndroid

Hi,

i am doing http://wiki.ros.org/rosjava/Tutorials... and http://wiki.ros.org/ROS/Tutorials/Cre...

can anyone have a short look on my CMakeList.txt?

When i do catkin_make i get the error

-- ==> add_subdirectory(custom_msgs)
-- Using these message generators: gencpp;genlisp;genpy
CMake Error at /opt/ros/hydro/share/genmsg/cmake/genmsg-extras.cmake:85 (message): 
  add_message_files() directory not found:
  /home/user/rosjava/src/custom_msgs/msg
Call Stack (most recent call first):
 custom_msgs/CMakeLists.txt:68 (add_message_files)


-- Configuring incomplete, errors occurred!
 make: *** [cmake_check_build_system] Fehler 1
Invoking "make cmake_check_build_system" failed

In my Folder custom_msgs i have the file mycustomMSG.msg

CMakeList:

 cmake_minimum_required(VERSION 2.8.3)
 project(custom_msgs)



 ##Tutorial http://wiki.ros.org/ROS/Tutorials/CreatingMsgAndSrv

 ## Find catkin macros and libraries
 ## if COMPONENTS list like find_package(catkin REQUIRED COMPONENTS xyz)
 ## is used, also find other catkin packages



 ##find_package(catkin REQUIRED COMPONENTS
 ##  std_msgs
 ##)


 find_package(catkin REQUIRED COMPONENTS
    roscpp
    rospy
    std_msgs
    message_generation
 )

 ## System dependencies are found with CMake's conventions
 # find_package(Boost REQUIRED COMPONENTS system)


 ## Uncomment this if the package has a setup.py. This macro ensures
 ## modules and global scripts declared therein get installed
 ## See http://ros.org/doc/api/catkin/html/user_guide/setup_dot_py.html
 # catkin_python_setup()

 ################################################
 ## Declare ROS messages, services and actions ##
 ################################################

 ## To declare and build messages, services or actions from within this
 ## package, follow these steps:
 ## * Let MSG_DEP_SET be the set of packages whose message types you use in
 ##   your messages/services/actions (e.g. std_msgs, actionlib_msgs, ...).
 ## * In the file package.xml:
 ##   * add a build_depend and a run_depend tag for each package in MSG_DEP_SET
 ##   * If MSG_DEP_SET isn't empty the following dependencies might have been
 ##     pulled in transitively but can be declared for certainty nonetheless:
 ##     * add a build_depend tag for "message_generation"
 ##     * add a run_depend tag for "message_runtime"
 ## * In this file (CMakeLists.txt):
 ##   * add "message_generation" and every package in MSG_DEP_SET to
 ##     find_package(catkin REQUIRED COMPONENTS ...)
 ##   * add "message_runtime" and every package in MSG_DEP_SET to
 ##     catkin_package(CATKIN_DEPENDS ...)
 ##   * uncomment the add_*_files sections below as needed
 ##     and list every .msg/.srv/.action file to be processed
 ##   * uncomment the generate_messages entry below
 ##   * add every package in MSG_DEP_SET to generate_messages(DEPENDENCIES ...)

 ## Generate messages in the 'msg' folder
 ## add_message_files(
 ##   FILES
 ##   Message1.msg
 ##   Message2.msg
 ## )



  add_message_files(
    FILES
    mycustomMSG.msg
  )




 ## Generate services in the 'srv' folder
 # add_service_files(
 #   FILES
 #   Service1.srv
 #   Service2.srv
 # )

 ## Generate actions in the 'action' folder
 # add_action_files(
 #   FILES
 #   Action1.action
 #   Action2.action
 # )

 ## Generate added messages and services with any dependencies listed here
 ##uncommented
  generate_messages(
    DEPENDENCIES
    std_msgs
  )     

 ###################################
 ## catkin specific configuration ##
 ###################################
 ## The catkin_package macro generates cmake config files for your package
 ## Declare things to be passed to dependent projects
 ## INCLUDE_DIRS: uncomment this if you package contains header files
 ## LIBRARIES: libraries you create in this project that dependent projects also need
 ## CATKIN_DEPENDS: catkin_packages dependent projects also need
 ## DEPENDS: system dependencies of this project that dependent projects also need
 catkin_package(
 #  INCLUDE_DIRS include
 #  LIBRARIES custom_msgs
 #  CATKIN_DEPENDS std_msgs message_runtime
 #  DEPENDS system_lib
 )

 ###########
 ## Build ##
 ###########

 ## Specify additional locations of header files
 ## Your package locations should be listed before other locations
 # include_directories(include)
 include_directories(
   ${catkin_INCLUDE_DIRS}
 )     

 ## Declare a cpp library
 # add_library(custom_msgs
 #   src/${PROJECT_NAME}/custom_msgs.cpp
 # )

 ## Declare ...
(more)