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

ebaumert's profile - activity

2020-05-17 12:58:20 -0500 received badge  Taxonomist
2019-04-04 22:46:41 -0500 received badge  Student (source)
2017-03-23 21:36:18 -0500 received badge  Famous Question (source)
2016-08-17 10:52:33 -0500 received badge  Notable Question (source)
2016-08-17 10:52:33 -0500 received badge  Popular Question (source)
2016-05-12 04:05:12 -0500 asked a question Trouble with python nodes in launchfile

Hi everyone!

I am trying to start some additional nodes together with the minimal.launch file, so I made the following additions for my nodes.

I sourced the devel/setup.bash file so the package can be found and made sure the py files are executable using chmod +x. Nonetheless, when I try to run the launch file, I get the following errors. It does seem quite generic to me, has someone experienced this before and has an idea?

Thank you!

The lines I added:

  <node name="webcam_pub" pkg="webcam_pub" type="webcam_pub.py" />
  <node name="pos_pub" pkg="stop_snap" type="pos_pub.py" />
  <node name="go_to_goal_v5" pkg="stop_snap" type="go_to_goal_v5.py" />

What I get as output in the console (log files are empty).

process[webcam_pub-14]: started with pid [6036]
: No such file or directory
failed to start local process: /home/turtlebot/library_ws/src/stop_snap/src/pos$
local launch of stop_snap/pos_pub.py failed
[pos_pub-15] process has died [pid -1, exit code 127, cmd /home/turtlebot/libra$
log file: /home/turtlebot/.ros/log/69123a30-181f-11e6-bce9-54353050d249/pos_pub$
process[go_to_goal_v5-16]: started with pid [6061]
2016-05-09 23:38:01 -0500 received badge  Famous Question (source)
2016-04-19 08:34:28 -0500 received badge  Notable Question (source)
2016-04-19 08:34:28 -0500 received badge  Famous Question (source)
2016-03-07 07:36:51 -0500 received badge  Notable Question (source)
2016-02-23 07:52:44 -0500 answered a question Localizing turtlebot programmatically via initialpose topic

What eventually made it work was suggested by michaelyuan1 in the following thread. I have the node sleep for two seconds and republish the position to the initialpose topic. Also I removed the following line start_pos.header.stamp = rospy.Time.now()

Hope it will continue working.

2016-02-22 11:43:45 -0500 commented question Localizing turtlebot programmatically via initialpose topic

I noticed a slight mistake as start_pos.pose.covariance[8:34] should be start_pos.pose.covariance[8:35]. But the message published does not change and even with AMCL running...nothing happens. Does running RVIZ maybe prevent the node from working?

2016-02-20 10:07:07 -0500 received badge  Popular Question (source)
2016-02-19 11:58:28 -0500 asked a question Localizing turtlebot programmatically via initialpose topic

Hi!

I am trying to build a node that localizes the turtlebot in my map so I not have to use the RVIZ GUI which is really laggy for me. Thus I did it once, took the values from the initialpose topic and now publish it as suggested in [this older thread].(http://answers.ros.org/question/9686/how-to-programatically-set-the-2d-pose-on-a-map/)

This is what I have - it successfully publishes an exact copy in the correct topic as expected - but the turtlebot does not seem to accept it. Also the location in RVIZ is not updated when running it in parallel to check whether something changed. Maybe someone has an idea why this is? Thank you very much in advance!

#!/usr/bin/env python
import rospy
from geometry_msgs.msg import PoseWithCovarianceStamped

def initial_pos_pub():
    publisher = rospy.Publisher('initialpose', PoseWithCovarianceStamped, queue_size=10)
    rospy.init_node('initial_pos_pub', anonymous=True)
    #Creating the message with the type PoseWithCovarianceStamped
    rospy.loginfo("This node sets the turtlebot's position to the red cross on the floor. It will shudown after publishing to the topic /initialpose")
    start_pos = PoseWithCovarianceStamped()
    #filling header with relevant information
    start_pos.header.frame_id = "map"
    start_pos.header.stamp = rospy.Time.now()
    #filling payload with relevant information gathered from subscribing
    # to initialpose topic published by RVIZ via rostopic echo initialpose
    start_pos.pose.pose.position.x = -0.846684932709
    start_pos.pose.pose.position.y = 0.333061099052
    start_pos.pose.pose.position.z = 0.0

    start_pos.pose.pose.orientation.x = 0.0
    start_pos.pose.pose.orientation.y = 0.0
    start_pos.pose.pose.orientation.z = -0.694837665627
    start_pos.pose.pose.orientation.w = 0.719166613815

    start_pos.pose.covariance[0] = 0.25
    start_pos.pose.covariance[7] = 0.25
    start_pos.pose.covariance[1:7] = [0.0, 0.0, 0.0, 0.0, 0.0, 0.0] 
    start_pos.pose.covariance[8:34] = [0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 
    0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0] 
    start_pos.pose.covariance[35] = 0.06853891945200942

    rospy.loginfo(start_pos)
    publisher.publish(start_pos)

if __name__ == '__main__':
    try:
        initial_pos_pub()
    except rospy.ROSInterruptException:
        pass

And the published message reads as follows:

header: 
  seq: 0
  stamp: 
    secs: 1455903671
    nsecs: 170355081
  frame_id: map
pose: 
  pose: 
    position: 
      x: -0.846684932709
      y: 0.333061099052
      z: 0.0
    orientation: 
      x: 0.0
      y: 0.0
      z: -0.694837665627
      w: 0.719166613815
  covariance: [0.25, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.25, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.06853891945200942]
2016-02-17 07:50:55 -0500 received badge  Popular Question (source)
2016-02-17 07:18:31 -0500 commented answer Trouble converting cv2 to imgmsg

Thank you very much, I must have overlooked the instantiation!

2016-02-17 07:17:28 -0500 received badge  Supporter (source)
2016-02-17 06:55:11 -0500 received badge  Scholar (source)
2016-02-16 11:41:17 -0500 asked a question Trouble converting cv2 to imgmsg

Hi everyone,

I am trying to write a python node that publishes single frames the attached webcam records. However, when I try to run it I get the following error message.

VIDIOC_QUERYMENU: Invalid argument
VIDIOC_QUERYMENU: Invalid argument
VIDIOC_QUERYMENU: Invalid argument
VIDIOC_QUERYMENU: Invalid argument
VIDIOC_QUERYMENU: Invalid argument
VIDIOC_QUERYMENU: Invalid argument
VIDIOC_QUERYMENU: Invalid argument
Traceback (most recent call last):
  File "/home/x/catkin_ws/src/webcam_pub/webcam_pub/src/webcam_pub.py", line 34, in <module>
    webcam_pub()
  File "/home/x/catkin_ws/src/webcam_pub/webcam_pub/src/webcam_pub.py", line 23, in webcam_pub
    msg = cv2_to_imgmsg(frame, encoding="bgr8")
NameError: global name 'cv2_to_imgmsg' is not defined

I do not understand why I cannot call the cv2_to_imgmsg function as defined here.

Help would be appreciated - my node looks as follows.

#!/usr/bin/env python

import rospy
from sensor_msgs.msg import Image
import cv2
import numpy as np
from cv_bridge import CvBridge, CvBridgeError

def webcam_pub():
 pub = rospy.Publisher('webcam/image_raw', Image, queue_size=1)
 rospy.init_node('webcam_pub', anonymous=True)
 rate = rospy.Rate(60) # 60hz

 cam = cv2.VideoCapture(0)

 if not cam.isOpened():
  sys.stdout.write("Webcam is not available")
  return -1

 while not rospy.is_shutdown():
  ret, frame = cam.read()
  msg = cv2_to_imgmsg(frame, encoding="bgr8")

  if ret:
   rospy.loginfo("Capturing image failed.")

  pub.publish(msg)
  rate.sleep()


if __name__ == '__main__':
 try:
  webcam_pub()
 except rospy.ROSInterruptException:
  pass