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

tolga-uni-lu's profile - activity

2021-04-29 03:38:16 -0500 marked best answer AttributeError: 'list' object has no attribute '...'

Hello, I created a subscriber node to get data from a topic. Topic broadcasts humans on the camera in a list called human_list. I want to read this data with below code. However when I rosrun it I get an error stating this

[ERROR] [1522830692.692015]: bad callback: <function callback at 0x7f7c0598aaa0>
Traceback (most recent call last):
  File "/opt/ros/kinetic/lib/python2.7/dist-packages/rospy/topics.py", line 750, in _invoke_callback cb(msg)
  File "/home/robolab3/catkin_ws/src/hand_raise_detector/scripts/armraiselistener.py", line 8, in callback
    x = human.body_key_points_with_prob.x
AttributeError: 'list' object has no attribute 'x'

rosmsg show openpose_ros_msgs/OpenPoseHumanList is as follows:

msgs/OpenPoseHumanList
  std_msgs/Header header
    uint32 seq
    time stamp
  string frame_id
  std_msgs/Header rgb_image_header
    uint32 seq
    time stamp
    string frame_id 
  int32 num_humans
  openpose_ros_msgs/OpenPoseHuman[] human_list
    int32 num_body_key_points_with_non_zero_prob
    openpose_ros_msgs/PointWithProb[18] body_key_points_with_prob
      float64 x
      float64 y
      float64 prob

My code to subscribe this topic is as follows. I appreciate your help to identify what about my code is wrong.

import rospy
from openpose_ros_msgs.msg import OpenPoseHumanList
def callback(msg):
  for human in msg.human_list:
      x = human.body_key_points_with_prob.x
      y = human.body_key_points_with_prob.y
      prob = human.body_key_points_with_prob.prob
      rospy.loginfo('x: {}, y: {}, prob: {}'.format(x, y, prob))
def armraiselistener():
 rospy.init_node('armraiselistener', anonymous=True)
 rospy.Subscriber("/openpose_ros/human_list", OpenPoseHumanList, callback)
 rospy.spin()
if __name__== '__main__':
 armraiselistener()
2020-01-29 17:48:55 -0500 received badge  Famous Question (source)
2020-01-29 17:48:55 -0500 received badge  Notable Question (source)
2019-03-24 00:01:24 -0500 received badge  Famous Question (source)
2019-02-19 05:54:26 -0500 received badge  Famous Question (source)
2018-11-04 18:08:24 -0500 received badge  Famous Question (source)
2018-08-22 12:47:37 -0500 received badge  Notable Question (source)
2018-07-09 02:40:00 -0500 received badge  Notable Question (source)
2018-06-18 09:38:12 -0500 received badge  Notable Question (source)
2018-06-18 09:38:12 -0500 received badge  Famous Question (source)
2018-06-18 09:38:12 -0500 received badge  Popular Question (source)
2018-06-01 03:52:38 -0500 received badge  Popular Question (source)
2018-06-01 03:31:40 -0500 marked best answer How properly install audio_common package?

Hello, My ros package uses audio_common package and even though I installed it with the command: sudo apt-get install ros-kinetic-audio_common I keep getting below warnings about soundplay.py. Please ignore the error in my log as it is another story.

odroid@QT05:~$ roslaunch rehabilitation_framework Exercise_Launcher.launch 
WARNING: Package name "robAPL" does not follow the naming conventions. It should start with a lower case letter and only contain lower case letters, digits, underscores, and dashes.
... logging to /home/odroid/.ros/log/a2e6ab5a-64a4-11e8-b054-6dc2e0f8cf5e/roslaunch-QT05-16257.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.
started roslaunch server http://192.168.100.1:38145/
SUMMARY
========
PARAMETERS
 * /rosdistro: kinetic
 * /rosversion: 1.12.13
NODES
  /
    rehabilitation_framework (rehabilitation_framework/Exercises.py)
    sound_play (sound_play/soundplay_node.py)
    wm_voice_generator (wm_voice_generator/wm_voice_component_short.py)
ROS_MASTER_URI=http://192.168.100.1:11311/
WARNING: Package name "robAPL" does not follow the naming conventions. It should start with a lower case letter and only contain lower case letters, digits, underscores, and dashes.
WARNING: Package name "robAPL" does not follow the naming conventions. It should start with a lower case letter and only contain lower case letters, digits, underscores, and dashes.
process[sound_play-1]: started with pid [16274]
process[wm_voice_generator-2]: started with pid [16275]
process[rehabilitation_framework-3]: started with pid [16276]
Traceback (most recent call last):
  File "/home/odroid/catkin_ws.tolga/src/rehabilitation_framework-working_demo_with_gui/src/Exercises.py", line 856, in <module>
    ros_motion_type = rosparam.get_param("/reha_exercise/motion_type")
  File "/opt/ros/kinetic/lib/python2.7/dist-packages/rosparam/__init__.py", line 214, in get_param
    return get_param_server().getParam(param)
  File "/opt/ros/kinetic/lib/python2.7/dist-packages/rosgraph/masterapi.py", line 206, in getParam
    return self._succeed(self.handle.getParam(self.caller_id, key))
  File "/opt/ros/kinetic/lib/python2.7/dist-packages/rosgraph/masterapi.py", line 154, in _succeed
    raise Error(msg)
