diff --git a/.dockerignore b/.dockerignore new file mode 100644 index 0000000..b2f2e8e --- /dev/null +++ b/.dockerignore @@ -0,0 +1,4 @@ +build/** +build +unitree_ws +unitree_ws/** \ No newline at end of file diff --git a/.gitignore b/.gitignore index af96791..337f00d 100644 --- a/.gitignore +++ b/.gitignore @@ -1,2 +1,6 @@ .vscode +/build +/cmake-build* +.idea build +unitree_ws \ No newline at end of file diff --git a/Bytelogics.Dockerfile b/Bytelogics.Dockerfile new file mode 100644 index 0000000..ceed744 --- /dev/null +++ b/Bytelogics.Dockerfile @@ -0,0 +1,2 @@ +FROM siilats/z1_controller +CMD ./z1_ctrl diff --git a/Dockerfile b/Dockerfile new file mode 100644 index 0000000..aeedd41 --- /dev/null +++ b/Dockerfile @@ -0,0 +1,35 @@ +FROM kstein/noetic-arm-desktop-full + +RUN apt-get update +RUN apt-get -y install python3-catkin-tools ninja-build git telnet + +ADD . / data/ +WORKDIR data +RUN mkdir build +WORKDIR build +ENV CMAKE_PREFIX_PATH=/opt/ros/noetic +RUN bash -c 'cmake ..' +RUN make +WORKDIR .. +RUN ./prepare_unitree_ws.sh +SHELL ["/bin/bash", "-c"] +WORKDIR unitree_ws +RUN source /ros_entrypoint.sh && /opt/ros/noetic/bin/catkin_make +RUN source devel/setup.bash +# WORKDIR ../build +#CMD roslaunch unitree_gazebo z1_spawn.launch + +#CMD ./z1_ctrl +#docker tag bytelogics:z1_controller siilats/z1_controller +#docker push siilats/z1_controller:latest +#xhost +localhost +#defaults read org.xquartz.X11 enable_iglx + +#defaults write org.xquartz.X11 enable_iglx -bool YES +#defaults read org.xquartz.X11 enable_iglx + + +#docker run -ti -v /tmp/.X11-unix:/tmp/.X11-unix -e "DISPLAY=host.docker.internal:0" pstoll/emacs-cross emacs +# docker run -it -p 11311:11311 --env="ROS_MASTER_URI=http://localhost:11311" bytelogics:z1_controller roslaunch unitree_gazebo z1_spawn.launch + +#docker run -p 6080:80 --shm-size=512m tiryoh/ros-desktop-vnc:melodic \ No newline at end of file diff --git a/README.md b/README.md index bfa51b1..abba113 100644 --- a/README.md +++ b/README.md @@ -1,7 +1,63 @@ -Documentation: +documentation -[unitree-z1-docs-en](http://dev-z1.unitree.com) +[unitree-z1-docs-english](http://dev-z1.unitree.com) -[unitree-z1-docs-cn](http://dev-z1.cn.unitree.com) +[unitree-z1-docs-chinese](http://dev-z1.cn.unitree.com) +see [unitree-z1-docs](http://dev-z1.unitree.com) + +## Build docker image +```shell +docker build . -t bytelogics:z1_controller +``` + +## Run the docker instance +For python connection: +```shell +docker run -ti --rm --network host bytelogics:z1_controller + +``` + +For manual build within a docker: +Make sure you are not in build folder but in the parent then run +docker run -it --net=host --env="ROS_MASTER_URI=http://host.docker.internal:11311" bytelogics:z1_controller bash +`docker run -ti --rm --network host bytelogics:z1_controller bash` +`cmake .. -DCOMMUNICATION=ROS` +`make` +`./z1_ctrl` +you can try with +`./z1_ctrl k` for keyboard + +Cmake command you can do catkin_make -DCOMMUNICATION=ROS +then you dont need to edit the cmake.txt file +## old docker run -ti --rm --network host --env="DISPLAY" -e DISPLAY=${HOSTNAME}:0 --env="QT_X11_NO_MITSHM=1" --volume="/tmp/.X11-unix:/tmp/.X11-unix:rw" --volume="/Users/keithsiilats/overlay_ws:/data/overlay_ws" --volume="/Users/keithsiilats/unitree_ws:/data/unitree_ws" -p 8071:8071 -p 11311:11311 bytelogics:z1_controller bash +docker run -ti --rm --network host --env="DISPLAY=novnc:0.0" --env="QT_X11_NO_MITSHM=1" --volume="/tmp/.X11-unix:/tmp/.X11-unix:rw" --volume="/Users/keithsiilats/overlay_ws:/data/overlay_ws" --volume="/Users/keithsiilats/unitree_ws:/data/unitree_ws" -p 8071:8071 -p 11311:11311 bytelogics:z1_controller bash +docker run -d --rm --network host --env="DISPLAY_WIDTH=3000" --env="DISPLAY_HEIGHT=1800" --env="RUN_XTERM=no" \ +--name=novnc -p=8080:8080 theasp/novnc:latest + +## on mac setup +https://gist.github.com/cschiewek/246a244ba23da8b9f0e7b11a68bf3285 +cd /data/unitree_ws +source devel/setup.bash +roslaunch unitree_gazebo z1.launch + +## macos v2 +brew install --cask mambaforge +mamba create -n ros_env +mamba init +mamba activate ros_env +conda config --env --add channels robostack-staging +mamba install ros-noetic-desktop-full +mamba install compilers cmake pkg-config make ninja colcon-common-extensions catkin_tools +./prepare_unitree_ws.sh +cd unitree_ws +rm -Rf src/unitree_controller +rm -Rf src/z1_controller +rm -Rf src/unitree_legged_control + +catkin_make +source devel/setup.bash +roslaunch unitree_gazebo z1_empty.launch +# go to dockcker and run +# roslaunch unitree_gazebo z1_spawn.launch diff --git a/config/config.xml b/config/config.xml index f37c863..8ef5cde 100644 --- a/config/config.xml +++ b/config/config.xml @@ -1,12 +1,12 @@ - 192.168.123.110 + 10.0.0.250 8881 - N - 10.0 - 0.0 + Y + 20.0 + 0.02 10.0 diff --git a/prepare_unitree_ws.sh b/prepare_unitree_ws.sh new file mode 100755 index 0000000..b9b0d7c --- /dev/null +++ b/prepare_unitree_ws.sh @@ -0,0 +1,8 @@ +mkdir unitree_ws +cd unitree_ws +mkdir src +mkdir build +cd src +git clone https://github.com/Bytelogics/unitree_ros.git +git clone https://github.com/Bytelogics/unitree_ros_to_real.git +rm -rf unitree_ros_to_real/unitree_legged_real \ No newline at end of file diff --git a/z1_simulator_gui.Dockerfile b/z1_simulator_gui.Dockerfile new file mode 100644 index 0000000..9340430 --- /dev/null +++ b/z1_simulator_gui.Dockerfile @@ -0,0 +1,12 @@ +FROM osrf/ros:noetic-desktop-full + +RUN apt-get update +RUN apt-get -y install python3-catkin-tools ros-noetic-catkin + +ADD unitree_ws /data/unitree_ws +SHELL ["/bin/bash", "-c"] +WORKDIR data/unitree_ws/ +RUN source /ros_entrypoint.sh && /opt/ros/noetic/bin/catkin_make +ENV CMAKE_PREFIX_PATH=/opt/ros/noetic + +CMD source devel/setup.bash && roslaunch unitree_gazebo z1.launch