Docker 套接字问题:“OSError:[Errno 99] 无法分配请求的地址”

问题描述 投票:0回答:1

我正在运行来自 this git 的代码,该代码旨在使用 ROS1 noetic 与 Texas Instruments 的雷达和评估板进行通信。

我正在 Docker 容器内的 Windows 设备上运行存储库,该容器来自 ROS:noetic 映像。

当我从链接启动ros节点时,出现以下错误:

root@docker-desktop:~/catkin_ws# roslaunch mmWave radar_rd_fft_viz.launch
WARNING: Package name "mmWave" 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 /root/.ros/log/6dc0f760-4297-11ee-96bb-1e0fc3d54455/roslaunch-docker-desktop-2394.log
Checking log directory for disk usage. This may take a while.
Press Ctrl-C to interrupt
Done checking log file disk usage. Usage is <1GB.

started roslaunch server http://docker-desktop:36545/

SUMMARY
========

PARAMETERS
 * /rosdistro: noetic
 * /rosversion: 1.16.0

NODES
  /
    xwr1xxx (mmWave/no_Qt.py)
    xwr1xxx_rd_viz (mmWave/fft_viz.py)

ROS_MASTER_URI=http://localhost:11311

WARNING: Package name "mmWave" 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[xwr1xxx-1]: started with pid [2415]
process[xwr1xxx_rd_viz-2]: started with pid [2416]
Traceback (most recent call last):
  File "/root/catkin_ws/src/mmWave/scripts/no_Qt.py", line 74, in <module>
    mmwave_sensor = mmWave_Sensor(iwr_cmd_tty=args.cmd_tty)
  File "/root/catkin_ws/src/mmWave/scripts/mmWave_class_noQt.py", line 60, in __init__
    self.data_socket.bind(("192.168.33.30", 4098))
OSError: [Errno 99] Cannot assign requested address
================================================================================REQUIRED process [xwr1xxx-1] has died!
process has died [pid 2415, exit code 1, cmd /root/catkin_ws/src/mmWave/scripts/no_Qt.py --cmd_tty /dev/tty/ACM0 14xx/indoor_human_rcs __name:=xwr1xxx __log:=/root/.ros/log/6dc0f760-4297-11ee-96bb-1e0fc3d54455/xwr1xxx-1.log].
log file: /root/.ros/log/6dc0f760-4297-11ee-96bb-1e0fc3d54455/xwr1xxx-1*.log
Initiating shutdown!
================================================================================
[xwr1xxx_rd_viz-2] killing on exit
[xwr1xxx-1] killing on exit
shutting down processing monitor...
... shutting down processing monitor complete
done

根据代码中的说明,我已将我的 PC IP 地址设为静态,并且它也尝试绑定该地址。雷达通过以太网连接到笔记本电脑,并具有固定的 IP 地址。我已经尝试 ping 这个 IP 地址,但它不起作用,这应该起作用吗?

导致错误的代码如下所示:

#!/usr/bin/env python
# license removed for brevity
import rospy
from std_msgs.msg import String
import os
import time
import sys
import socket
import serial
import pdb
import struct
import numpy as np
# import RadarRT_lib
from circular_buffer import ring_buffer
try: 
    import queue
except ImportError:
    import Queue as queue
from  ctypes import *
from radar_config import dict_to_list


class mmWave_Sensor():
    iwr_rec_cmd = ['sensorStop', 'sensorStart']
    # dca1000evm configuration commands; only the ones used are filled in
    # TODO: hardcoded comand values should be changed
    dca_cmd = { \
        'RESET_FPGA_CMD_CODE'               : b"", \
        'RESET_AR_DEV_CMD_CODE'             : b"", \
        'CONFIG_FPGA_GEN_CMD_CODE'          : b"\x5a\xa5\x03\x00\x06\x00\x01\x01\x01\x02\x03\x1e\xaa\xee", \
        'CONFIG_EEPROM_CMD_CODE'            : b"", \
        'RECORD_START_CMD_CODE'             : b"\x5a\xa5\x05\x00\x00\x00\xaa\xee", \
        'RECORD_STOP_CMD_CODE'              : b"\x5a\xa5\x06\x00\x00\x00\xaa\xee", \
        'PLAYBACK_START_CMD_CODE'           : b"", \
        'PLAYBACK_STOP_CMD_CODE'            : b"", \
        'SYSTEM_CONNECT_CMD_CODE'           : b"\x5a\xa5\x09\x00\x00\x00\xaa\xee", \
        'SYSTEM_ERROR_CMD_CODE'             : b"\x5a\xa5\x0a\x00\x01\x00\xaa\xee", \
        'CONFIG_PACKET_DATA_CMD_CODE'       : b"\x5a\xa5\x0b\x00\x06\x00\xc0\x05\xc4\x09\x00\x00\xaa\xee", \
        'CONFIG_DATA_MODE_AR_DEV_CMD_CODE'  : b"", \
        'INIT_FPGA_PLAYBACK_CMD_CODE'       : b"", \
        'READ_FPGA_VERSION_CMD_CODE'        : b"\x5a\xa5\x0e\x00\x00\x00\xaa\xee", \
    }

    dca_cmd_addr = ('192.168.33.180', 4096)
    dca_socket = None
    data_socket = None
    iwr_serial = None

    dca_socket_open = False
    data_socket_open = False
    serial_open = False

    capture_started = 0

    data_file = None

    def __init__(self, iwr_cmd_tty='/dev/ttyACM0', iwr_data_tty='/dev/ttyACM1'):

        self.data_socket = socket.socket(socket.AF_INET, socket.SOCK_DGRAM)
        self.data_socket.bind(("192.168.33.30", 4098))
        self.data_socket.settimeout(25e-5)
        #self.data_socket.setblocking(True)
        self.data_socket_open = True

        self.seqn = 0  # this is the last packet index
        self.bytec = 0 # this is a byte counter
        self.q = Queue.Queue()
        frame_len = 2*rospy.get_param('iwr_cfg/profiles')[0]['adcSamples']*rospy.get_param('iwr_cfg/numLanes')*rospy.get_param('iwr_cfg/numChirps')
        self.data_array = ring_buffer(int(2*frame_len), int(frame_len))


        self.iwr_cmd_tty=iwr_cmd_tty
        self.iwr_data_tty=iwr_data_tty

