Ask Your Question

Jonas25's profile - activity

2022-07-07 01:57:56 -0500 received badge  Famous Question (source)
2022-07-07 01:57:56 -0500 received badge  Notable Question (source)
2022-07-07 01:57:56 -0500 received badge  Popular Question (source)
2016-11-14 11:20:35 -0500 asked a question Wrapper function for data received through topics

Which approach should I use? I have a function foo(float data) that handles some data, computes stuff and returns data, both receiving and returning should go to a topic.

Is it better to write a wrapper function that receives a message from a topic, extracts the data and calls foo(float data). And again gets the return value and publishes it in a message.

ros::Subscriber in_sub = n.subscribe<std_msgs::Float32>("/dist_front", 1, wrapper_foo);
ros::spin();
return 0; 
}

void wrapper_foo(std_msgs::Float32 msg_dist){
    // Extract the information
    float ret = foo(float msg_dist.data());

    //publish
    std_msgs::Float32 msg_acc;
    msg_acc.data = ret;
    acc_pub.publish(msg_acc);
}

float foo(float dist) {
        ...
        return 1.0f;
 }

Or change foo(float data) to foo(std_msg::Float32 data) and extract the data in this function and also publishes it. This is less code, but I have the feeling I'm loosing modularity.

ros::Subscriber in_sub = n.subscribe<std_msgs::Float32>("/dist_front", 1, foo);
ros::spin();
return 0; 
}

void foo(std_msgs::Float32 msg_dist) {
        // Extract the information
        float dist = msg_dist.data();

        //publish
        std_msgs::Float32 msg_acc;
        msg_acc.data = 1.0f;
        acc_pub.publish(msg_acc);
        ...
 }
2016-08-22 10:11:37 -0500 received badge  Famous Question (source)
2016-08-22 10:11:37 -0500 received badge  Notable Question (source)
2016-07-03 19:10:37 -0500 received badge  Student (source)
2016-05-03 01:29:16 -0500 received badge  Popular Question (source)
2016-05-03 01:16:54 -0500 received badge  Famous Question (source)
2016-04-25 13:48:47 -0500 received badge  Notable Question (source)
2016-04-25 08:34:51 -0500 received badge  Scholar (source)
2016-04-25 08:34:45 -0500 commented answer Can't resolve package dependencies when building ros for Ubuntu 16.04

You are right, and I tried this, but to build this there are again dependencies missing. Thus, I gave up now, as it is no more worth the work. Still thank you a lot!

2016-04-25 08:22:19 -0500 received badge  Popular Question (source)
2016-04-25 07:13:11 -0500 commented answer Can't resolve package dependencies when building ros for Ubuntu 16.04

The building process stopped due to some problems with the pcl libraries. I added the repository but it does not support Ubuntu 16.04 yet. Do you know a workaround for this?

2016-04-25 06:37:10 -0500 commented answer Can't resolve package dependencies when building ros for Ubuntu 16.04

I installed the dependencies manually, although I think using --os=ubuntu:trusty would have had the same effect. And I wanted to write "option" instead of "step". It is currently compiling. Big thanks for your help, it made some things clear to me.

2016-04-25 06:17:22 -0500 commented answer Can't resolve package dependencies when building ros for Ubuntu 16.04

I worked through the missing dependencies by installing their equivalent at Ubuntu 14.04, as written on this website: http://rosindex.github.io/deps/ . Trying your fourth step the only error I got was gazebo5 is missing now. Trying to solve that, as the current version is gazebo7...

2016-04-25 05:54:19 -0500 received badge  Supporter (source)
2016-04-25 03:53:47 -0500 asked a question Can't resolve package dependencies when building ros for Ubuntu 16.04

I read ros will be officially available for Ubuntu 16.04 in July, so I tried to build it from source as described here. Unfortunately it can't resolve some package dependencies:

~/ros_catkin_ws » rosdep install --from-paths src --ignore-src --rosdistro jade -y                                                                                                  
ERROR: the following packages/stacks could not have their rosdep keys resolved
to system dependencies:
image_geometry: No definition of [libopencv-dev] for OS version [xenial]
python_qt_binding: No definition of [python-qt-bindings] for OS version [xenial]
rqt_pose_view: No definition of [python-qt-bindings-gl] for OS version [xenial]
rqt_plot: No definition of [python-qt-bindings-qwt5] for OS version [xenial]
qt_gui: No definition of [python-qt-bindings] for OS version [xenial]
cv_bridge: No definition of [libopencv-dev] for OS version [xenial]