rosgraph.masterapi.MasterError: Parameter [/reha_exercise/motion_type] is not set
================================================================================REQUIRED process [rehabilitation_framework-3] has died!
process has died [pid 16276, exit code 1, cmd /home/odroid/catkin_ws.tolga/src/rehabilitation_framework-working_demo_with_gui/src/Exercises.py __name:=rehabilitation_framework __log:=/home/odroid/.ros/log/a2e6ab5a-64a4-11e8-b054-6dc2e0f8cf5e/rehabilitation_framework-3.log].
log file: /home/odroid/.ros/log/a2e6ab5a-64a4-11e8-b054-6dc2e0f8cf5e/rehabilitation_framework-3*.log
Initiating shutdown!
================================================================================
[rehabilitation_framework-3] killing on exit
[wm_voice_generator-2] killing on exit
[sound_play-1] killing on exit
[WARN] [1527752949.115161]: Sound command issued, but no node is subscribed to the topic. Perhaps you forgot to run soundplay_node.py?
[WARN] [1527752950.116654]: Sound command issued, but no node is subscribed to the topic. Perhaps you forgot to run soundplay_node.py?
shutting down processing monitor...
... shutting down processing monitor complete
done
odroid@QT05:~$
2018-06-01 03:19:07 -0500 commented question How properly install audio_common package?

I see, so the problem is that it exits even though it is not told so.

2018-06-01 03:17:07 -0500 commented question How properly install audio_common package?

I see, so the problem is that it exits even though it is not told to so.

2018-06-01 02:33:13 -0500 commented question How properly install audio_common package?

These warnings: [WARN] [1527752949.115161]: Sound command issued, but no node is subscribed to the topic. Perhaps you f

2018-06-01 02:33:02 -0500 commented question How properly install audio_common package?

These warnings:

2018-05-31 05:05:44 -0500 asked a question How properly install audio_common package?

How properly install audio_common package? Hello, My ros package uses audio_common package and even though I installed i

2018-05-01 05:22:41 -0500 marked best answer Publishing a list, and echo its topic duplicate item problem

Hello, I publish to a list by looping through recognized people on camera. Even though 2 people display action 0 and action 1 respectively, topic either says they both display 0 or 1. Do you see what is wrong with it?

My code and topic echo is below:

def callback(self, msg):
    human_list_length = len(msg.human_list)
    self.publisher_msg.num_humans = human_list_length
    self.publisher_msg.gesture_list = [GestureDetectorHuman()] * human_list_length
    rospy.loginfo("Visible humans:" + str(human_list_length))
    for human in msg.human_list:
        ind = msg.human_list.index(human)
        rospy.loginfo("Gesture from Human: " + str(ind))
        self.publisher_msg.gesture_list[ind].human_index = ind
        # Check gesture published by current human and publish respective message
        if self.hand_raise(human):
            self.publisher_msg.gesture_list[ind].gesture = str(0)
        elif self.wait_a_minute(human):
            self.publisher_msg.gesture_list[ind].gesture = str(1)

rostopic echo output:

num_humans: 2 
gesture_list: 
  - 
    human_index: 1
    gesture: "0"
  - 
    human_index: 1
    gesture: "0"
--- 
num_humans: 2 
gesture_list: 
  - 
    human_index: 1
    gesture: "1"
  - 
    human_index: 1
    gesture: "1"
--- 
num_humans: 2 
gesture_list: 
  - 
    human_index: 1
    gesture: "0"
  - 
    human_index: 1
    gesture: "0"
--- 
num_humans: 2 
gesture_list: 
  - 
    human_index: 1
    gesture: "0"
  - 
    human_index: 1
    gesture: "0"
---
2018-04-24 12:04:42 -0500 commented answer Publishing a list, and echo its topic duplicate item problem

How does my way is different than List = [double] * 5. This just defines the type, buy you can change each element insid

2018-04-24 11:58:39 -0500 received badge  Popular Question (source)
2018-04-24 05:32:43 -0500 commented question Publishing a list, and echo its topic duplicate item problem

I can post the full code but its too long. The problem is message published is instead of adding new element inside for

2018-04-24 05:31:38 -0500 edited question Publishing a list, and echo its topic duplicate item problem

Publishing a list, and echo its topic duplicate item problem Hello, I publish to a list by looping through recognized pe

2018-04-24 04:16:17 -0500 edited question Publishing a list, and echo its topic duplicate item problem

Publishing a list, and echo its topic duplicate item problem Hello, I publish to a list by looping through recognized pe

2018-04-24 04:14:37 -0500 asked a question Publishing a list, and echo its topic duplicate item problem

Publishing a list, and echo its topic duplicate item problem Hello, I publish to a list by looping through recognized pe