任何帮助将不胜感激!

提前谢谢您

编辑:添加网络配置信息:

从 Windows 设备:

Windows IP Configuration


Ethernet adapter vEthernet (Default Switch):

   Connection-specific DNS Suffix  . :
   Link-local IPv6 Address . . . . . : fe80::9405:9c7c:b786:3535%41
   IPv4 Address. . . . . . . . . . . : 172.19.32.1
   Subnet Mask . . . . . . . . . . . : 255.255.240.0
   Default Gateway . . . . . . . . . :

Ethernet adapter Ethernet 4:

   Connection-specific DNS Suffix  . :
   Link-local IPv6 Address . . . . . : fe80::5e5d:c3bb:233c:6616%2
   IPv4 Address. . . . . . . . . . . : 192.168.33.30
   Subnet Mask . . . . . . . . . . . : 255.255.255.0
   Default Gateway . . . . . . . . . :

Wireless LAN adapter Local Area Connection* 9:

   Media State . . . . . . . . . . . : Media disconnected
   Connection-specific DNS Suffix  . :

Wireless LAN adapter Local Area Connection* 10:

   Media State . . . . . . . . . . . : Media disconnected
   Connection-specific DNS Suffix  . :

Wireless LAN adapter WiFi:

   Connection-specific DNS Suffix  . :
   Link-local IPv6 Address . . . . . : fe80::b46c:2cb5:f160:cc85%20
   IPv4 Address. . . . . . . . . . . : 192.168.0.35
   Subnet Mask . . . . . . . . . . . : 255.255.255.0
   Default Gateway . . . . . . . . . : 192.168.0.1

Ethernet adapter Bluetooth Network Connection:

   Media State . . . . . . . . . . . : Media disconnected
   Connection-specific DNS Suffix  . :

Ethernet adapter vEthernet (WSL):

   Connection-specific DNS Suffix  . :
   Link-local IPv6 Address . . . . . : fe80::a408:7104:f925:9cbd%57
   IPv4 Address. . . . . . . . . . . : 172.28.48.1
   Subnet Mask . . . . . . . . . . . : 255.255.240.0
   Default Gateway . . . . . . . . . :

来自 docker 容器:

1: lo: <LOOPBACK,UP,LOWER_UP> mtu 65536 qdisc noqueue state UNKNOWN group default qlen 1000
    link/loopback 00:00:00:00:00:00 brd 00:00:00:00:00:00
    inet 127.0.0.1/8 scope host lo
       valid_lft forever preferred_lft forever
    inet6 ::1/128 scope host 
       valid_lft forever preferred_lft forever
2: tunl0@NONE: <NOARP> mtu 1480 qdisc noop state DOWN group default qlen 1000
    link/ipip 0.0.0.0 brd 0.0.0.0
3: sit0@NONE: <NOARP> mtu 1480 qdisc noop state DOWN group default qlen 1000
    link/sit 0.0.0.0 brd 0.0.0.0
4: docker0: <NO-CARRIER,BROADCAST,MULTICAST,UP> mtu 1500 qdisc noqueue state DOWN group default 
    link/ether 02:42:e6:46:35:37 brd ff:ff:ff:ff:ff:ff
    inet 172.17.0.1/16 brd 172.17.255.255 scope global docker0
       valid_lft forever preferred_lft forever
7: eth0@if6: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc noqueue state UP group default 
    link/ether 1e:0f:c3:d5:44:55 brd ff:ff:ff:ff:ff:ff link-netnsid 0
    inet 192.168.65.4 peer 192.168.65.5/32 scope global eth0
       valid_lft forever preferred_lft forever
    inet6 fe80::1c0f:c3ff:fed5:4455/64 scope link 
       valid_lft forever preferred_lft forever
docker ros ethernet python-sockets texas-instruments
1个回答
0
投票

我正在尝试使用相同的代码。我们应该保持联系,以便我们可以讨论遇到的问题。当谈到这个问题时,我将我的 IPv4 地址设置为 192.168.33.30 并将网络掩码设置为 255.255.255.0 我通过单击 ubuntu 计算机上的以太网设置来完成此操作,但我确信有某种方法可以从 cli 执行此操作,而无需使用 GUI。

© www.soinside.com 2019 - 2024. All rights reserved.