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

Miguel S.'s profile - activity

2021-02-01 05:36:03 -0500 received badge  Famous Question (source)
2018-07-04 02:55:10 -0500 received badge  Taxonomist
2014-08-14 08:21:40 -0500 received badge  Enthusiast
2014-08-13 12:02:44 -0500 received badge  Guru (source)
2014-08-13 12:02:44 -0500 received badge  Great Answer (source)
2014-08-07 07:52:17 -0500 received badge  Great Answer (source)
2014-08-07 07:52:17 -0500 received badge  Guru (source)
2014-07-24 01:18:04 -0500 received badge  Good Answer (source)
2014-06-26 03:45:50 -0500 received badge  Great Answer
2014-06-26 03:45:50 -0500 received badge  Guru
2014-02-15 14:20:46 -0500 received badge  Good Answer (source)
2014-01-28 17:31:10 -0500 marked best answer Python SimpleActionServer stops unexpectedly (deadlock!)

Hi all,

I'm writing a small piece of code that leverages actionlib, specifically SimpleActionServer. The main intricacy is that I register a preempt callback, but then I set_preempted on another thread (see code below).

However, when the rate of requests is relatively high (~1Hz) sometimes actionlib stops processings new requests. It does not crash, it does not print nor log anything, it just idles.

Below is a simplified version of my code:

class Node():

    def __init__(self):   
        self.server = actionlib.SimpleActionServer(
            "Topic", 
            Action,
            execute_cb=self.run,
            auto_start=False )

        #Variables so that preemption works
        self.myLock = threading.Lock()
        self.taskID = None

        #register preempt callbacks
        self.server.register_preempt_callback( self.stop )

        #Start actionlib
        self.server.start()


    def run(self, goal):      
        with self.myLock:
            self.taskID =  startTask() #Launch task in another thread

        #Wait for task to be completed or killed
        if not (self.taskID is None):
            wait( self.taskID ) #Wait for task to finish

        #Do not allow task to be preempted from now
        with self.myLock:
            self.taskID = None

        # Get actionlib result
        result = ActionResult()
        getResult(result)

        if not valid(result): #valid() defined elsewhere
            self.server.set_aborted( result )        
        elif self.server.is_preempt_requested() :
            self.server.set_preempted( result )
        else :
            self.server.set_succeeded( result )

        # Sometimes actionlib will stop processing new requests after this!!


    def stop( self ):
        with self.myLock:
            if ( not ( self.taskID is None ) and self.server.is_preempt_requested() ):
                killTask( self.taskID ) # Function defined elsewhere
                self.taskID = None

Am I using actionlib in an invalid way? Could this be an actionlib bug?

Thanks, Miguel S.

2014-01-28 17:30:07 -0500 marked best answer Set TF_CACHE_TIME with rospy

Hello!

I'm using a robotic (and ROSified!) wheelchair. One of the tasks I have to do is to transform a point from /base_link to /odom. Unsurprisingly, I use TF :)

However, when running the code below in Python:

tfListener.canTransform("/odom", base_link_point, rospy.Time(0) )

the function returns False quite often. I also transform from /base_link to /map (a longer chain) in another node and that works reliably.

I think the issue might be that tfListener doesn't have a big enough TF_CACHE_TIME, so I'd like to try and increase it. However the TF python documentation doesn't indicate how to do this.

I've also checked the source code and there's a call to override the argument in Transformer_init() but it's not clear to me how to do so or what are the other arguments for.

Any ideas?

2014-01-28 17:28:41 -0500 marked best answer Installing groovy from source fails

Hello!

I'm trying to install ros-groovy from source in an open-nao1.14 virtual machine (a gentoo derivative for NAO). The idea is to be able to then copy&paste the contents of /opt/ros/groovy and associated dependencies and have ROS working on an actual NAO.

After downloading ros-comm I execute (as per the instructions on the wiki )

./src/catkin/bin/catkin_make_isolated --install --install-space /opt/ros/groovy

But when the script calls make install installation fails because catkin's setup.py cannot recognise the option --install-layout=deb which the script is automatically adding. This is the exact error message:

