Bin4ry/free-dog-sdk

about hcmd.wirelessRemote

Opened this issue · 0 comments

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?