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

bajo's profile - activity

2019-01-17 07:50:44 -0500 received badge  Nice Question (source)
2017-11-16 10:37:09 -0500 received badge  Nice Question (source)
2015-08-05 09:23:39 -0500 received badge  Famous Question (source)
2015-08-05 09:23:39 -0500 received badge  Notable Question (source)
2015-07-22 08:06:30 -0500 received badge  Nice Question (source)
2015-03-11 12:12:01 -0500 marked best answer pass additional arguments into advertiseService

Hi,

is there a way to pass additional arguments into advertiseService ? When i use a Subscriber i can use boost::bind to pass arguments to the callback function. Like this:

ros::Subscriber sub = nh.subscribe<cob_people_detection::Commands> ("/tuw_acin_eva/voice_commands", 1, boost::bind(commandCallback, _1, &sensor_message_gateway_open_client));

Can i adapt this approach to make it work with advertiseService ? I tried it with this

ros::ServiceServer service = nh.advertiseService<tuw_acin_eva::VoiceCommands> ("process_voice_commands", boost::bind(processVoiceCommands, _1, &sensor_message_gateway_open_client));

but it does not work.


Edit: 1

Sorry for not including the complete error message. Here it is now.

[ rosmake ] Last 40 linesw_acin_eva: 4.6 sec ]                    [ 1 Active 50/51 Complete ]
{-------------------------------------------------------------------------------
  [ 57%] [ 57%] Built target rospack_gensrv_all
  Built target rosbuild_precompile
  make[3]: Entering directory `/home/bajo/workspace/tuw_acin_eva/build'
  make[3]: Entering directory `/home/bajo/workspace/tuw_acin_eva/build'
  make[3]: Entering directory `/home/bajo/workspace/tuw_acin_eva/build'
  make[3]: Leaving directory `/home/bajo/workspace/tuw_acin_eva/build'
  make[3]: Leaving directory `/home/bajo/workspace/tuw_acin_eva/build'
  [ 85%] [ 85%] Built target tuw_acin_eva_main
  Built target tuw_acin_eva_facefollower
  Scanning dependencies of target tuw_acin_eva_cob_control
  make[3]: Leaving directory `/home/bajo/workspace/tuw_acin_eva/build'
  make[3]: Entering directory `/home/bajo/workspace/tuw_acin_eva/build'
  [100%] Building CXX object CMakeFiles/tuw_acin_eva_cob_control.dir/nodes/tuw_acin_eva_people/src/tuw_acin_eva_cob_control.o
  In file included from /opt/ros/fuerte/include/ros/ros.h:45:0,
               from /home/bajo/workspace/tuw_acin_eva/nodes/tuw_acin_eva_people/src/tuw_acin_eva_cob_control.cpp:13:
  /opt/ros/fuerte/include/ros/node_handle.h: In member function ‘ros::ServiceServer ros::NodeHandle::advertiseService(const string&, const boost::function<bool(S&)>&, const VoidConstPtr&) [with S = tuw_acin_eva::VoiceCommands, std::string = std::basic_string<char>, ros::VoidConstPtr = boost::shared_ptr<const void>]’:
  /home/bajo/workspace/tuw_acin_eva/nodes/tuw_acin_eva_people/src/tuw_acin_eva_cob_control.cpp:288:181:   instantiated from here
  /opt/ros/fuerte/include/ros/node_handle.h:1087:5: error: no matching function for call to ‘ros::AdvertiseServiceOptions::initBySpecType(const string&, const boost::function<bool(tuw_acin_eva::VoiceCommands&)>&)’
  /opt/ros/fuerte/include/ros/node_handle.h:1087:5: note: candidate is:
  /opt/ros/fuerte/include/ros/advertise_service_options.h:104:8: note: template<class Spec> void ros::AdvertiseServiceOptions::initBySpecType(const string&, const typename Spec::CallbackType&)
  In file included from /usr/include/boost/bind.hpp:22:0,
               from /opt/ros/fuerte/include/ros/publisher.h:35,
               from /opt/ros/fuerte/include/ros/node_handle.h:32,
               from /opt/ros/fuerte/include/ros/ros.h:45,
               from /home/bajo/workspace/tuw_acin_eva/nodes/tuw_acin_eva_people/src/tuw_acin_eva_cob_control.cpp:13:
  /usr/include/boost/bind/bind.hpp: In member function ‘R boost::_bi::list2<A1, A2>::operator()(boost::_bi::type<R>, F&, A&, long int) [with R = bool, F = bool (*)(tuw_acin_eva::VoiceCommandsRequest_<std::allocator<void> >&, tuw_acin_eva::VoiceCommandsResponse_<std::allocator<void> >&), A = boost::_bi::list1<tuw_acin_eva::VoiceCommands&>, A1 = boost::arg<1>, A2 = boost::_bi::value<ros::ServiceClient*>]’:
  /usr/include/boost/bind/bind_template.hpp:32:59:   instantiated from ‘boost::_bi::bind_t<R, F, L>::result_type boost::_bi::bind_t<R, F, L>::operator()(A1&) [with A1 = tuw_acin_eva::VoiceCommands, R = bool, F = bool (*)(tuw_acin_eva::VoiceCommandsRequest_<std::allocator<void> >&, tuw_acin_eva::VoiceCommandsResponse_<std::allocator<void> >&), L = boost::_bi::list2<boost::arg<1>, boost::_bi::value<ros::ServiceClient*> >, boost ...
(more)
2015-03-11 12:12:01 -0500 received badge  Self-Learner (source)
2014-11-11 04:44:30 -0500 answered a question dynamic_reconfigure and catkin - is tutorial correct?

Are there any updates for this problem?

2014-10-10 02:14:16 -0500 received badge  Famous Question (source)
2014-09-23 06:11:27 -0500 received badge  Popular Question (source)
2014-09-22 10:54:43 -0500 answered a question multiple launch files lead to multiple log directories.

I thought so as well. But I think i found the problem now, thanks to gvdhoorn mentioning the run_id. It seems that we have the run_id in a parameter file which we load with roslaunch. This caused the second log directory. I removed the run_id from the parameter file now, but this file is sometimes created by our partners so i cann't make sure this does not happen again from time to time. Maybe there a way not to load the run_id parameter.

Anyway. Thank you gvdhoorn and dornhege for your help.

2014-09-22 05:13:11 -0500 asked a question multiple launch files lead to multiple log directories.

Hi,

i have multiple launch files which are started from a shell script after the booting of the computer which is on the robot. For some reason this creates multiple directories in $HOME/.ros/log. To find the correct logfiles if we have to debug something is kind of annoying as the files are in all of the directories and we have to check quite a few to find the file which has the newest data written into.

Is there a setting to set the log dir for all nodes? The ones started from roslaunch as well as the roscore which is started with the roscore command and the nodes with are running from rosrun.

thank you. bajo

2014-09-16 04:01:23 -0500 commented answer Subscribe to sensor_msgs/PointCloud

Thank you for this information. Good to know.

2014-09-15 09:33:32 -0500 answered a question Subscribe to sensor_msgs/PointCloud

Hi,

could it be that you are mixing up the PCL pointcloud data type with the one from sensor_msgs? See the definition of sensor_msgs/PointCloud [1] and you see that it is not pcl::PointCloud<pcl::pointxyz>.

[1] [http://docs.ros.org/api/sensor_msgs/html/msg/PointCloud.html](http://docs.ros.org/api/sensor_msgs/html/msg/PointCloud.html)

2014-07-26 17:41:21 -0500 received badge  Notable Question (source)
2014-07-26 17:41:21 -0500 received badge  Popular Question (source)
2014-07-17 12:40:09 -0500 answered a question Source Code Android APP

Hi,

i think you will find some useful information here. One of the tutorial apps is actually a publisher/subscriber and can be found here

I hope this gets you started.

bajo

2014-07-10 03:29:39 -0500 asked a question How to make rospy parameter server access thread safe?

Hi,

i know it is clearly stated here [1] that the parameter server methods are not thread safe. Up until now this never was a problem for me, but now it came up. Can anybody give me a hint on how to handle this and how to make my access to the parameter server thread safe.

Thanks,

bajo

[1] [http://wiki.ros.org/rospy/Overview/Parameter%20Server](http://wiki.ros.org/rospy/Overview/Parameter%20Server)

2014-07-07 06:57:06 -0500 received badge  Nice Answer (source)
2014-07-06 13:49:30 -0500 received badge  Famous Question (source)
2014-06-26 08:14:06 -0500 answered a question rospy service multiple argument

Hi,

i am not sure why you want two different services that perform the same function. Other than that i would do as you mentioned and include this data in the service definition (.srv file).

Edit:

When you look at the definition of the rospy services you can clearly see that there are no callback arguments expected. You can always use your Service definition in the .srv you are using to add a field like an string or int for the robot ID to be passed to the service call. For example you could take the AddTwoInts.srv

int64 a
int64 b
---
int64 sum

and modify it to look like this

int64 a
int64 b
int64 robotid
---
int64 sum

In your service callback you can than access this value and change the response message accordingly. For this you should rename the file, add it to the CMakeLists.txt in the package the .srv file is in and make a catkin_make to generate the needed include files.

2014-06-22 07:20:32 -0500 commented answer smach_ros.MonitorState callback receives empty userdata

Otherwise the userdata would not have passed to the next state. Nowadays I use the WaitForMsgState to retrieve data from a topic. You can find it on this page http://wiki.ros.org/executive_smach/AdditionalStateTypes

2014-06-18 00:57:25 -0500 received badge  Necromancer (source)
2014-05-14 04:33:17 -0500 received badge  Self-Learner (source)
2014-05-14 03:44:41 -0500 answered a question Unable to start roscore, Indigo on Ubuntu 14.04

I think i finally found the problem. A month ago I was playing around with a few vim plugins for python development. One of them seemed to place the file _thread.py at /usr/local/lib/python2.7/dist-packages/_thread.py. Through this it was available to python2.7 even though it was not meant to be used with it.

After I deleted the files /usr/local/lib/python2.7/dist-packages/_thread.py and /usr/local/lib/python2.7/dist-packages/_thread.pyc roscore is able to start without any problems.

Thank you joq for all your input and help on this matter. It is really nice to finally be able to use roscore again. :-)

2014-05-13 21:00:33 -0500 commented answer Unable to start roscore, Indigo on Ubuntu 14.04

No. Unfortunately not. Should python2.7 be able to import _thread ? On ubuntu12.04 python 2.7.3 can not import it, therefore ROS imports thread as _thread. But on ubuntu 14.04 python 2.7.6 is able to import it and therefore ROS uses the wrong module.

2014-05-12 05:54:47 -0500 commented answer Unable to start roscore, Indigo on Ubuntu 14.04

Edited the original question. Unfortunately it is so long that it hides behind the more... link.

2014-05-12 05:54:47 -0500 received badge  Commentator
2014-05-11 21:43:08 -0500 commented answer Unable to start roscore, Indigo on Ubuntu 14.04

Strange. That is the exact same version i have installed. Just checked and reinstalled this version from the repository. Can you tell me what how the import of thread looks like in the file /opt/ros/indigo/lib/python2.7/dist-packages/rosgraph/xmlrpc.py

2014-05-11 08:24:00 -0500 received badge  Famous Question (source)
2014-05-10 22:10:53 -0500 commented question Unable to start roscore, Indigo on Ubuntu 14.04

echo $PYTHONPATH /opt/ros/indigo/lib/python2.7/dist-packages echo $ROS_PACKAGE_PATH /opt/ros/indigo/share:/opt/ros/indigo/stacks echo $CMAKE_PREFIX_PATH /opt/ros/indigo

2014-05-10 22:09:54 -0500 received badge  Enthusiast
2014-05-10 05:31:45 -0500 commented question Unable to start roscore, Indigo on Ubuntu 14.04

ls -l /usr/bin/python lrwxrwxrwx 1 root root 9 Apr 5 17:23 /usr/bin/python -> python2.7*

2014-05-10 00:24:42 -0500 commented question Unable to start roscore, Indigo on Ubuntu 14.04

I think it is not a problem with my ROS environment. I can even import _thread in my python2 interpreter, which is of course independent from ROS. Also in my edited post i have both versions. The hand-built as well as the on from the repository.

2014-05-08 23:49:37 -0500 received badge  Notable Question (source)
2014-05-08 21:29:35 -0500 commented question Unable to start roscore, Indigo on Ubuntu 14.04

Thank you joq for your answer. Unfortunately the result is the same. I edited my original post to include the output from roscore which was installed from the repository. Can you please tell me which versions of python (2 and 3) you have installed on your system and what system you are running? Thank you.

2014-05-07 13:46:15 -0500 received badge  Popular Question (source)
2014-05-06 23:43:34 -0500 asked a question Unable to start roscore, Indigo on Ubuntu 14.04

Hi,

i recently tried to use Indigo on my notebook (Lenovo T440s). I tried the Install from source as well es the Install from repository methods to install a basic ROS Indigo. As long as i do not need to start a roscore on this machine pretty much everything works as expected. Connections to other machines, robots with roscore running work just fine.

As soon as i want to run a roscore it receive the following error:

./install_isolated/bin/roscore                                                                                                                                     :(
... logging to /home/bajo/.ros/log/a54a89fe-d5bd-11e3-9fec-28d244198e8b/roslaunch-roscosmos-3532.log
Checking log directory for disk usage. This may take awhile.
Press Ctrl-C to interrupt
Done checking log file disk usage. Usage is <1GB.

Traceback (most recent call last):
  File "/home/bajo/work/development/indigo/install_isolated/lib/python2.7/dist-packages/roslaunch/__init__.py", line 279, in main
    p.start()
  File "/home/bajo/work/development/indigo/install_isolated/lib/python2.7/dist-packages/roslaunch/parent.py", line 257, in start
    self._start_infrastructure()
  File "/home/bajo/work/development/indigo/install_isolated/lib/python2.7/dist-packages/roslaunch/parent.py", line 215, in _start_infrastructure
    self._start_server()
  File "/home/bajo/work/development/indigo/install_isolated/lib/python2.7/dist-packages/roslaunch/parent.py", line 166, in _start_server
    self.server.start()
  File "/home/bajo/work/development/indigo/install_isolated/lib/python2.7/dist-packages/roslaunch/server.py", line 352, in start
    super(ROSLaunchNode, self).start()
  File "/home/bajo/work/development/indigo/install_isolated/lib/python2.7/dist-packages/rosgraph/xmlrpc.py", line 199, in start
    _thread.start_new_thread(self.run, ())
AttributeError: 'module' object has no attribute 'start_new_thread'

The same problem arises when i use the installation from the repository. The error messages just differ in terms of the paths.

source /opt/ros/indigo/setup.zsh                                                                        :(
bajo@roscosmos ~ % roscore                         
... logging to /home/bajo/.ros/log/e287ee68-d74a-11e3-ad4f-28d244198e8b/roslaunch-roscosmos-3568.log
Checking log directory for disk usage. This may take awhile.
Press Ctrl-C to interrupt
Done checking log file disk usage. Usage is <1GB.

Traceback (most recent call last):
  File "/opt/ros/indigo/lib/python2.7/dist-packages/roslaunch/__init__.py", line 279, in main
    p.start()
  File "/opt/ros/indigo/lib/python2.7/dist-packages/roslaunch/parent.py", line 257, in start
    self._start_infrastructure()
  File "/opt/ros/indigo/lib/python2.7/dist-packages/roslaunch/parent.py", line 215, in _start_infrastructure
    self._start_server()
  File "/opt/ros/indigo/lib/python2.7/dist-packages/roslaunch/parent.py", line 166, in _start_server
    self.server.start()
  File "/opt/ros/indigo/lib/python2.7/dist-packages/roslaunch/server.py", line 352, in start
    super(ROSLaunchNode, self).start()
  File "/opt/ros/indigo/lib/python2.7/dist-packages/rosgraph/xmlrpc.py", line 199, in start
    _thread.start_new_thread(self.run, ())
AttributeError: 'module' object has no attribute 'start_new_thread'

As operating system i use Ubuntu 14.04 64bit and i have installed python 2.7 and 3.4. I am not sure if i installed both of them manually or if Ubuntu did this on its own. But the problem seems to happen because in /home/bajo/work/development/indigo/install_isolated/lib/python2.7/dist-packages/rosgraph/xmlrpc.py we try to import _thread and if this fails import ... (more)