MAVProxyUser / YushuTechUnitreeGo1

宇树科技 Yushu Technology (Unitree) go1 development notes
295 stars 73 forks source link

Trouble Transferring Image Data to Onboard Raspberry Pi on Unitree Go1 Edu #9

Open pannatorn6395 opened 1 year ago

pannatorn6395 commented 1 year ago

I'm currently working on transferring image data from multiple Jetson units to the onboard Raspberry Pi of the Unitree Go1 Edu robot. I've been following the guide available here, specifically Step 7, using ./bins/example_putImagetrans for sending the image data.

The data transfer works well between the Jetson units (with IPs: 192.168.123.13, 192.168.123.14, and 192.168.123.15). However, I've encountered issues when attempting to transfer this image data to the Go1 Edu's onboard Raspberry Pi (IP: 192.168.123.161) using the following Python script to receive the data.

` import cv2

class camera:

def __init__(self, cam_id=None, width=640, height=480):
    self.width = 640
    self.cam_id = cam_id
    self.width = width
    self.height = height
def get_img(self):
    IpLastSegment = "161"
    cam = self.cam_id
    udpstrPrevData = "udpsrc address=192.168.123." + IpLastSegment + " port="
    udpPORT = [9201, 9202, 9203, 9204, 9205]
    udpstrBehindData = " ! application/x-rtp,media=video,encoding-name=H264 ! rtph264depay ! h264parse ! avdec_h264 ! videoconvert ! appsink"
    udpSendIntegratedPipe_0 = udpstrPrevData + str(udpPORT[cam - 1]) + udpstrBehindData
    print(udpSendIntegratedPipe_0)
    self.cap = cv2.VideoCapture(udpSendIntegratedPipe_0)

def demo(self):
    self.get_img()
    while True:
        self.ret, self.frame = self.cap.read()
        self.frame = cv2.resize(self.frame, (self.width, self.height))
        if self.cam_id == 1:
            self.frame = cv2.flip(self.frame, -1)
        if self.frame is not None:
            cv2.imshow("video0", self.frame)
        if cv2.waitKey(2) & 0xFF == ord('q'):
            break
    self.cap.release()
    cv2.destroyAllWindows()

` Despite adjusting the destination IP to the onboard Raspberry Pi's, the image data doesn't seem to get through as expected.

Any guidance or troubleshooting steps would be highly appreciated.

MAVProxyUser commented 1 year ago

I got tired of all that noise and wrote this. https://github.com/MAVProxyUser/YushuTechUnitreeGo1/blob/main/StreamCamCross.py

pannatorn6395 commented 1 year ago

I've SSH'd into each Jetson machine and navigated to the following files:

/home/unitree/Unitree/autostart/imageai/mLComSystemFrame/config/mqMNConfig.yaml:udpHost: "192.168.123.96" /home/unitree/Unitree/autostart/imageai/mLComSystemFrame/config/mqSNNLConfig.yaml:udpHost: "192.168.123.96" /home/unitree/Unitree/autostart/imageai/mLComSystemFrame/config/mqSNNRConfig.yaml:udpHost: "192.168.123.96" I have a couple of questions:

I couldn't find udpHost in these files. Is this the variable MNAAddress instead?

If I want to stream the video to an RPi and capture the feed using Python code, should I be modifying udpstrPrevData = "udpsrc address=192.168.123.161" to point to the RPi's IP address?

Sorry for the confusion.

MAVProxyUser commented 1 year ago

Are you on current firmware? What was the last .zip file applied to your system? find / -name "*.zip" on the RasPi

pannatorn6395 commented 1 year ago

Hi , this is result S__39673859

MAVProxyUser commented 1 year ago

there are versions of firmware newer than this. you can either look in #go1firmware for them on slack, or ask unitree support for a newer binary that has the streaming enabled.

MAVProxyUser commented 1 year ago

05-11-22 firmware here https://robotdogs.slack.com/files/U041QH24X54/F04LT8FUEMB/go1_2022_05_11_e0d0e617.zip

09-06-22 firmware here https://files.slack.com/files-pri/T0429Q34FDF-F04LW651FL2/download/go1_2022_09_06_cdc41f89.zip

pannatorn6395 commented 1 year ago

Okay, I will download it through Slack. Do you have a guide or steps on how to update the firmware?