Skip to content

Commit

Permalink
v3.8.4 Aliengo SDK add python arm lib
Browse files Browse the repository at this point in the history
  • Loading branch information
Bin-Ro committed Nov 21, 2022
1 parent bf3af88 commit d5f2f0e
Show file tree
Hide file tree
Showing 28 changed files with 1,003 additions and 688 deletions.
35 changes: 20 additions & 15 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,10 @@ project(unitree_legged_sdk)
include_directories(include)
include_directories(./)

# add_compile_options(-std=c++11)
add_compile_options(-std=c++14)
link_directories(lib/cpp/amd64)

add_compile_options(-std=c++11)

# check arch and os
message("-- CMAKE_SYSTEM_PROCESSOR: ${CMAKE_SYSTEM_PROCESSOR}")
if("${CMAKE_SYSTEM_PROCESSOR}" MATCHES "x86_64.*")
set(ARCH amd64)
Expand All @@ -17,26 +17,31 @@ if("${CMAKE_SYSTEM_PROCESSOR}" MATCHES "aarch64.*")
endif()

link_directories(lib/cpp/${ARCH})
set(EXTRA_LIBS -pthread libunitree_legged_sdk.so)
set(EXTRA_LIBS -pthread libunitree_legged_sdk.so lcm)

set(CMAKE_CXX_FLAGS "-O3 -fPIC")

add_executable(example_walk_aliengo examples/example_walk_aliengo_sport.cpp)
target_link_libraries(example_walk_aliengo ${EXTRA_LIBS})

# one pc one process
add_executable(example_position example/example_position.cpp)
target_link_libraries(example_position ${EXTRA_LIBS})
add_executable(example_start_aliengo examples/example_start_aliengo_sport.cpp)
target_link_libraries(example_start_aliengo ${EXTRA_LIBS})

add_executable(example_velocity example/example_velocity.cpp)
target_link_libraries(example_velocity ${EXTRA_LIBS})
add_executable(example_joystick_aliengo examples/example_joystick_aliengo_sport.cpp)
target_link_libraries(example_joystick_aliengo ${EXTRA_LIBS})

add_executable(example_torque example/example_torque.cpp)
target_link_libraries(example_torque ${EXTRA_LIBS})
add_executable(example_recovery_aliengo examples/example_recovery_aliengo_sport.cpp)
target_link_libraries(example_recovery_aliengo ${EXTRA_LIBS})

add_executable(example_walk example/example_walk.cpp)
target_link_libraries(example_walk ${EXTRA_LIBS})
add_executable(example_position_aliengo examples/example_position_aliengo.cpp)
target_link_libraries(example_position_aliengo ${EXTRA_LIBS})

add_executable(example_joystick example/example_joystick.cpp)
target_link_libraries(example_joystick ${EXTRA_LIBS})
add_executable(example_velocity_aliengo examples/example_velocity_aliengo.cpp)
target_link_libraries(example_velocity_aliengo ${EXTRA_LIBS})

add_executable(example_torque_aliengo examples/example_torque_aliengo.cpp)
target_link_libraries(example_torque_aliengo ${EXTRA_LIBS})




26 changes: 17 additions & 9 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,25 +1,33 @@
# v3.8.1

This comment has been minimized.

Copy link
@JonasFovea

JonasFovea Nov 28, 2022

Why are you changing the versions of the supported robot?

It would be great to have a consistent scheme with maybe one branch per robot model.
@Dyingisasnaturalasliving @TrivasZhang

The unitree_legged_sdk is mainly used for communication between PC and Controller board.
# v3.8.4
The aliengo_sdk is mainly used for communication between PC and aliengo control board.
It also can be used in other PCs with UDP.

### Notice
support robot: B1
support robot: Aliengo

