Skip to content

Commit

Permalink
fix udp bug
Browse files Browse the repository at this point in the history
Make it compatible with SDK 3.8.0
  • Loading branch information
llexGe committed Oct 21, 2022
1 parent d422b91 commit 8bc209f
Show file tree
Hide file tree
Showing 4 changed files with 13 additions and 18 deletions.
9 changes: 4 additions & 5 deletions unitree_legged_real/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -17,15 +17,13 @@ if("${CMAKE_SYSTEM_PROCESSOR}" MATCHES "x86_64.*")
else()
set(ARCH arm64)
endif()
set(LEGGED_SDK_NAME -pthread libunitree_legged_sdk_${ARCH}.so lcm)

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

set(EXTRA_LIBS -pthread libunitree_legged_sdk.so)

set(CMAKE_CXX_FLAGS "-O3 -fPIC")



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



link_directories(${CMAKE_SOURCE_DIR}/unitree_legged_sdk/lib)




Expand Down Expand Up @@ -62,3 +60,4 @@ 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: 0 additions & 8 deletions unitree_legged_real/ipconfig.sh

This file was deleted.

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

public:
Custom()
: low_udp(LOWLEVEL),
high_udp(8090, "192.168.123.161", 8082, sizeof(HighCmd), sizeof(HighState))
:
// low_udp(LOWLEVEL),
low_udp(LOWLEVEL, 8091, "192.168.123.10", 8007),
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: 5 additions & 3 deletions unitree_legged_real/src/exe/twist_sub.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -24,8 +24,10 @@ class Custom

public:
Custom()
: low_udp(LOWLEVEL),
high_udp(8090, "192.168.123.161", 8082, sizeof(HighCmd), sizeof(HighState))
:
// low_udp(LOWLEVEL),
low_udp(LOWLEVEL, 8091, "192.168.123.10", 8007),
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 @@ -107,4 +109,4 @@ int main(int argc, char **argv)
ros::spin();

return 0;
}
}

0 comments on commit 8bc209f

Please sign in to comment.