Compare commits

..

1 Commits

Author SHA1 Message Date
llexGe ad91c9fdda modification for sdk v3.5.1 2022-10-21 19:24:53 +08:00
8 changed files with 41 additions and 32 deletions

3
.gitmodules vendored
View File

@ -1,3 +0,0 @@
[submodule "unitree_legged_sdk"]
path = unitree_legged_sdk
url = https://github.com/unitreerobotics/unitree_legged_sdk.git

View File

@ -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).
@ -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.
@ -70,12 +69,12 @@ It depends which control mode you want to use.
Then, if you want to run high-level control mode, you can run example_walk node like this
```
rosrun unitree_legged_real ros_example_walk
rosrun unitree_legged_real example_walk
```
If you want to run low-level control mode, you can run example_position program node like this
```
rosrun unitree_legged_real ros_example_postion
rosrun unitree_legged_real example_postion
```
You can also run the node state_sub to subscribe the feedback information from Go1 robot

View File

@ -1,13 +1,12 @@
cmake_minimum_required(VERSION 2.8.3)
project(unitree_legged_real)
set(CMAKE_CXX_FLAGS "-O3 -fPIC -std=c++11")
add_compile_options(-std=c++11)
find_package(catkin REQUIRED COMPONENTS
roscpp
geometry_msgs
unitree_legged_msgs
unitree_legged_sdk
)
catkin_package()
@ -18,22 +17,35 @@ 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)
set(CMAKE_CXX_FLAGS "-O3 -fPIC")
set(EXTRA_LIBS -pthread ${unitree_legged_sdk_LIBRARIES})
include_directories(
include
${catkin_INCLUDE_DIRS}
${unitree_legged_sdk_INCLUDE_DIRS}
${CMAKE_SOURCE_DIR}/unitree_legged_sdk/include
)
add_executable(ros_example_walk src/exe/example_walk.cpp)
target_link_libraries(ros_example_walk ${EXTRA_LIBS} ${catkin_LIBRARIES})
add_dependencies(ros_example_walk ${${PROJECT_NAME}_EXPORTED_TARGETS} ${catkin_EXPORTED_TARGETS})
add_executable(ros_example_position src/exe/example_position.cpp)
target_link_libraries(ros_example_position ${EXTRA_LIBS} ${catkin_LIBRARIES})
add_dependencies(ros_example_position ${${PROJECT_NAME}_EXPORTED_TARGETS} ${catkin_EXPORTED_TARGETS})
link_directories(${CMAKE_SOURCE_DIR}/unitree_legged_sdk/lib)
add_executable(example_walk src/exe/example_walk.cpp)
target_link_libraries(example_walk ${EXTRA_LIBS} ${catkin_LIBRARIES})
add_dependencies(example_walk ${${PROJECT_NAME}_EXPORTED_TARGETS} ${catkin_EXPORTED_TARGETS})
add_executable(example_position src/exe/example_position.cpp)
target_link_libraries(example_position ${EXTRA_LIBS} ${catkin_LIBRARIES})
add_dependencies(example_position ${${PROJECT_NAME}_EXPORTED_TARGETS} ${catkin_EXPORTED_TARGETS})
add_executable(state_sub src/exe/state_sub.cpp)
target_link_libraries(state_sub ${EXTRA_LIBS} ${catkin_LIBRARIES})
@ -50,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})

View File

@ -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

View File

@ -15,7 +15,6 @@
<exec_depend>roscpp</exec_depend>
<exec_depend>std_msgs</exec_depend>
<depend>unitree_legged_msgs</depend>
<depend>unitree_legged_sdk</depend>
<depend>eigen</depend>
</package>

View File

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

View File

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

@ -1 +0,0 @@
Subproject commit acc36dfd48755f5a9889ef3cc9ee31604ebfe41c