Ask Your Question

r_kempf's profile - activity

2017-04-28 03:25:00 -0500 received badge  Stellar Question (source)
2017-04-28 03:24:59 -0500 received badge  Great Question (source)
2016-07-14 18:54:12 -0500 received badge  Good Question (source)
2015-09-23 08:54:22 -0500 received badge  Nice Question (source)
2015-01-20 09:38:26 -0500 received badge  Favorite Question (source)
2012-09-20 16:15:14 -0500 received badge  Famous Question (source)
2012-08-15 04:52:39 -0500 received badge  Famous Question (source)
2012-08-12 01:24:47 -0500 received badge  Notable Question (source)
2012-07-02 05:15:32 -0500 received badge  Notable Question (source)
2012-04-15 17:50:12 -0500 received badge  Popular Question (source)
2012-03-20 23:27:55 -0500 received badge  Popular Question (source)
2011-09-02 11:10:04 -0500 marked best answer start and stop rosbag within a python script

Ralf,

I'm just now playing around with actionlib, so I don't know if there are any other interactions, but I also recently wrote a node with starts recording data via rosbag and subprocess.Popen(). I've been ending the rosbag session with:

rosbag_proc = subprocess.Popen(...)
...
rosbag_proc.send_signal(subprocess.signal.SIGINT)

SIGINT is the same as "Ctrl-C" for Unix. It seems to end the rosbag process cleanly without adversely affecting my ROS node.

2011-07-27 10:00:17 -0500 commented answer start and stop rosbag within a python script
I tried it bevor by sending such a signal but it doesn't help.what are the parameters you give to Popen?
2011-07-25 05:59:25 -0500 asked a question start and stop rosbag within a python script

Hi,

I wrote an Action Server which gets all topics I want to record via the goal. Everything works fine until i want to stop rosbag. With my script i can start rosbag out of my script and i can see the bag-file which is generated. But when i want to kill the rosbag process out of my script, rosbag doesn't stop. It doesn't stop until i stop my whole ActionServer. But the action server should still run after stopping rosbag.

Here is the code I wrote: (the topic_logger.msg includes the goal, an id and an array of topics)

#! /usr/bin/env python

import roslib; roslib.load_manifest('topic_logger')
import rospy
import subprocess
import signal

import actionlib

import topic_logger.msg

class TopicLoggerAction(object):
# create messages that are used to publish feedback/result
_feedback = topic_logger.msg.topicLoggerFeedback()
_result = topic_logger.msg.topicLoggerResult()

def __init__(self, name):
    self._action_name = name
    self._as = actionlib.SimpleActionServer(self._action_name, topic_logger.msg.TopicLoggerAction, execute_cb = self.execute_cb)
    self._as.start()
    rospy.loginfo('Server is up')

def execute_cb(self, goal):
    if goal.ID == "topicLog":
        # decide whether recording should be started or stopped
        if goal.command == "start":
            #start to record the topics
            rospy.loginfo('now the topic recording should start')
            args = ""               
            for i in goal.selectedTopics:
                args = args + " " + i
            command = "rosbag record" + args
            self.p = subprocess.Popen(command, stdin=subprocess.PIPE, shell=True, cwd=dir_save_bagfile)
            rospy.loginfo(self.p.pid)
            # process = p
            # print p.stdout.read()
            # check if the goal is preempted    
            while 1:
                if self._as.is_preempt_requested():
                    rospy.loginfo('Logging is preempted')
                    self._as.set_preempted()
                    break

        elif goal.command == "stop":
            #stop to record the topics
            rospy.loginfo('now the topic recording should stop')
            #self.p.send_signal(signal.SIGTERM)
            rospy.loginfo(self.p.pid)
            killcommand = "kill -9 " + str(self.p.pid)
            rospy.loginfo(killcommand)
            self.k = subprocess.Popen(killcommand, shell=True)

            rospy.loginfo("I'm done")
            #while 1:
            #   if self._as.is_preempt_requested():
            #       rospy.loginfo('Logging is preempted')
            #       self._as.set_preempted()
            #       break

        else:
            rospy.loginfo('goal.command is not valid')
    else:
        rospy.loginfo('goal.ID is not valid')

if __name__ == '__main__':
rospy.init_node('topicLogger')
dir_save_bagfile = '/home/ker1pal/'
TopicLoggerAction(rospy.get_name())
rospy.spin()

