Ask Your Question

215's profile - activity

2019-08-15 11:36:22 -0500 received badge  Famous Question (source)
2019-08-09 09:07:01 -0500 received badge  Famous Question (source)
2019-07-19 10:54:31 -0500 received badge  Famous Question (source)
2018-10-10 17:32:31 -0500 received badge  Famous Question (source)
2018-08-17 01:03:50 -0500 received badge  Famous Question (source)
2018-08-10 02:06:11 -0500 received badge  Notable Question (source)
2018-08-10 02:06:11 -0500 received badge  Popular Question (source)
2018-08-01 22:29:17 -0500 received badge  Popular Question (source)
2018-08-01 22:29:17 -0500 received badge  Notable Question (source)
2018-06-21 07:32:36 -0500 received badge  Famous Question (source)
2018-05-28 11:24:48 -0500 received badge  Popular Question (source)
2018-05-28 11:24:48 -0500 received badge  Notable Question (source)
2018-05-28 11:24:48 -0500 received badge  Famous Question (source)
2018-05-23 23:38:32 -0500 received badge  Famous Question (source)
2018-04-29 22:03:08 -0500 marked best answer python workspace structuring

I am currently struggling to setup a python ros workspace.. I've been following this guide

http://duckietown.mit.edu/media/pdfs/...

and my src folder looks like this

src
├── CMakeLists.txt -> /opt/ros/indigo/share/catkin/cmake/toplevel.cmake
└── service
    ├── CMakeLists.txt
    ├── include
    │   └── service
    │       ├── __init.py__
    │       └── util.py
    ├── package.xml
    ├── setup.py
    └── src
        └── publisher.py

When i run rosrun service publisher.py i get the error message:

line 5, in <module>
    from service import util 
ImportError: cannot import name util

setup.py

## ! DO NOT MANUALLY INVOKE THIS setup.py, USE CATKIN INSTEAD
from distutils.core import setup
from catkin_pkg.python_setup import generate_distutils_setup
# fetch values from package.xml
setup_args = generate_distutils_setup(
packages=['service'],
package_dir={'': 'include'},
)
setup(**setup_args)
2018-04-29 22:02:13 -0500 received badge  Notable Question (source)
2018-04-19 21:29:37 -0500 received badge  Famous Question (source)
2018-02-28 20:39:37 -0500 received badge  Famous Question (source)
2018-02-28 20:37:58 -0500 received badge  Notable Question (source)
2018-01-14 03:42:09 -0500 received badge  Famous Question (source)
2018-01-14 03:42:09 -0500 received badge  Popular Question (source)
2018-01-14 03:42:09 -0500 received badge  Notable Question (source)
2018-01-04 07:20:38 -0500 received badge  Famous Question (source)
2017-11-07 01:49:41 -0500 received badge  Famous Question (source)
2017-09-13 18:08:28 -0500 marked best answer Logging of ROS_ERROR_STREAM messages?

How do I log ROS_ERROR_STREAM messages into a log file??

Normally i would just do a >> log.txt but, i only want to store the ROS_ERROR_STREAM, and nothing else..

2017-08-30 16:09:27 -0500 received badge  Popular Question (source)
2017-08-30 16:09:27 -0500 received badge  Notable Question (source)
2017-08-08 09:08:25 -0500 marked best answer Subcriber callback within a while loop?

Is it possible for a subscriber to make a callback within a while loop?... if so how then..

In my case i am Subscribing to topic which giving me a position of a robot. I have a array of 8 positions.

double position[8] = {2.0 , 3, 3.0, ...}

And in a while in a loop, I make to robot walk to those position, one after one. i

nt  i = 0
while(i<8)
{
    robotposition = position[i];
   if(real_position == robotposition){
    i++;
   }
}

Here is the real_position, the real position of the robot, which I receive from a callback function.. The problem here is though that this value doesn't get updated when it is in the while loop.. and i don't why.. how do i do that?

2017-07-04 02:05:59 -0500 received badge  Notable Question (source)
2017-06-29 16:58:47 -0500 received badge  Famous Question (source)
2017-06-06 06:13:18 -0500 received badge  Famous Question (source)
2017-04-13 11:07:43 -0500 received badge  Taxonomist
2017-03-15 04:36:14 -0500 received badge  Notable Question (source)
2017-03-15 04:36:14 -0500 received badge  Popular Question (source)
2017-03-09 08:14:02 -0500 received badge  Famous Question (source)
2017-01-30 07:42:22 -0500 received badge  Notable Question (source)
2017-01-26 06:08:44 -0500 received badge  Popular Question (source)
2017-01-26 06:08:44 -0500 received badge  Notable Question (source)
2016-12-14 10:52:17 -0500 received badge  Notable Question (source)
2016-12-08 06:59:16 -0500 received badge  Popular Question (source)
2016-12-07 11:46:14 -0500 asked a question Interrupting a topic callback to call a service

I am currently facing an issue with my code, which both subcribes to a topic, and runs the server side of a service. The problem i am currently facind is that the topic which i am subscribing to is constantly being published to making, making it impossible for me to call my service. The service response is empty, which i assume i due to the topic callback constantly being running.

Here is the code:

#include "subscriber_and_server.h"

subscriber_and_server::subscriber_and_server() :
    n_("~"),
    state_listener_sub_(n_.subscribe("/states", 1, &subscriber_and_server::callback, this)),
    getCurrent_Event_Service(n_.advertiseService("/state_listener/Get_Current_Event", &subscriber_and_server::get_current_event_callback, this))
{
    std::cout << "subscriber_and_server -  constructed" << std::endl;
}

void subscriber_and_server::callback(const std_msgs::String& input)
{
    if(old_event == current_event){}
    else
    {
        this->current_event = input.data;
        this->old_event = this->current_event;
    }
}

bool subscriber_and_server::get_current_event_callback(state_listener::get_current_event::Request &req, state_listener::get_current_event::Response &res)
{
    res.current_event = this->current_event;
    return true;
}

My main is creating a object of the class subscriber_and_server and ros::spin();.

Anyway to handle this issue? I am currently thinking of making a seperating both callback into seperates nodes, publish the new state if one occur, such that service can handle the issue? Is it somehow possible to avoid this??

2016-12-06 02:08:08 -0500 received badge  Popular Question (source)
2016-12-05 17:49:35 -0500 commented answer Log the alive time of a rosnode?

Thats exactly what i need it for.. aren't there any other way.. like using a timer or something like that?. The node i monitor is a control_node.. to measure some performance, i need to know much time it has been on.

2016-12-05 14:39:45 -0500 asked a question Log the alive time of a rosnode?

I am currently working on a rosnode which purpose is to generate CSV files about certain information. One of the information i am seeking is to know how much time a rosnode has been alive.

I know that you using ros::master::getNodes an get a vector of the active nodes, but is it possible to know how long time it has been turned on?

2016-11-30 10:41:43 -0500 received badge  Popular Question (source)
2016-11-30 06:41:03 -0500 commented answer How do I include the header?

but for some reason was it also looking for the pugixml.hpp, which makes sense it fails as it is not depending of the package that uses it. So i added pkg_a to the dependency list of the the other package, and that seemed to have fixed it. I am still confused on why it is looking for the header.