NAN and e communication issues
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-avoidance-turtlebot/blob/master/src/naive_obs_avoid_tb3.py https://github.com/ros-teleop/teleop_twist_keyboard/blob/master/teleop_twist_keyboard.py
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/catkinws/src/teleoptwistkeyboard/teleoptwist_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 teleoptwistkeyboard teleoptwistkeyboard.py
------------------------------------------- Traceback (most recent call last):
File "/home/kevinko/catkinws/src/teleoptwistkeyboard/teleoptwistkeyboard.py",
line 135, in
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.
Asked by kak13 on 2021-03-04 09:50:08 UTC
Comments
Do you think twist() is the issue?
Asked by kak13 on 2021-03-05 20:35:18 UTC