IntelligentRoboticsLabs / go2_robot

Implementation for Unitree GO 2 in ROS 2
BSD 3-Clause "New" or "Revised" License
61 stars 7 forks source link

Feature: Go2 front camera support #10

Open mspringer1 opened 1 month ago

mspringer1 commented 1 month ago

Hey,

based on the Go2 SDK Multimedia Service Interface (https://support.unitree.com/home/en/developer/Multimedia_Services) it would be possible to add video from the front camera to the go2_driver as sensor_msgs/CompressedImage.

A reference implementation is given under Video streaming

#include <opencv2/opencv.hpp>
using namespace cv;

#include <iostream>
using namespace std;

int main()
{

  VideoCapture cap("udpsrc address=230.1.1.1 port=1720 multicast-iface=<interface_name> ! application/x-rtp, media=video, encoding-name=H264 ! rtph264depay ! h264parse ! avdec_h264 ! videoconvert ! video/x-raw,width=1280,height=720,format=BGR ! appsink drop=1", 
            CAP_GSTREAMER);

  if (!cap.isOpened()) {
        cerr <<"VideoCapture not opened"<<endl;
        exit(-1);
    }

    while (true) {

        Mat frame;

        cap.read(frame);

        imshow("receiver", frame);

        if (waitKey(1) == 27) {
            break;
        }
    }

    return 0;
Juancams commented 1 month ago

Hello @mspringer1

Following the example shown by unitree, in a few weeks the video from the camera that is integrated into the go2_driver will be implemented.

Regarding how to publish it, we had planned to use image_transport.

mspringer1 commented 1 month ago

Hey @Juancams

there is also already a ros2 node written in rust for that: https://github.com/tfoldi/ros2_go2_video

Juancams commented 1 month ago

Yes, I know that code, but the idea is to reimplement it in c++ and not use anything from webrtc.