Skip to content

Commit

Permalink
modification for sdk v3.5.1
Browse files Browse the repository at this point in the history
  • Loading branch information
llexGe committed Oct 21, 2022
1 parent c54489e commit ad91c9f
Show file tree
Hide file tree
Showing 5 changed files with 22 additions and 18 deletions.
9 changes: 4 additions & 5 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
Packages Version: v3.8.0
Packages Version: v3.5.1

# Introduction
This package can send control command to real robot from ROS. You can do low-level control(namely control all joints on robot) and high-level control(namely control the walking direction and speed of robot).
Expand All @@ -15,11 +15,10 @@ The interface between ROS and real robot: `unitree_legged_real`
We recommand users to run this package in Ubuntu 18.04 and ROS melodic environment

## Dependencies
* [unitree_legged_sdk](https://github.com/unitreerobotics/unitree_legged_sdk/releases)
* [unitree_legged_sdk](https://github.com/unitreerobotics/unitree_legged_sdk/releases/tag/v3.5.1)
### Notice
The newest release [v3.8.0](https://github.com/unitreerobotics/unitree_legged_sdk/releases/tag/3.8.0) only supports for robot: Go1.

Check release [v3.3.4](https://github.com/unitreerobotics/unitree_legged_sdk/releases/tag/3.3.4) for A1 support.
The release [v3.5.1](https://github.com/unitreerobotics/unitree_legged_sdk/releases/tag/v3.5.1) only supports for robot: Go1.
There is a typo on line 189 at "\unitree_legged_sdk-3.5.1\include\unitree_legged_sdk\comm.h". Change "postion" to "position" will work.

# Configuration
Before compiling this package, please download the corresponding unitree_legged_sdk as noted above, and put it to your own workspace's source folder(e.g. `~/catkin_ws/src`). Be careful with the sdk folder name. It should be "unitree_legged_sdk" without version tag.
Expand Down
9 changes: 5 additions & 4 deletions unitree_legged_real/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -17,13 +17,15 @@ if("${CMAKE_SYSTEM_PROCESSOR}" MATCHES "x86_64.*")
else()
set(ARCH arm64)
endif()
set(LEGGED_SDK_NAME -pthread libunitree_legged_sdk_${ARCH}.so lcm)

link_directories(${CMAKE_SOURCE_DIR}/unitree_legged_sdk/lib/cpp/${ARCH})
set(EXTRA_LIBS ${LEGGED_SDK_NAME} lcm)

set(EXTRA_LIBS -pthread libunitree_legged_sdk.so)

set(CMAKE_CXX_FLAGS "-O3 -fPIC")



include_directories(
include
${catkin_INCLUDE_DIRS}
Expand All @@ -32,7 +34,7 @@ include_directories(




link_directories(${CMAKE_SOURCE_DIR}/unitree_legged_sdk/lib)



Expand Down Expand Up @@ -60,4 +62,3 @@ add_dependencies(control_via_keyboard ${${PROJECT_NAME}_EXPORTED_TARGETS} ${catk
add_executable(twist_sub src/exe/twist_sub.cpp)
target_link_libraries(twist_sub ${EXTRA_LIBS} ${catkin_LIBRARIES})
add_dependencies(twist_sub ${${PROJECT_NAME}_EXPORTED_TARGETS} ${catkin_EXPORTED_TARGETS})

8 changes: 8 additions & 0 deletions unitree_legged_real/ipconfig.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
#!/bin/bash

sudo ifconfig lo multicast
sudo route add -net 224.0.0.0 netmask 240.0.0.0 dev lo

sudo ifconfig enx000ec6612921 down
sudo ifconfig enx000ec6612921 up 192.168.123.162 netmask 255.255.255.0

6 changes: 2 additions & 4 deletions unitree_legged_real/src/exe/ros_udp.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -24,10 +24,8 @@ class Custom

public:
Custom()
:
// low_udp(LOWLEVEL),
low_udp(LOWLEVEL, 8091, "192.168.123.10", 8007),
high_udp(8090, "192.168.123.161", 8082, sizeof(HighCmd), sizeof(HighState))
: low_udp(LOWLEVEL),
high_udp(8090, "192.168.123.161", 8082, sizeof(HighCmd), sizeof(HighState))
{
high_udp.InitCmdData(high_cmd);
low_udp.InitCmdData(low_cmd);
Expand Down
8 changes: 3 additions & 5 deletions unitree_legged_real/src/exe/twist_sub.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -24,10 +24,8 @@ class Custom

public:
Custom()
:
// low_udp(LOWLEVEL),
low_udp(LOWLEVEL, 8091, "192.168.123.10", 8007),
high_udp(8090, "192.168.123.161", 8082, sizeof(HighCmd), sizeof(HighState))
: low_udp(LOWLEVEL),
high_udp(8090, "192.168.123.161", 8082, sizeof(HighCmd), sizeof(HighState))
{
high_udp.InitCmdData(high_cmd);
low_udp.InitCmdData(low_cmd);
Expand Down Expand Up @@ -109,4 +107,4 @@ int main(int argc, char **argv)
ros::spin();

return 0;
}
}

0 comments on commit ad91c9f

Please sign in to comment.