Search code examples
pythonpython-3.xcameraroscamera-calibration

ROS Camera Calibrator Errors Out


I have ROS installed on a Ubuntu 20.04 running ros_core and a Raspberry Pi running a camera node. I tried to run rosrun camera_calibration cameracalibrator.py --size 8x6 --square 0.108 image:=/cv_camera/image camera:=/cv_camera I get the following error:

Traceback (most recent call last):
  File "/opt/ros/noetic/lib/camera_calibration/cameracalibrator.py", line 37, in <module>
    import message_filters
  File "/opt/ros/noetic/lib/python3/dist-packages/message_filters/__init__.py", line 35, in <module>
    import rospy
  File "/opt/ros/noetic/lib/python3/dist-packages/rospy/__init__.py", line 49, in <module>
    from .client import spin, myargv, init_node, \
  File "/opt/ros/noetic/lib/python3/dist-packages/rospy/client.py", line 60, in <module>
    import rospy.impl.init
  File "/opt/ros/noetic/lib/python3/dist-packages/rospy/impl/init.py", line 54, in <module>
    from .tcpros import init_tcpros
  File "/opt/ros/noetic/lib/python3/dist-packages/rospy/impl/tcpros.py", line 45, in <module>
    import rospy.impl.tcpros_service
  File "/opt/ros/noetic/lib/python3/dist-packages/rospy/impl/tcpros_service.py", line 54, in <module>
    from rospy.impl.tcpros_base import TCPROSTransport, TCPROSTransportProtocol, \
  File "/opt/ros/noetic/lib/python3/dist-packages/rospy/impl/tcpros_base.py", line 160
    (e_errno, msg, *_) = e.args
                   ^
SyntaxError: invalid syntax

I installed python2 and python2-dev via apt and then installed pip via the get-pip.py. Then I ran pip install pyyaml opencv-python to install the dependencies required by the calibrator. I tried to run it with python3 before I installed python2 but I think it requires python2. What should I do. I have the camera publishing all the right topics. Also, I only see a black and white screen when I run rosrun rqt_image_view rqt_image_view. Please help!


Solution

  • You have to find the calibrator file which is under /opt/ros/noetic/lib/camera_calibration/cameracalibrator.py and then run it manually.