+ /usr/bin/env PYTHONPATH=/opt/ros/groovy/lib/python2.7/dist-packages:/home/nao/ros/build_isolated/catkin/lib/python2.7/dist-packages:/opt/ros/groovy/lib/python2.7/dist-packages:/opt/ros/pydeps/lib/python2.7/site-packages/ CATKIN_BINARY_DIR=/home/nao/ros/build_isolated/catkin /usr/bin/python /home/nao/ros/src/catkin/setup.py build --build-base /home/nao/ros/build_isolated/catkin install --install-layout=deb --prefix=/opt/ros/groovy --install-scripts=/opt/ros/groovy/bin

usage: setup.py [global_opts] cmd1 [cmd1_opts] [cmd2 [cmd2_opts] ...]
   or: setup.py --help [cmd1 cmd2 ...]
   or: setup.py --help-commands
   or: setup.py cmd --help

error: option --install-layout not recognized
CMake Error at catkin_generated/safe_execute_install.cmake:4 (message):

  execute_process(/home/nao/ros/build_isolated/catkin/catkin_generated /python_distutils_install.sh)
  returned error code
Call Stack (most recent call first):
  cmake_install.cmake:115 (INCLUDE)

Any ideas on how to get it to compile?

Thanks!

Update: Here's the output of the commands requested.

Calling catkin's build & install command straight from python:

$ python setup.py build install --install-layout=deb
usage: setup.py [global_opts] cmd1 [cmd1_opts] [cmd2 [cmd2_opts] ...]
or: setup.py --help [cmd1 cmd2 ...]
or: setup.py --help-commands
or: setup.py cmd --help

error: option --install-layout not recognized

Python version:

$ /usr/bin/python --version
Python 2.7.2

Update 2: setup.py instructions

Common commands: (see '--help-commands' for more)

  setup.py build      will build the package underneath 'build/'
  setup.py install    will install the package

Global options:
  --verbose (-v)  run verbosely (default)
  --quiet (-q)    run quietly (turns verbosity off)
  --dry-run (-n)  don't actually do anything
  --help (-h)     show detailed help message
  --no-user-cfg   ignore pydistutils.cfg in your home directory

Options for 'install' command:
  --prefix            installation prefix
  --exec-prefix       (Unix only) prefix for platform-specific files
  --home              (Unix only) home directory to install under
  --user              install in user site-package
                  '/home/nao/.local/lib/python2.7/site-packages'
  --install-base      base installation directory (instead of --prefix or --
                  home)
  --install-platbase  base installation directory for platform-specific files
                  (instead of --exec-prefix or --home)
  --root              install everything relative to this alternate root
                  directory
  --install-purelib   installation directory for pure Python module
                  distributions
  --install-platlib   installation directory for non-pure module distributions
  --install-lib       installation directory for all module distributions
                  (overrides --install-purelib and --install-platlib)
  --install-headers   installation directory for C/C++ headers
  --install-scripts   installation directory for Python scripts
  --install-data      installation directory for data files
  --compile (-c)      compile .py to .pyc [default]
  --no-compile        don't compile .py files
  --optimize (-O)     also compile with optimization: -O1 for "python -O", -O2
                  for "python -OO", and -O0 ...
(more)
2014-01-28 17:28:10 -0500 marked best answer Gracefully stopping robot & roslaunch

Hi!

I am writing a ROS node that takes control of the NAO, and upon receiving a Ctrl+C (or rosnode kill) signal, puts the NAO back to its original position.

In order to do that nao_driver/nao_controller.py (another ROS node) must be running in the background.

The problem crops up when I put both my node and nao_controller in the same roslaunch file. Roslaunch immediately stops nao_controller and my node never has the opportunity of stopping gracefully (ie. going back to the original position).

I've checked the wiki and roslaunch does not seem to have any support for adding node dependencies.

I reckon this must be a fairly common issue (shutdown ordering) and that there must be some guidelines and best practices that I am not following.

Can anyone help?

Thanks!

2014-01-28 17:28:00 -0500 marked best answer Best approach for continuous blinking task

