Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

about hcmd.wirelessRemote #13

Open
JL-Brain opened this issue Aug 24, 2023 · 0 comments
Open

about hcmd.wirelessRemote #13

JL-Brain opened this issue Aug 24, 2023 · 0 comments

Comments

@JL-Brain
Copy link

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?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant