Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Ben/obs det only six cells #19

Open
wants to merge 14 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -162,5 +162,6 @@ cython_debug/
# ignore NOVA external repos, log and install drs
src/external/
src/phinix_ui/
src/manager/
log/
install/
150 changes: 150 additions & 0 deletions build_stack_humble.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,150 @@
#ARG ROS_DISTRO=humble
#FROM openvino/ubuntu20_dev:2023.2.0
#ARG USE_RVIZ
#ARG BUILD_SEQUENTIAL=0
#ARG OPENCV_VERSION=4.7.0
#ENV DEBIAN_FRONTEND=noninteractive
#USER root
#RUN useradd -m docker && echo "docker:docker" | chpasswd && adduser docker sudo
sudo echo 'ALL ALL=(ALL) NOPASSWD:ALL' >> /etc/sudoers
sudo apt-get update -q && \
apt-get upgrade -yq && \
DEBIAN_FRONTEND=noninteractive apt-get install -yq --no-install-recommends keyboard-configuration language-pack-en && \
DEBIAN_FRONTEND=noninteractive apt-get install -yq --no-install-recommends software-properties-common libusb-1.0-0-dev wget curl git build-essential ca-certificates tzdata tmux gnupg2 \
vim sudo lsb-release locales bash-completion zsh iproute2 iputils-ping net-tools dnsutils && \
rm -rf /var/lib/apt/lists/*

# setup timezone
sudo echo 'Etc/UTC' > /etc/timezone && \
# ln -s /usr/share/zoneinfo/Etc/UTC /etc/localtime && \
apt-get update && \
apt-get install -q -y --no-install-recommends tzdata && \
rm -rf /var/lib/apt/lists/*

# install packages
sudo apt-get update && apt-get install -q -y --no-install-recommends \
dirmngr \
gnupg2 \
&& rm -rf /var/lib/apt/lists/*

# setup sources.list
#sudo echo "deb http://packages.ros.org/ros2/ubuntu focal main" > /etc/apt/sources.list.d/ros2-latest.list

# setup keys
#sudo apt-key adv --keyserver hkp://keyserver.ubuntu.com:80 --recv-keys C1CF6E31E6BADE8868B172B4F42ED6FBAB17C654

# setup environment
#ENV LANG C.UTF-8
#ENV LC_ALL C.UTF-8

#ENV ROS_DISTRO humble

# install ros2 packages
sudo apt-get update && apt-get install -y --no-install-recommends \
ros-humble-ros-core=0.9.2-1* \
&& rm -rf /var/lib/apt/lists/*

# install bootstrap tools
sudo apt-get update && apt-get install --no-install-recommends -y \
build-essential \
git \
software-properties-common \
libusb-1.0-0-dev \
python3-colcon-common-extensions \
python3-colcon-mixin \
python3-rosdep \
python3-vcstool \
&& rm -rf /var/lib/apt/lists/*

# bootstrap rosdep
rosdep init && \
rosdep update --rosdistro $ROS_DISTRO

# setup colcon mixin and metadata
colcon mixin add default \
https://raw.githubusercontent.com/colcon/colcon-mixin-repository/master/index.yaml && \
colcon mixin update && \
colcon metadata add default \
https://raw.githubusercontent.com/colcon/colcon-metadata-repository/master/index.yaml && \
colcon metadata update

# install ros2 packages
sudo apt-get update && apt-get install -y --no-install-recommends \
ros-humble-ros-base=0.9.2-1* \
&& rm -rf /var/lib/apt/lists/*

sudo apt-get update && apt-get install -y --no-install-recommends \
libqt5svg5 ros-humble-rviz2 ros-humble-rviz2 ros-humble-vision-msgs ros-humble-cv-bridge ros-humble-camera-info-manager* ros-humble-image-transport*\
&& rm -rf /var/lib/apt/lists/*

python3 -m pip install --upgrade pip

# install dependencies for obstacle detector
python3 -m pip install pyopencl

# install dependencies for TTS
sudo apt-get update && apt-get install -y --no-install-recommends \
libportaudio2
python3 -m pip install sounddevice
python3 -m pip install -i https://pypi.fury.io/balacoon/ balacoon-tts
python3 -m pip install pydub

# install dependencies for Text detection
python3 -m pip install pip install rapidocr-openvinogpu

cd /opt/
# Install OpenCV from Source
git clone --depth 1 --branch ${OPENCV_VERSION} https://github.com/opencv/opencv.git && \
git clone --depth 1 --branch ${OPENCV_VERSION} https://github.com/opencv/opencv_contrib.git && \
cd opencv && \
mkdir build && \
cd build && \
cmake \
-D CMAKE_BUILD_TYPE=RELEASE \
-D CMAKE_INSTALL_PREFIX=/usr/ \
-D PYTHON3_PACKAGES_PATH=/usr/lib/python3/dist-packages \
-D WITH_V4L=ON \
-D WITH_QT=OFF \
-D WITH_OPENGL=ON \
-D WITH_GSTREAMER=ON \
-D OPENCV_GENERATE_PKGCONFIG=ON \
-D OPENCV_ENABLE_NONFREE=ON \
-D OPENCV_EXTRA_MODULES_PATH=/opt/opencv_contrib/modules \
-D INSTALL_PYTHON_EXAMPLES=OFF \
-D INSTALL_C_EXAMPLES=OFF \
-D BUILD_EXAMPLES=OFF .. && \
make -j"$(nproc)" && \
make install

# install dependencies for openwakeword
sudo apt-get update && apt-get install -y --no-install-recommends \
libspeexdsp-dev portaudio19-dev python3-pyaudio pulseaudio
python3 -m pip install openwakeword \
https://github.com/dscripka/openWakeWord/releases/download/v0.1.1/speexdsp_ns-0.1.2-cp310-cp310-linux_x86_64.whl

# install dependancies for bt connection
pyhton3 -m pip install bluepy

# install dependancies for SFX UI
python3 -m pip install -U pygame --user

# install dependancies for wakeword
python3 -m pip install playsound

cd /home/
mkdir -p /home/PHINIX
#COPY ./ /home/PHINIX
# RUN wget -qO- https://raw.githubusercontent.com/luxonis/depthai-ros/main/install_dependencies.sh | sudo bash
sh -c "$(wget https://raw.github.com/ohmyzsh/ohmyzsh/master/tools/install.sh -O -)"
cd /home/PHINIX/src/external && rosdep install --from-paths . --ignore-src -y
#ENV DEBIAN_FRONTEND=dialog
cd /home/PHINIX/src/external && cmake -S depthai-python/depthai-core -B /build -D CMAKE_BUILD_TYPE=Release -D BUILD_SHARED_LIBS=ON -D CMAKE_INSTALL_PREFIX=/usr/local
cmake --build /build --parallel 4 --config Relase --target install
cd /home/PHINIX/src/external/depthai-python && python3 -m pip install .
python3 -m pip install blobconverter
sudo apt install pocl-opencl-icd -y
python3 -m pip install rapidocr_openvino
python3 -m pip install ultralytics==8.0.231
sudo apt-get install libspeexdsp-dev
python3 -m pip install openwakeword https://github.com/dscripka/openWakeWord/releases/download/v0.1.1/speexdsp_ns-0.1.2-cp310-cp310-linux_x86_64.whl
cd /home/PHINIX
45 changes: 16 additions & 29 deletions docs/setup_local.md
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
## This document describes how to setup NUC to run PHINIX locally.

### Install Ubuntu
* Download Ubuntu 20.04 from [here](https://releases.ubuntu.com/focal/)
* Follow instructions to install Ubuntu 22.04-iot and GPU drivers [here](https://github.com/intel/edge-insights-vision)

* Installation: follow the instructions from [here](https://ubuntu.com/tutorials/install-ubuntu-desktop#1-overview).

Expand All @@ -13,41 +13,28 @@

* Set up SSH key using [this](https://docs.github.com/en/authentication/connecting-to-github-with-ssh/generating-a-new-ssh-key-and-adding-it-to-the-ssh-agent).

### Install ROS2 Foxy
* Install ROS2 Foxy using the binary version. Follow [this](https://docs.ros.org/en/foxy/Installation/Ubuntu-Install-Debians.html).
### Install ROS2 Humble
* Install ROS2 Humble using the binary version. Follow [this](https://docs.ros.org/en/humble/Installation/Ubuntu-Install-Debians.html).

* Include `source /opt/ros/foxy/setup.bash` in bashrc.
* Include `source /opt/ros/humble/setup.bash` in bashrc.

* Make sure ROS2 installed correctly by running the talker listener examples explained in the above link.

* Install colcon for ROS2, follow [here](https://colcon.readthedocs.io/en/released/user/installation.html).

### Install VCS tool
* `sudo pip install vcstool`
### Install Dependancies
* `sudo sh build_stack_humble.sh`

### Install OpenVINO
* Install OpenVino following the steps [here](https://docs.openvino.ai/latest/openvino_docs_install_guides_installing_openvino_from_archive_linux.html).
### Test With DepthAi Demo
* To make sure the camera is functioning properly, you can run the DepthAi demo `https://github.com/luxonis/depthai#depthai-api-demo-program`

* Install development tools by following C++ instructions [here](https://docs.openvino.ai/latest/openvino_docs_install_guides_install_dev_tools.html#install-dev-tools).
### Pull External Repos
* `sh setup_code.sh`

* Install requirements for at least tensorflow2, pytorch, onnx. Eg: `pip install -r tools/requirements_pytorch.txt`
### Build PHINIX
* Source ROS2 `source /opt/ros/humble/setup.bash`
* Build PHINX `colcon build`
* Source your install folder `source install/setup.bash`

* [This](https://docs.openvino.ai/2022.3/notebooks/002-openvino-api-with-output.html#loading-openvino-runtime-and-showing-info) example should be working.

* Install Opencl Openvino runtime : https://github.com/intel/compute-runtime/

* Install GPU requirements: https://github.com/intel/compute-runtime/releases/tag/22.35.24055

### Install depthai-ros

* Follow steps [here](https://github.com/luxonis/depthai-ros).

* Probably building from source is a better idea as it provides more control. Check [here](https://github.com/luxonis/depthai-ros#install-from-source)

* `ros2 launch depthai_ros_driver camera.launch.py` should produce the necessary topics.

* Note: The above command doesn’t work for OAK-D Lite.

### Text detection (currently only OpenVINO GPU is supported)

* `python3 -m pip install rapidocr-openvinogpu`
### Launch all nodes at once with launch.py
* `ros2 launch phinix_launch phinix.launch.py camera_model:=OAK-D-PRO-W`
32 changes: 27 additions & 5 deletions phinix.repos
Original file line number Diff line number Diff line change
@@ -1,13 +1,35 @@
repositories:
src/external/depthai-ros:
src/manager/phinix_node_manager:
type: git
url: https://github.com/luxonis/depthai-ros.git
version: foxy
url: [email protected]:ximira-org/phinix_node_manager.git
version: main

src/phinix_ui/phinix_tts_balacoon:
type: git
url: [email protected]:ximira-org/phinix_tts_balacoon.git
version: main
version: ben/tts_broadcasts_availability

src/phinix_ui/phinix_openwakeword:
type: git
url: [email protected]:ximira-org/phinix_openwakeword.git
version: main
version: ben/connect_to_node_manager

src/phinix_ui/phinix_sound_effects_ui:
type: git
url: [email protected]:ximira-org/phinix_sound_effects_ui.git
version: ben/direct_depth_sfx_ui

src/phinix_ui/phinix_haptics_ui:
type: git
url: [email protected]:ximira-org/phinix_haptics_ui.git
version: main

src/phinix_ui/phinix_ui_message_juggler:
type: git
url: [email protected]:ximira-org/phinix_ui_message_juggler.git
version: ben/integrate_with_ui

src/phinix_ui/phinix_obstacle_detector_ui_translator:
type: git
url: [email protected]:ximira-org/phinix_obstacle_detector_ui_translator.git
version: ben/obs_det_only_six_cells
34 changes: 32 additions & 2 deletions src/launch/phinix_launch/launch/phinix.launch.py
Original file line number Diff line number Diff line change
Expand Up @@ -78,19 +78,49 @@ def generate_launch_description():
parameters=[LaunchConfiguration('face_rec_node_param_file')],
)

phinix_sound_effects_ui_node = Node(
package="phinix_sound_effects_ui",
executable="phinix_sound_effects_ui_py_exe"
)

phinix_haptics_ui_node = Node(
package="phinix_haptics_ui",
executable="phinix_haptics_ui_py_exe"
)

phinix_node_manager_node = Node(
package="phinix_node_manager",
executable="phinix_node_manager_py_exe"
)

phinix_ui_message_juggler_node = Node(
package="phinix_ui_message_juggler",
executable="phinix_ui_message_juggler_py_exe"
)

phinix_obstacle_detector_ui_translator_node = Node(
package="phinix_obstacle_detector_ui_translator",
executable="phinix_obstacle_detector_ui_translator_py_exe"
)


ld = [
oak_ros_node,
phinix_obstacle_detector_node,
tts_balacoon_param,
face_rec__param,
phinix_text_detector_node,
# phinix_tts_simulator_node,
#phinix_tts_simulator_node,
phinix_tts_balacoon_node,
phinix_sensor_abstractor_node,
phinix_face_rec_node,
phinix_face_reg_node,
# phinix_wakeword_node
phinix_wakeword_node,
phinix_sound_effects_ui_node,
phinix_haptics_ui_node,
phinix_node_manager_node,
phinix_ui_message_juggler_node,
phinix_obstacle_detector_ui_translator_node
]

return LaunchDescription(ld)
Expand Down
Loading