Hello!

I'm developping a small node that interfaces with nao_driver which is supposed to offer the user to start a blinking behaviour. The user is supposed to be able to turn on the behaviour and the stop it as needed.

I see two options:

  • Option 1) Create two services (eg. start_blinking and stop_blinking), and put the blinking code in a different thread.
  • Option 2) Use actionlib and then let the user preempt the task to stop it.

Which one is the recommended approach?

I guess it's irrelevant, but I'm coding this with rospy.

Thanks!

Miguel S.

2013-11-15 05:39:36 -0500 received badge  Good Answer (source)
2013-11-06 14:52:39 -0500 received badge  Good Answer
2013-09-26 11:31:53 -0500 received badge  Nice Answer
2013-09-18 07:11:31 -0500 received badge  Nice Answer (source)
2013-08-21 13:37:09 -0500 commented answer Problem running nao_driver on cross-compiled Nao

Nope, actionlib is a ROS core package and it should be installed on the robot. This looks like a bug we don't know about. Can you tell me what happens if you type roscd actionlib? Thanks!

2013-08-21 08:42:56 -0500 commented answer Problem running nao_driver on cross-compiled Nao

True, my bad. I forgot the binaries get installed somewhere else... I've updated the instructions.

2013-08-20 12:09:56 -0500 commented answer Problem running nao_driver on cross-compiled Nao

Just the util folder (the src folder should be there already!)

2013-08-19 12:51:19 -0500 commented answer Problem running nao_driver on cross-compiled Nao

NaoQi 1.14.x should be fine. The version it uses it's *not* 0.10 (it's 0.11). And the bug was fixed on a commit that's not included in your version. I would suggest you wait a bit till we release the proper version, but if you're in a hurry read the updated answer...

2013-08-19 06:43:17 -0500 answered a question Problem running nao_driver on cross-compiled Nao

Are you using the version provided with the binaries? Version 0.10 (which can be downloaded from here) shouldn't have that issue.

The version that ships with the NAO v4 binaries hasn't yet been released and the commit that fixes your issue was only merged a few days ago.

We're currently working on a official release. You can either wait for it to be ready (which will hopefully happen soon) try installing version 0.10 (though I suspect v0.10 is not going to mix well with the binary installation) or just run version 0.10 remotely.

Update

The actual issue is that the scripts under nao_driver/src/nao_driver/util don't get installed, if you're in a hurry you can hack it to work by downloading the latest devel version and copying them by hand, eg:

$> git clone -b devel 'https://github.com/miguelsdc/nao_robot.git'
$> cp -r nao_robot/nao_driver/src/nao_driver/util/ /opt/ros/groovy/lib/python2.7/dist-packages/nao_driver/

You may need to use sudo in front of the last command.

2013-08-19 02:38:10 -0500 received badge  Nice Answer (source)
2013-08-17 21:11:58 -0500 received badge  Great Answer (source)
2013-08-17 04:32:57 -0500 answered a question How to import ROS project C++ file into QT-Creator and compile them?

It's actually fairly easy to use QtCreator with ROS (I do it myself). This is a link that explains in more detail.

Briefly, you have to launch qtcreator from the terminal so that the program is aware of your environment variables ($PATH, $PYTHONPATH and so on...)

Once you've done that, go to File->Open Project and navigate to the CMakeLists.txt of your project (if you're using catkin that'd be /path/to/catkin_ws/src/CMakeLists.txt). QtCreator will then ask you to choose a build directory. Simply select the build directory inside the package (or /path/to/catkin_ws/build/ if using catkin). Finally tell QtCreator to run CMake, and voilà you're done!

2013-08-15 12:49:48 -0500 commented question Nao bottom camera image_raw problems
2013-08-15 12:47:22 -0500 commented question Webots version 7.1.2 problem with image_raw / Nao Robots / ROS

This looks like it could be a bug in nao_camera.py. Unfortunately I don't have webots to test it myself. You could try contacting some of the other developpers by posting on https://groups.google.com/forum/#!for... Hope that helps!