2018-04-24 04:14:37 -0500 received badge  Taxonomist
2018-04-23 14:23:56 -0500 received badge  Famous Question (source)
2018-04-10 07:33:28 -0500 commented answer Roscd cannot find catkin_make 'd package

I solved it with going inside the catkin_ws/src/gesture_detector and executing catkin_create_package I did not need to c

2018-04-10 07:33:06 -0500 commented answer Roscd cannot find catkin_make 'd package

I solved it with going inside the catkin_ws/src/gesture_detector and executing catkin_create_package I did not need to c

2018-04-10 04:29:00 -0500 commented answer Roscd cannot find catkin_make 'd package

ERROR: cannot launch node of type [gesture_detector/gesture_listener.py]: gesture_detector ROS path [0]=/opt/ros/kineti

2018-04-10 04:28:46 -0500 commented answer Roscd cannot find catkin_make 'd package

ERROR: cannot launch node of type [gesture_detector/gesture_listener.py]: gesture_detector ROS path [0]=/opt/ros/kineti

2018-04-10 04:13:45 -0500 commented answer Roscd cannot find catkin_make 'd package

ERROR: cannot launch node of type [gesture_detector/gesture_listener.py]: gesture_detector ROS path [0]=/opt/ros/kinetic

2018-04-10 04:03:16 -0500 marked best answer Roscd cannot find catkin_make 'd package

I run ros kinetic on Ubuntu 16.04. I try to use openpose ros wrapper on my platform. I share the error log below. Best,

robolab3@robolab3-Inspiron-7566:~/catkin_ws$ catkin_make
Base path: /home/robolab3/catkin_ws
Source space: /home/robolab3/catkin_ws/src
Build space: /home/robolab3/catkin_ws/build
Devel space: /home/robolab3/catkin_ws/devel
Install space: /home/robolab3/catkin_ws/install
####
#### Running command: "make cmake_check_build_system" in "/home/robolab3/catkin_ws/build"
####
####
#### Running command: "make -j8 -l8" in "/home/robolab3/catkin_ws/build"
####
[  0%] Built target sensor_msgs_generate_messages_cpp
[  0%] Built target _image_recognition_msgs_generate_messages_check_deps_Recognitions
...
[ 92%] Built target image_recognition_msgs_generate_messages_eus
Scanning dependencies of target openpose_wrapper
[ 92%] Built target image_recognition_msgs_generate_messages
[ 94%] Building CXX object image_recognition/openpose_ros/CMakeFiles/openpose_wrapper.dir/src/openpose_wrapper_mock.cpp.o
[ 96%] Linking CXX shared library /home/robolab3/catkin_ws/devel/lib/libopenpose_wrapper.so
[ 96%] Built target openpose_wrapper
Scanning dependencies of target openpose_ros_node
[ 98%] Building CXX object image_recognition/openpose_ros/CMakeFiles/openpose_ros_node.dir/src/openpose_ros_node.cpp.o
[100%] Linking CXX executable /home/robolab3/catkin_ws/devel/lib/openpose_ros/openpose_ros_node
[100%] Built target openpose_ros_node
robolab3@robolab3-Inspiron-7566:~/catkin_ws$ roscd openpose_ros
roscd: No such package/stack 'openpose_ros'
robolab3@robolab3-Inspiron-7566:~/catkin_ws$ roslaunch openpose_ros_node
[openpose_ros_node] is not a launch file name
The traceback for the exception was written to the log file
robolab3@robolab3-Inspiron-7566:~/catkin_ws$
2018-04-10 04:03:15 -0500 commented answer Roscd cannot find catkin_make 'd package

Hello, I had this issue previously and solved it with the way you showed. Today I changed the name of my node to make it

2018-04-10 03:30:22 -0500 received badge  Notable Question (source)
2018-04-07 06:50:50 -0500 received badge  Notable Question (source)
2018-04-06 02:16:44 -0500 marked best answer Creating a launch file for running 3 separate nodes

Hello, I would like to activate 3 nodes of which I created 1. The other 2 are prebuilt nodes and each has a launch file. My nodes are as follows:

I want to create a launch file for this node coming after rosrun:

$ rosrun hand_raise_detector armraiselistener.py

The file should trigger below nodes coming after roslaunch:

$ roslaunch realsense_camera sr300_nodelet_rgbd.launch

$ roslaunch openpose_ros openpose_ros.launch

EDIT for solution:

<launch>
     <node pkg="hand_raise_detector" type="armraiselistener.py" name="armraiselistener" output="screen"/>
     <include file="/home/robolab3/catkin_ws/src/openpose_ros-master/openpose_ros/launch/openpose_ros.launch" />
     <include file="/home/robolab3/catkin_ws/src/realsense/realsense_camera/launch/sr300_nodelet_rgbd.launch" />
</launch>
2018-04-06 02:16:44 -0500 commented answer Creating a launch file for running 3 separate nodes

I posted working code in the answer. Thanks for the help!

2018-04-06 02:15:30 -0500 edited question Creating a launch file for running 3 separate nodes

Creating a launch file for running 3 separate nodes Hello, I would like to activate 3 nodes of which I created 1. The ot