NAN and e communication issues [closed]

asked 2021-03-04 08:50:08 -0500

kak13 gravatar image

Hi,

So, I wanted to experiment and learn as much as I can from two codes to use lidar in gazebo. I merged them together https://github.com/enansakib/obstacle... https://github.com/ros-teleop/teleop_...

Somehow, I kept facing this issues. Here is the code: https://pastebin.com/KHxZcFnF

The issue is that I kept receiving the output: File "/home/kevinko/catkin_ws/src/teleop_twist_keyboard/teleop_twist_keyboard.py", line 96, in callback print 'Range data at 0 deg: {}'.format(dt.ranges[0]) AttributeError: 'float' object has no attribute 'ranges'

but then when I enter it again, the code worked FOR ONCE and back to issues;

kevinko2@kevinko2-ubu:~$ rosrun teleop_twist_keyboard teleop_twist_keyboard.py ------------------------------------------- Traceback (most recent call last):
File "/home/kevinko/catkin_ws/src/teleop_twist_keyboard/teleop_twist_keyboard.py", line 135, in <module> updated = callback(data) File "/home/kevinko/catkin_ws/src/teleop_twist_keyboard/teleop_twist_keyboard.py", line 96, in callback print 'Range data at 0 deg: {}'.format(dt.ranges[0]) AttributeError: 'float' object has no attribute 'ranges'

Range data at 0 deg: 3.5 Range data at 15 deg: 3.49427270889 Range data at 345 deg: 0.949376046658 kevinko2@kevinko2-ubu:~$

So that made me realized, the output must be been display as 'NaN'. How do I fix that? I tried to use Numpy Python, but it doesn't do what I want. It requires an array and I don't use any array in this code.

As for e communication, you can see I commented that out. Before I comment it out, it simply says the communication failed. How do I troubleshoot that one?

Extra information: 1) I am on 14.04 Ubuntu 2) I am on Indigo and 2.7 Python. (Soon, I will move to newest ROS and 3.9 python) 3) I started ROS 3 weeks ago. I've been following tutorials so far and it worked. When I tried to do something like merge and do the code like this code. It slaps me. 4) I'm Java programmer. Python is my new field at the moment.

Truly thank you for your time and efforts.

edit retag flag offensive reopen merge delete

Closed for the following reason question is off-topic or not relevant. Please see http://wiki.ros.org/Support for more details. by kak13
close date 2021-08-24 17:32:29.967209

Comments

Do you think twist() is the issue?

kak13 gravatar image kak13  ( 2021-03-05 19:35:18 -0500 )edit