Are there any ideas why I can't stop rosbag out of my script without killing my whole ActionServer ?

Thanks Ralf

2011-07-02 21:15:04 -0500 received badge  Student (source)
2011-07-01 11:37:43 -0500 marked best answer Problem picking items up in Gazebo with PR2

The gripper controller is not detecting stall due to gripper velocity jitter. Try adding these two lines to your aaai_lfd_simulator/launch/simulation_world.launch:

<!-- Set params for sim -->
<param name="r_gripper_controller/gripper_action_node/stall_velocity_threshold" value="0.01" type="double"/>
<param name="l_gripper_controller/gripper_action_node/stall_velocity_threshold" value="0.01" type="double"/>
2011-07-01 11:37:43 -0500 received badge  Scholar (source)
2011-07-01 11:37:41 -0500 received badge  Supporter (source)
2011-07-01 05:17:33 -0500 answered a question Problem picking items up in Gazebo with PR2

Here is a more precisely description of the problem and how to reproduce it:

I have problems with the action server for the gripperAction. If I close the gripper of a PR2 in Gazebo when grasping simulated objects the acion server doesn't return.

In my script the robot opens his gripper, then moves his arm to a simulated object and then closes his gripper. At that point he got stuck When closing the gripper, in my script (https://bosch-ros-pkg.svn.sourceforge.net/svnroot/bosch-ros-pkg/trunk/stacks/bosch_manipulation_utils/simple_robot_control/src/simple_robot_control/gripper.py) I call the method wait_for_result() on a SimpleActionClient (in the method execGripperCommand()). When calling this method he waits untill infinity.

I don't know why this happens but maybe you can have a look on it and figure out what the problem is. In Gazebo it seems that the robot wants to close the gripper completely but he can't because of the object.

To reproduce this failing you could install/watch my stuff at http://bosch-ros-pkg.svn.sourceforge.net/svnroot/bosch-ros-pkg/trunk/stacks/aaai_lfd_demo/.

You can get it run by following the instructions on http://www.ros.org/wiki/aaai_lfd_demo . Instead of launching the whole aaai_lfd_executive.launch (last step) you could also use: rosrun openloop_object_manipulation pick.py tea-box l 3 This shows the problem, that the robot gets stuck when grasping the object.

I think there is a problem with the action server, but I don't know what the problem is.

2011-07-01 05:14:32 -0500 commented question Problem picking items up in Gazebo with PR2
No just the PR2 freezes. I'm using my own world file and im launching a pr2 within my world.launch
2011-06-23 12:43:36 -0500 answered a question Problem picking items up in Gazebo with PR2

Edit:

The Tea-Box

<model:physical name="tea_box_model">
<xyz>   -0.1355  -1.138   0.9</xyz>
<rpy>   0.0    0.0    0.0</rpy>
<static>false</static> 
<body:box name="tea_box_body">
  <geom:box name="tea_box_geom">
    <mu1>1.5</mu1>
    <mu2>1.5</mu2>
    <mesh>default</mesh>
    <size>0.085 0.07 0.14</size>
    <mass> 0</mass>
    <visual>
      <size>0.085 0.07 0.14</size>
      <material>Gazebo/Red</material>
      <mesh>unit_box</mesh>
    </visual>
  </geom:box>
</body:box>
</model:physical>
2011-06-23 12:39:12 -0500 asked a question Problem picking items up in Gazebo with PR2

Hello,

I've set up my own world in Gazebo and now want the PR2 in the simulation grasp the items and pick them up. Therefore I have a script (script from aaai_lfd_demo: https://bosch-ros-pkg.svn.sourceforge... ) which moves the arm of the PR2 into the right position, opens the gripper, grasps the item, and should pick it up. But if the PR2 has grasped the item he freezes. He isn't able to pick it up. So what could be the problem? When using this script with an actual PR2, it works, so it has to be a problem with the Gazebo setup. I just launch my world, a PR2 and my script to move the robot. Here is the xml code of my object: (Are there maybe some parameters wrong?)

I also tried the pick up the coke_can from the PR2_Pick_and_Place_Demo from the pr2_simulator tutorials in my world, but it also doesn't work.

Thanks in advance!

Ralf Kempf