not support robot: Laikago, Aliengo, A1. (Check release [v3.3.1](https://github.com/unitreerobotics/unitree_legged_sdk/releases/tag/v3.3.1) for support)

This comment has been minimized.

Copy link
@JonasFovea

JonasFovea Nov 28, 2022

These version numbers are not correct.
What is about the Go1 and B1??


### Sport Mode
```bash
Legged_sport >= v3.24
Legged_sport >= v1.0.20
firmware H0.1.7 >= v0.1.35
H0.1.9 >= v0.1.35
```

### Dependencies
* [Boost](http://www.boost.org) (version 1.71.0 or higher)
* [CMake](http://www.cmake.org) (version 3.16.3 or higher)
* [g++](https://gcc.gnu.org/) (version 9.4.0 or higher)


### Dependencies
* [Boost](http://www.boost.org) (version 1.5.4 or higher)
* [CMake](http://www.cmake.org) (version 2.8.3 or higher)
* [LCM](https://lcm-proj.github.io) (version 1.4.0 or higher)
```bash
cd lcm-x.x.x
mkdir build
cd build
cmake ../
make
sudo make install
```

### Build
```bash
mkdir build
Expand Down
162 changes: 0 additions & 162 deletions example/example_walk.cpp

This file was deleted.

21 changes: 15 additions & 6 deletions example_py/example_position.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,10 +8,17 @@
sys.path.append('../lib/python/amd64')
import robot_interface as sdk

# low cmd
TARGET_PORT = 8007
LOCAL_PORT = 8082
TARGET_IP = "192.168.123.10" # target IP address

LOW_CMD_LENGTH = 610
LOW_STATE_LENGTH = 771

def jointLinearInterpolation(initPos, targetPos, rate):

#rate = np.fmin(np.fmax(rate, 0.0), 1.0)

if rate > 1.0:
rate = 1.0
elif rate < 0.0:
Expand All @@ -29,7 +36,7 @@ def jointLinearInterpolation(initPos, targetPos, rate):
'RL_0':9, 'RL_1':10, 'RL_2':11 }
PosStopF = math.pow(10,9)
VelStopF = 16000.0
HIGHLEVEL = 0xee
HIGHLEVEL = 0x00
LOWLEVEL = 0xff
sin_mid_q = [0.0, 1.2, -2.0]
dt = 0.002
Expand All @@ -40,13 +47,15 @@ def jointLinearInterpolation(initPos, targetPos, rate):
Kp = [0, 0, 0]
Kd = [0, 0, 0]

# udp = sdk.UDP(8080, "192.168.123.10", 8007, 614, 807, False, sdk.RecvEnum.nonBlock)
udp = sdk.UDP(LOWLEVEL, 8080, "192.168.123.10", 8007)
safe = sdk.Safety(sdk.LeggedType.B1)
udp = sdk.UDP(LOCAL_PORT, TARGET_IP, TARGET_PORT, LOW_CMD_LENGTH, LOW_STATE_LENGTH, -1)
#udp = sdk.UDP(8082, "192.168.123.10", 8007, 610, 771)
safe = sdk.Safety(sdk.LeggedType.Aliengo)

cmd = sdk.LowCmd()
state = sdk.LowState()
udp.InitCmdData(cmd)
cmd.levelFlag = LOWLEVEL


Tpi = 0
motiontime = 0
Expand Down Expand Up @@ -103,7 +112,7 @@ def jointLinearInterpolation(initPos, targetPos, rate):
cmd.motorCmd[d['FR_0']].dq = 0
cmd.motorCmd[d['FR_0']].Kp = Kp[0]
cmd.motorCmd[d['FR_0']].Kd = Kd[0]
cmd.motorCmd[d['FR_0']].tau = -5.0
cmd.motorCmd[d['FR_0']].tau = -1.6

cmd.motorCmd[d['FR_1']].q = qDes[1]
cmd.motorCmd[d['FR_1']].dq = 0
Expand Down
Loading

0 comments on commit d5f2f0e

Please sign in to comment.