Giter Club home page Giter Club logo

free-dog-sdk's Issues

New Slack Link?

The slack link in the readme appears to be dead. Is there a new one?

High level example - the dog does not move :(

Hi, thank you for doing everything on this cool project! I recently got a Go1 Pro. When I run the push-up example, I can get the sensor data without a problem but the dog does not move.
Screenshot from 2024-02-16 14-31-55

The dog is connected to the computer through wifi. The local ip address is 192.168.12.137, so I changed the local_ip_wifi in the unitreeConnection.py to the same address:
Screenshot from 2024-02-16 14-36-28
Screenshot from 2024-02-16 14-36-50

I set the dog to Sport Mode following these steps:
switch sport mode(HighLevel mode) to normal mode(LowLevel mode)
L2+B (switch to damping mode)
L1+L2+START (switch to normal mode)
L2+B twice (swtich to damping mode with noise)
L2+A twice (switch to stand postion)
switch normal mode(LowLevel mode) to sport mode(HighLevel mode)
L2+B (switch to damping mode)

Following is a printout of the dog firmware:
IMG_0811

Could you help me on this? Or maybe provide some debug ideas? Thanks a lot!

about hcmd.wirelessRemote

I'm tried to make my dog to roll over but it doesn't work.
here is my code

from ucl.common import byte_print, decode_version, decode_sn, getVoltage, pretty_print_obj, lib_version
from ucl.highCmd import highCmd
from ucl.highState import highState
from ucl.lowCmd import lowCmd
from ucl.unitreeConnection import unitreeConnection, HIGH_WIFI_DEFAULTS, HIGH_WIRED_DEFAULTS
from ucl.enums import MotorModeHigh, GaitType, SpeedLevel
from ucl.complex import motorCmd
from ucl.complex import led

import time
import socket

Roll = b'\x55\x51\x20\x08\x43\x60\x9E\x3A\x00\x00\x00\x00\xE7\x3E\x3B\x3A\x00\x00\x00\x00\x6B\x0E\x4D\x3A\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x04\x3D'

You can use one of the 3 Presets WIFI_DEFAULTS, LOW_CMD_DEFAULTS or HIGH_CMD_DEFAULTS.

IF NONE OF THEM ARE WORKING YOU CAN DEFINE A CUSTOM ONE LIKE THIS:

MY_CONNECTION_SETTINGS = (listenPort, addr_wifi, sendPort_high, local_ip_wifi)

conn = unitreeConnection(MY_CONNECTION_SETTINGS)

print(f'Running lib version: {lib_version()}')

conn = unitreeConnection(HIGH_WIFI_DEFAULTS)
conn.startRecv()
hcmd = highCmd()
hstate = highState()

Send empty command to tell the dog the receive port and initialize the connectin

cmd_bytes = hcmd.buildCmd(debug=False)
conn.send(cmd_bytes)
time.sleep(1) # Some time to collect pakets ;)

hcmd.mode = MotorModeHigh.FORCE_STAND
cmd_bytes = hcmd.buildCmd(debug=False)
conn.send(cmd_bytes)
time.sleep(1)

hcmd.wirelessRemote = bytearray(Roll)
cmd_bytes = hcmd.buildCmd(debug=False)
conn.send(cmd_bytes)
time.sleep(2)

Am i missing something?

LEDs not work

thank your for your sdk.
I add the led commands as you described in a closed issues(#1). The LEDs do not work.

Thanks!

Index out of range

Hello, thanks for your great job!!!
But when I tried to run your code, I met with some problems.
屏幕截图 2024-07-05 14:48:08
I think there is something wrong with hstate.parseData(paket).
Can you give me some advise? Please!

Explore usage with Gait / Locomotion projects (pybind? or a UDP proxy?)

We need to see what enables these projects to function:
https://github.com/Improbable-AI/walk-these-ways

Many things rely on ros2_udp.cpp
https://github.com/unitreerobotics/unitree_ros2_to_real/blob/main/src/ros2_udp.cpp
and ros_udp.cpp
https://github.com/unitreerobotics/unitree_ros_to_real/blob/master/unitree_legged_real/src/exe/ros_udp.cpp

twist_sub.cpp is another example that many things build off of.
https://github.com/unitreerobotics/unitree_ros_to_real/blob/master/unitree_legged_real/src/exe/twist_sub.cpp

Katie Hughes examples for example are an extension of the above examples:
https://github.com/katie-hughes/unitree_ros2/blob/main/unitree_legged_real/src/udp_low.cpp

her joint state publisher being another example
https://github.com/katie-hughes/unitree_ros2/blob/main/unitree_legged_real/src/jsp_low.cpp

Is there possibly a way to make a bridge so we don't have to rewrite every bit of code? I've not had a chance to think further on this. Can we make a wrapper with the function interfaces, and use a Python-C API of some sort? CPython? pybind11 maybe?

Detail on replicating Safety functions

For anyone that wishes to try to implement them on their own (before we can) here are some notes.
https://github.com/unitreerobotics/unitree_legged_sdk/blob/master/include/unitree_legged_sdk/safety.h

Start here: unitreerobotics/unitree_legged_sdk#65

Long story short we can simply make use of https://github.com/Bin4ry/free-dog-sdk/blob/main/ucl/lowState.py#L58
return motorState(mode, q, dq, ddq, tauEst, q_raw, dq_raw, ddq_raw, temperature, reserve)

Looks to me like in order to add safety support, we need to utilize the above MotorState. Seemingly all "Safety()" does is check the static values depicted in the disassembled code attached for each joint vs the motor state.

image_720
image-5
image-4
image
image-1
image-2
image-3

confirm the ubuntu version of blogger's Go1

I tried to run the sdk in my go1, but I failed to find the right version of numpy library. The highest version I found was 1.16.6. So I guessed one of the reasons that I failed to run your sdk was the wrong version of the library.

And I guess another reason is that I used the old source, so I hope you could give me the newest source website to me, too.
(I had tried to download the right version on official website on github, but it seems like it fit in windows but no ubuntu. I cann't set up it on my go1. )

Faux-Level how-to notes

Power up the Unitree Go1, and connect to wireless network: Unitree_GoXXXXXX
(where XXXXXX is the 3 octets in the MAC address from your dog)
By default the password is: 00000000

Once you connect your wifi interface route should be set to the dogs 192.168.12.1 address by default:

(pc)$ netstat -nr 
Kernel IP routing table
Destination     Gateway         Genmask         Flags   MSS Window  irtt Iface
0.0.0.0         192.168.12.1    0.0.0.0         UG        0 0          0 wlp61s0
...

Open a terminal, and watch the log file for Legged_Sport via ssh to the RasPi in the dog. This is optional, but it can allow you to see the correct mode sequences have been entered ensuring the dog is ready for the low level input. The password for the pi user is 123.

(pc)$ ssh [email protected] "tail -f /home/pi/Unitree/autostart/sportMode/log"
[email protected]'s password: 
GO1 wrong Model
[Wait] for trigger: SDK or L1 + start
[UDP Connected] client! Client IP:192.168.123.161 port:8091
SDK trigger detected
Be triggered
[UDP Disconnected] client! socketfd:11 Old Client IP:192.168.123.161 port:8091
[UDP Connected] client! Client IP:192.168.123.161 port:8084
[Trigger CMD]: L2 + A
[Trigger CMD]: L2 + A
[Trigger CMD]: L2 + B
[Trigger CMD]: L1 + L2 + START
Sport Mode Triggered Off
UDP Initialized. socketfd: 9   Port: 8008
UDP Initialized. socketfd: 10   Port: 8010
UDP Initialized. socketfd: 11   Port: 8082
UDP Initialized. socketfd: 12   Port: 8018
[Wait] for check
Check passed
GO1 wrong Model
[Wait] for trigger: SDK or L1 + start
tail: /home/pi/Unitree/autostart/sportMode/log: file truncated

Put Go1 into low level mode with remote

L2 + A
L2 + A
L2 + B
L1 + L2 + Start

Make sure your ip_forward setup is proper, we expect the value to be "1" on net.ipv4.ip_forward:

$ ssh [email protected] "grep net.ipv4.ip_forward /etc/sysctl.conf"
[email protected]'s password: 
net.ipv4.ip_forward=1

You can alternately follow the guide here starting from "Power up Unitree Go1 and connect to wireless network": https://gist.githubusercontent.com/dbaldwin/b31835f87f16450a956cf3c89e15a289/raw/bf1c8452ba4c2a30bb7073718f1de2370c9eb786/gistfile1.txt

Make sure you have crcmod, and pyshark python modules installed.

If you wish, you can make sure the required ports are open for testing:

$ sudo nmap -p 8082 192.168.12.1 -sU # High Level 

Starting Nmap 7.60 ( https://nmap.org ) at 2023-05-31 22:39 EDT
Nmap scan report for 192.168.12.1
Host is up (0.0027s latency).

PORT     STATE         SERVICE
8082/udp open|filtered us-cli
MAC Address: 32:7B:C9:24:30:6B (Unknown)

Nmap done: 1 IP address (1 host up) scanned in 9.48 seconds

$ sudo nmap -p 8007 192.168.123.10 -sU # Low Level

Starting Nmap 7.60 ( https://nmap.org ) at 2023-06-01 00:21 EDT
Nmap scan report for 192.168.123.10
Host is up (0.0026s latency).

PORT     STATE SERVICE
8007/udp open  unknown

Nmap done: 1 IP address (1 host up) scanned in 8.85 seconds

You can now execute the speak_low.py example.

$ python3 speak_low.py 
[*] Start receive Thread ...

1
2
3
...

You should see the dogs front right leg move.

If you want to have information about your dog printed out as a sanity check you can edit the speak_low.py as follows:

for paket in data:
    lstate.parseData(paket)
    print('+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=')
    print(f'SN [{byte_print(lstate.SN)}]:\t{decode_sn(lstate.SN)}')
    print(f'Ver [{byte_print(lstate.version)}]:\t{decode_version(lstate.version)}')
    print('+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=')

The modified code will return version and serial number information as follows:

$ python3 speak_low.py 
[*] Start receive Thread ...

+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=
SN [0405010409022500]:	('Go1_XX', '1-4-9[2]')
Ver [000109000126fc7f]:	('0.1.9', '0.1.38')
+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=

One way to confirm you are in LOW-LEVEL mode is to try to speak using the HIGH-LEVEL example, you should get nulled out responses:

$ python3 speak.py 
[*] Start receive Thread ...

24
+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=
SN [0000000000000000]:	('UNKNOWN_UNKNOWN', '0-0-0[0]')
Ver [0000000000000000]:	('0.0.0', '0.0.0')
SOC:			0 %
Overall Voltage:	0 mv
Current:		0 mA
Cycles:			0
Temps BQ:		0 °C, 0°C
Temps MCU:		0 °C, 0°C
FootForce:		[0, 0, 0, 0]
FootForceEst:		[0, 0, 0, 0]
+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=
...

TheDogPound invite link

Hello!

I would be interested in joining the Slack group TheDogPound if it's still active, however the invite link in the ReadMe is expired.

Cheers!

Explore usage with Gait / Locomotion projects (pybind? or a UDP proxy?)

We need to see what enables these projects to function:
https://github.com/Improbable-AI/walk-these-ways

Many things rely on ros2_udp.cpp
https://github.com/unitreerobotics/unitree_ros2_to_real/blob/main/src/ros2_udp.cpp
and ros_udp.cpp
https://github.com/unitreerobotics/unitree_ros_to_real/blob/master/unitree_legged_real/src/exe/ros_udp.cpp

twist_sub.cpp is another example that many things build off of.
https://github.com/unitreerobotics/unitree_ros_to_real/blob/master/unitree_legged_real/src/exe/twist_sub.cpp

Katie Hughes examples for example are an extension of the above examples:
https://github.com/katie-hughes/unitree_ros2/blob/main/unitree_legged_real/src/udp_low.cpp

her joint state publisher being another example
https://github.com/katie-hughes/unitree_ros2/blob/main/unitree_legged_real/src/jsp_low.cpp

Is there possibly a way to make a bridge so we don't have to rewrite every bit of code? I've not had a chance to think further on this. Can we make a wrapper with the function interfaces, and use a Python-C API of some sort? CPython? pybind11 maybe?

Could you add me to the slack channel?

I came from the youtube video for Go1 Teardown / Main Board Removal Disassembly. Could you add me to the slack channel? Id like to know the screw bit sizes you used. Thanks!

different motorMode values for low-level

Thank you for your great work!
Have you experienced any issues when changing motor modes?
I wanted to test different motor modes in low level so I tested 0-16
now the motors are not responding anymore, even after reboot.

this actually happened to me on an A1 but I think the SDK is the same.

GaitTypes not working properly

I have the Go1 EDU and the GaitType CLIMB_STAIR acts like the running mode. The TROT_OBSTACLE makes my robot walk very weird, like it would fall every moment. And I also wanted to ask what the Speed Levels do?

led not working

The leds are not working i guess.
I tried it over doing
hstate.led = led(0, 255, 0)

Controlling multiple dogs

Hello,

I have a project where I would like to be able to send highlevel commands to multiple (say 4) Unitree Go1 Pro dogs simultaneously. It's inconvenient to connect to each dog's access point to do so, so I'm wondering if the Unitrees could instead be made to connect to a router and then I could send the highlevel commands over that connection? I found the information about the Wifi Backdoor in the YushuTechUnitreeGo1 repo (https://github.com/MAVProxyUser/YushuTechUnitreeGo1?tab=readme-ov-file#wifi-backdoor), could that be used for that purpose? (I know basically nothing about networking)

Cheers!

Euler while walking

unitreerobotics/unitree_legged_sdk#72

Since the remote can do it, is it just missing from the official sdk?
What about this hacked version? I my experiments I could not get the dog to respond to euler commands outside of FORCED_STAND. It is somehow possible?

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.