newrudeman

【Training Camp】4G Remote Control Robot Dog

 
Overview

Project Description

  • Robot dog with 4G remote control based on HI3861

basic skills

  • The robot dog can move forward, backward, left, and right, and can make various actions based on the rotation angle of the servo of each leg.
  • Remote control and real-time audio and video calls using mobile APP
  • Use watch APP gestures to control the walking of the robot dog

Hardware parts

circuit board

  • The main control uses Hongmeng HI3861 and PCA9685 for multi-channel servo control.
  • The circuit is drawn according to the training camp course. In order to facilitate the control of battery power, a boat-shaped switch pad is added.

shell

  • Shell reference training camp course content is designed using SW
  • In order to facilitate the placement of mobile phones, the tops of the front, rear, left and right baffles have been partially raised.
  • In order to install the boat-shaped switch, a rectangular slot was opened at the bottom, but the thickness was not considered, so the boat-shaped switch was not installed particularly firmly.

other

  • An old mobile phone is placed on the back of the robot dog to provide audio and video calls and network hotspots
  • In order to capture the front view when the phone is laid flat, a prism is added to the camera position of the phone to change the angle of the light.
  • Dog feet are covered with band-aids to prevent slipping

software part

firmware

  • Modify the main program based on the firmware provided by the training camp and change it to a TCP client to receive instructions. Please refer to the following.
       //创建socket
        if ((sock_fd = socket(AF_INET, SOCK_STREAM, 0)) == -1)
        {
            perror("create socket failed!
");
            exit(1);
        }

        //初始化预连接的服务端地址
        send_addr.sin_family = AF_INET;
        send_addr.sin_port = htons(TCP_PORT);
        // send_addr.sin_addr.s_addr = inet_addr(TCP_SERVER_ADRESS);
        addr_length = sizeof(send_addr);

        connect(sock_fd, (struct sockaddr *)&send_addr, addr_length);

        while (1)
        {
            bzero(recv_buf, sizeof(recv_buf));
            int recv_len;
            recv_len = recv(sock_fd, recv_buf, sizeof(recv_buf), 0);
            if(recv_len == -1)
            {
                //TODO::处理掉线
                break;
            }
            // printf("len: %d data: %s
", recv_len, recv_buf);
            dog_execJson(recv_buf,recv_len);
        }
        //关闭这个 socket
        closesocket(sock_fd);

  • Added a check when parsing json to prevent restarting when receiving non-json strings
 typejson = cJSON_GetObjectItem(recv_json, "type");
    if (typejson) {
        ....
    }

Control terminal

Mobile APP

  • The APP is developed using Swift. The upper part is a video display and supports voice intercom, that is, audio and video calls. Since no one is testing it together, the audio call part is not shown in the video.
  • Use the virtual joystick to control the robot dog to walk in four directions
  • Four buttons are also provided to control the four preset postures of the robot dog.
  • WechatIMG3863.png

Watch APP

  • Use the gyroscope data of the watch to determine gestures, lift up to move forward, lower down to move back, and turn your wrist left or right to control the robot dog's left or right steering.
  • The interface simply displays the recognition results without taking screenshots. See the video for usage effects.

Background Services

Audio and video calls (WebRTC)

  • The signaling service is written in swift and its main function is to provide a websocket service to pair devices.
  • TURN uses coturn

remote control

  • The control service is written in golang. Simply build a tcp service to forward the received command message to the robot dog. The code reference is as follows
	for {
		reader := bufio.NewReader(conn)
		message, err := reader.ReadString('
')

		if err != nil {
			break
		}

		for item := range openConnections {
			if item != conn {
				item.Write([]byte(message))
			}
		}
	}

  • In order to solve the problem that the watch cannot communicate directly using tcp, an http service forwarding is added inside.

port forwarding

  • Since there is no server, the above services are all run locally and mapped out through the router port (requiring a public IP) for remote access by robot dogs and mobile phones.

Summarize

  • Due to time reasons (lazyness), many software parts are written to prioritize functional implementation, and there are still many shortcomings that need to be improved.
  • In terms of circuit design, I originally wanted to add a charging circuit because the level limit did not allow it.
  • The information provided in this training camp, especially the firmware and kinematics inverse solution tools, are relatively complete. For time reasons (lazy), I only made simple modifications and used them without in-depth study.

Finished product display picture & attached video

Robot dog overall

参考设计图片
×
 
 
Search Datasheet?

Supported by EEWorld Datasheet

Forum More
Update:2025-06-24 03:44:53

EEWorld
subscription
account

EEWorld
service
account

Automotive
development
community

Robot
development
community

About Us Customer Service Contact Information Datasheet Sitemap LatestNews


Room 1530, 15th Floor, Building B, No.18 Zhongguancun Street, Haidian District, Beijing, Postal Code: 100190 China Telephone: 008610 8235 0740

Copyright © 2005-2024 EEWORLD.com.cn, Inc. All rights reserved 京ICP证060456号 京ICP备10001474号-1 电信业务审批[2006]字第258号函 京公网安备 11010802033920号