ros2 run line_follower line_follower
페이지 정보
본문
STELLA N1 SBC 버전: pi
REMOTE PC 버전: ubuntu 20.04
ROS 버전: foxy
안녕하세요 https://blog.naver.com/idea_robot/223202001154 진행중에 있는데 카메라 캘리브레이션 진행 후
ros2 run line_follower line_follower 진행 시 아래와 같이 오류가 발생하는데 해결방법이 있을까요 ?
jungjooyoo@jungjooyoo-B660M-HD3P:~/stella_ws$ ros2 run line_follower line_follower
Traceback (most recent call last):
File "/home/jungjooyoo/stella_ws/install/line_follower/lib/python3.8/site-packages/line_follower/line_follower.py", line 148, in process_image
self.left_fitx, self.left_fit = self.fit_from_lines(self.left_fit, cv_yellow_lane)
AttributeError: 'LineFollower' object has no attribute 'left_fit'
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "/home/jungjooyoo/stella_ws/install/line_follower/lib/line_follower/line_follower", line 33, in <module>
sys.exit(load_entry_point('line-follower==0.0.0', 'console_scripts', 'line_follower')())
File "/home/jungjooyoo/stella_ws/install/line_follower/lib/python3.8/site-packages/line_follower/line_follower.py", line 700, in main
rclpy.spin(node)
File "/opt/ros/foxy/lib/python3.8/site-packages/rclpy/__init__.py", line 191, in spin
executor.spin_once()
File "/opt/ros/foxy/lib/python3.8/site-packages/rclpy/executors.py", line 719, in spin_once
raise handler.exception()
File "/opt/ros/foxy/lib/python3.8/site-packages/rclpy/task.py", line 239, in __call__
self._handler.send(None)
File "/opt/ros/foxy/lib/python3.8/site-packages/rclpy/executors.py", line 429, in handler
await call_coroutine(entity, arg)
File "/opt/ros/foxy/lib/python3.8/site-packages/rclpy/executors.py", line 354, in _execute_subscription
await await_or_execute(sub.callback, msg)
File "/opt/ros/foxy/lib/python3.8/site-packages/rclpy/executors.py", line 118, in await_or_execute
return callback(*args)
File "/home/jungjooyoo/stella_ws/install/line_follower/lib/python3.8/site-packages/line_follower/line_follower.py", line 161, in process_image
self.left_fitx, self.left_fit = self.sliding_windown(cv_yellow_lane, 'left')
File "/home/jungjooyoo/stella_ws/install/line_follower/lib/python3.8/site-packages/line_follower/line_follower.py", line 441, in sliding_windown
midpoint = np.int(histogram.shape[0] / 2)
File "/home/jungjooyoo/.local/lib/python3.8/site-packages/numpy/__init__.py", line 305, in __getattr__
raise AttributeError(__former_attrs__[attr])
AttributeError: module 'numpy' has no attribute 'int'.
`np.int` was a deprecated alias for the builtin `int`. To avoid this error in existing code, use `int` by itself. Doing this will not modify any behavior and is safe. When replacing `np.int`, you may wish to use e.g. `np.int64` or `np.int32` to specify the precision. If you wish to review your current use, check the release note link for additional information.
The aliases was originally deprecated in NumPy 1.20; for more details and guidance see the original release note at:
https://numpy.org/devdocs/release/1.20.0-notes.html#deprecations
REMOTE PC 버전: ubuntu 20.04
ROS 버전: foxy
안녕하세요 https://blog.naver.com/idea_robot/223202001154 진행중에 있는데 카메라 캘리브레이션 진행 후
ros2 run line_follower line_follower 진행 시 아래와 같이 오류가 발생하는데 해결방법이 있을까요 ?
jungjooyoo@jungjooyoo-B660M-HD3P:~/stella_ws$ ros2 run line_follower line_follower
Traceback (most recent call last):
File "/home/jungjooyoo/stella_ws/install/line_follower/lib/python3.8/site-packages/line_follower/line_follower.py", line 148, in process_image
self.left_fitx, self.left_fit = self.fit_from_lines(self.left_fit, cv_yellow_lane)
AttributeError: 'LineFollower' object has no attribute 'left_fit'
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "/home/jungjooyoo/stella_ws/install/line_follower/lib/line_follower/line_follower", line 33, in <module>
sys.exit(load_entry_point('line-follower==0.0.0', 'console_scripts', 'line_follower')())
File "/home/jungjooyoo/stella_ws/install/line_follower/lib/python3.8/site-packages/line_follower/line_follower.py", line 700, in main
rclpy.spin(node)
File "/opt/ros/foxy/lib/python3.8/site-packages/rclpy/__init__.py", line 191, in spin
executor.spin_once()
File "/opt/ros/foxy/lib/python3.8/site-packages/rclpy/executors.py", line 719, in spin_once
raise handler.exception()
File "/opt/ros/foxy/lib/python3.8/site-packages/rclpy/task.py", line 239, in __call__
self._handler.send(None)
File "/opt/ros/foxy/lib/python3.8/site-packages/rclpy/executors.py", line 429, in handler
await call_coroutine(entity, arg)
File "/opt/ros/foxy/lib/python3.8/site-packages/rclpy/executors.py", line 354, in _execute_subscription
await await_or_execute(sub.callback, msg)
File "/opt/ros/foxy/lib/python3.8/site-packages/rclpy/executors.py", line 118, in await_or_execute
return callback(*args)
File "/home/jungjooyoo/stella_ws/install/line_follower/lib/python3.8/site-packages/line_follower/line_follower.py", line 161, in process_image
self.left_fitx, self.left_fit = self.sliding_windown(cv_yellow_lane, 'left')
File "/home/jungjooyoo/stella_ws/install/line_follower/lib/python3.8/site-packages/line_follower/line_follower.py", line 441, in sliding_windown
midpoint = np.int(histogram.shape[0] / 2)
File "/home/jungjooyoo/.local/lib/python3.8/site-packages/numpy/__init__.py", line 305, in __getattr__
raise AttributeError(__former_attrs__[attr])
AttributeError: module 'numpy' has no attribute 'int'.
`np.int` was a deprecated alias for the builtin `int`. To avoid this error in existing code, use `int` by itself. Doing this will not modify any behavior and is safe. When replacing `np.int`, you may wish to use e.g. `np.int64` or `np.int32` to specify the precision. If you wish to review your current use, check the release note link for additional information.
The aliases was originally deprecated in NumPy 1.20; for more details and guidance see the original release note at:
https://numpy.org/devdocs/release/1.20.0-notes.html#deprecations
- 이전글구동 에러 24.04.01
- 다음글git clone https://github.com/ntrexlab/STELLA_N2_CAM_LINE.git 빌드 문의 24.03.14
댓글목록
최고관리자님의 댓글
최고관리자 작성일
안녕하세요.
아이디어 로봇입니다.
첫 번째 에러 (AttributeError: 'LineFollower' object has no attribute 'left_fit') 의 경우
왼쪽 노란색 라인이 카메라에 잡히지 않아 라인을 찾을 수 없어 발생한 에러입니다.
해당 코드는 왼쪽 노란색 오른쪽 흰색의 라인이 있을 때 두 라인의 중앙을 따라가도록 만들어져 있습니다.
라인의 색은 코드에서 변경하실 수 있습니다.
시작 지점에서는 두 개의 라인이 보이는 상태에서 시작하여 주어야 해당 에러를 방지하실 수 있습니다.
두 번째 에러 (module 'numpy' has no attribute 'int'.) 는 numpy의 버전이 1.24.0 이상의 경우 np.int대신 int로 변경하여 주어야 한다는 내용입니다.
이 경우 코드에 사용된 np.int를 전부 int로 변경하시거나
pip install numpy==1.23.0 로 numpy버전을 변경하시면 해결될 것 입니다.