This article focuses on the basic example tutorial on how to use HornedSungem in ROS.
This document is only available for the multi-model version. If HornedSungem hardware version is too low, please update the firmware of the corresponding version.
The operating system selected for our documentation is Ubuntu 16.04
ROS Kinetic ONLY supports Wily (Ubuntu 15.10), Xenial (Ubuntu 16.04) and Jessie (Debian 8) for debian packages.
Setup your computer to accept software from packages.ros.org,and set up your keys.
sudo sh -c 'echo "deb http://packages.ros.org/ros/ubuntu $(lsb_release -sc) main" > /etc/apt/sources.list.d/ros-latest.list'
sudo apt-key adv --keyserver hkp://ha.pool.sks-keyservers.net:80 --recv-key 421C365BD9FF1F717815A3895523BAEEB01FA116
First, make sure your Debian package index is up-to-date,recommended to install the full version
sudo apt-get update
sudo apt-get install ros-kinetic-desktop-full
Before you can use ROS, you will need to initialize rosdep. rosdep enables you to easily install system dependencies for source you want to compile and is required to run some core components in ROS.
sudo rosdep init
rosdep update
It’s convenient if the ROS environment variables are automatically added to your bash session every time a new shell is launched:
echo "source /opt/ros/kinetic/setup.bash" >> ~/.bashrc
source ~/.bashrc
To install this tool and other dependencies for building ROS packages, run:
sudo apt-get install python-rosinstall python-rosinstall-generator python-wstool build-essential
LinkUbuntu install of ROS Kinetic
Download SungemSDK-ROS
git clone --recursive https://github.com/HornedSungem/SungemSDK-ROS.git
If the install.sh script file has not been executed, cd to the directory and execute the script file.
cd SungemSDK-ROS/src/SungemSDK/installer/Linux/
./install.sh
Prepare the required resource files, model and data files, git latest SungemSDK-GraphModels, or download from Baidu cloud disk, and link the directory to the system. If you don’t want to put it under the system, you can modify the model in the horned_sungem_launch/config directory. The graph_file_path and category_file_path parameters of the configuration file ensure that the file can be found under the path.
git clone https://github.com/HornedSungem/SungemSDK-GraphModels.git
sudo cp -r <workspace>/SungemSDK-GraphModels /opt/SungemSDK-GraphModels
We can now build that package using catkin_make:
cd SungemSDK-ROS
catkin_make
Before continuing remember to source your environment setup file if you have not already. On Ubuntu it would be something like this:
source devel/setup.bash
Check the ROS package path is correct
echo $ROS_PACKAGE_PATH
/home/<user_name>/SungemSDK-ROS/src:/opt/ros/kinetic/share
hint:
If you just want to run tests on your remote machine , set these environment variables:
Find the host IP address:
ifconfig
For example, the host ip is 192.168.50.201, and the following commands are executed on the current terminal:
export ROS_MASTER_URI=http://192.168.50.201:11311
export ROS_IP=192.168.50.201
After configuring the above environment, let me introduce how to use SungemSDK-ROS. According to the demand, we provide two modes:
Standard USB camera:
If you do not configure the ROS camera package, you need to install the environment first.
sudo apt-get install ros-kinetic-usb-cam
Example:use mobilenetssd model for detection
Open the terminal and load the nodelet:
roslaunch horned_sungem_launch hs_camera.launch cnn_type:=mobilenetssd camera:=usb
Open a new terminal and load the image:
roslaunch horned_sungem_launch hs_detection_example.launch camera_topic:="/usb_cam/image_raw"
Node: camera_topic is fixed
Bring your own camera:
Example: The following describes the detection using the yolo model
Open the terminal and load the nodelet,Accepte 360P
roslaunch horned_sungem_launch hs_camera.launch cnn_type:=yolo camera:=hs pixels:=360:
Open a new terminal and load the image:
roslaunch horned_sungem_launch hs_detection_example.launch camera_topic:="/hs/camera/image_raw"
In the horned_sungem_launch folder, you can view all the launch files, which are used to start multiple nodes to complete complex requirements. You can modify them according to your project requirements. Now let me introduce the parameters included in the launch file.
Node: Parameters should be in lowercase.
The current screenshot is in ubuntu16.0.4 environment, camera is hs, pixels is 1080, cnn_type is yolo.
Opencv conflict error:
If you want to keep the ROS and Python environment coexisting, you need to comment out the source /opt/ros/kinetic/setup.bash line of the .bashrc file. Otherwise, calling the python example will report the opencv reference type error. Solution:
Import library error:
Solution: The problem is libhs.so is not loaded, first make sure that the file exists, and then execute sudo ldconfig in the terminal. The other solution is to update the latest version of ROS library, no need to copy the library file to the system directory.
Launch file error: Solution: The terminal executes source SungemSDK-ROS/devel/setup.bash.
Compile Error: Solution: The Raspberry Pi may have a parameter error. Delete the corresponding parameter in the corresponding CMakeLists.txt.