fix udp bug

Make it compatible with SDK 3.8.0
This commit is contained in:
llexGe 2022-10-21 14:28:23 +08:00
parent d422b91f6b
commit 8bc209f33b
4 changed files with 13 additions and 18 deletions

View File

@ -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}
@ -34,7 +32,7 @@ include_directories(
link_directories(${CMAKE_SOURCE_DIR}/unitree_legged_sdk/lib)
@ -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})

View File

@ -1,8 +0,0 @@
#!/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

View File

@ -24,8 +24,10 @@ public:
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);

View File

@ -24,8 +24,10 @@ public:
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);
@ -107,4 +109,4 @@ int main(int argc, char **argv)
ros::spin();
return 0;
}
}