I tried to resolve those dependencies by myself and installed libopencv-dev and python-qt-binding through apt-get. This did not change anything. What should I do now?

EDIT: There are dependencies missing to install ros under Ubuntu 16.04. Those dependencies, like pcl, need to be, too. If it is not too urgent to use ros under Ubuntu 16.04, I would recommend to wait until July, for when the official release for Ubuntu 16.04 is announced.

2016-04-21 07:14:18 -0500 asked a question Unmet dependencies installing ros-jade on ubuntu 14.04

I'm trying to install ros-jade, but get this error:

{12:29}~ ➭ sudo apt-get install ros-jade-desktop-full
Reading package lists... Done
Building dependency tree       
Reading state information... Done
Some packages could not be installed. This may mean that you have
requested an impossible situation or if you are using the unstable
distribution that some required packages have not yet been created
or been moved out of Incoming.
The following information may help to resolve the situation:

The following packages have unmet dependencies:
 ros-jade-desktop-full : Depends: ros-jade-desktop but it is not going to be installed
                         Depends: ros-jade-perception but it is not going to be installed
                         Depends: ros-jade-simulators but it is not going to be installed
E: Unable to correct problems, you have held broken packages.

I was following the guide and tried to fix the issue:

{12:33}~ ➭ sudo apt-get install libgl1-mesa-dev-lts-utopic
Reading package lists... Done
Building dependency tree       
Reading state information... Done
Some packages could not be installed. This may mean that you have
requested an impossible situation or if you are using the unstable
distribution that some required packages have not yet been created
or been moved out of Incoming.
The following information may help to resolve the situation:

The following packages have unmet dependencies:
 libgl1-mesa-dev-lts-utopic : Depends: mesa-common-dev-lts-utopic (= 10.3.2-0ubuntu1~trusty2) but it is not going to be installed
                              Depends: libgl1-mesa-glx-lts-utopic (= 10.3.2-0ubuntu1~trusty2) but it is not going to be installed
 qtbase5-dev : Depends: libgles2-mesa-dev or
                        libgles2-dev but it is not installable
 unity-control-center : Depends: libcheese-gtk23 (>= 3.4.0) but it is not going to be installed
                        Depends: libcheese7 (>= 3.0.1) but it is not going to be installed
E: Error, pkgProblemResolver::Resolve generated breaks, this may be caused by held packages.
{12:34}~ ➭

After some searching I found this thread and tried its solution:

{12:34}~ ➭ sudo apt-get install --install-recommends linux-generic-lts-vivid xserver-xorg-core-lts-vivid xserver-xorg-lts-vivid xserver-xorg-video-all-lts-vivid xserver-xorg-input-all-lts-vivid libwayland-egl1-mesa-lts-vivid libgl1-mesa-glx-lts-vivid libglapi-mesa-lts-vivid libgles1-mesa-lts-vivid libegl1-mesa-lts-vivid           xserver-xorg-dev-lts-vivid mesa-common-dev-lts-vivid libxatracker-dev-lts-vivid libgles2-mesa-dev-lts-vivid libgles1-mesa-dev-lts-vivid libgl1-mesa-dev-lts-vivid libgbm-dev-lts-vivid libegl1-mesa-dev-lts-vivid
Reading package lists... Done
Building dependency tree       
Reading state information... Done
libegl1-mesa-dev-lts-vivid is already the newest version.
libegl1-mesa-lts-vivid is already the newest version.
libgbm-dev-lts-vivid is already the newest version.
libgl1-mesa-dev-lts-vivid is already the newest version.
libgl1-mesa-glx-lts-vivid is already the newest version.
libglapi-mesa-lts-vivid is already the newest version.
libgles1-mesa-dev-lts-vivid is already the newest version.
libgles1-mesa-lts-vivid is already the newest version.
libgles2-mesa-dev-lts-vivid is already the newest version.
libwayland-egl1-mesa-lts-vivid is already the newest version.
libxatracker-dev-lts-vivid is already the newest version.
linux-generic-lts-vivid is already the newest version.
mesa-common-dev-lts-vivid is already the newest version.
xserver-xorg-core-lts-vivid is already the newest version.
xserver-xorg-dev-lts-vivid is already the newest version.
xserver-xorg-input-all-lts-vivid is already the newest version.
xserver-xorg-lts-vivid is already the newest version.
xserver-xorg-video-all-lts-vivid is already the newest version.
0 upgraded, 0 newly installed, 0 to remove and 54 not upgraded.

Now I am running out of ideas, what could I try?