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

Frank/trail detection node #57

Open
wants to merge 22 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from 3 commits
Commits
Show all changes
22 commits
Select commit Hold shift + click to select a range
a5644d4
Trail_detection_node package
FrankZhaodong Aug 31, 2023
efd93a1
add psp model, change the coordinate conversion
FrankZhaodong Aug 31, 2023
e51e85e
Create README.md
FrankZhaodong Sep 6, 2023
9beb822
Delete trail_detection_node/trail_detection_node/__pycache__ directory
FrankZhaodong Sep 8, 2023
306fa05
Delete trail_detection_node/trail_detection_node/base_models directory
FrankZhaodong Sep 8, 2023
b3034b0
Delete trail_detection_node/trail_detection_node/GANav_visualizer.py
FrankZhaodong Sep 8, 2023
a5ea74b
Delete trail_detection_node/trail_detection_node/jpu.py
FrankZhaodong Sep 8, 2023
4b7abe5
Delete trail_detection_node/trail_detection_node/model_store.py
FrankZhaodong Sep 8, 2023
f902b9e
Delete trail_detection_node/trail_detection_node/segbase.py
FrankZhaodong Sep 8, 2023
7fd0167
Delete trail_detection_node/trail_detection_node/v1_trailDetectionNod…
FrankZhaodong Sep 8, 2023
ff03ab6
Delete trail_detection_node/trail_detection_node/visualizer_v1_trailD…
FrankZhaodong Sep 8, 2023
de2828e
Delete trail_detection_node/trail_detection_node/vgg.py
FrankZhaodong Sep 8, 2023
7e21927
merged all the model loading part into one file
FrankZhaodong Sep 8, 2023
b27a0cc
deleted the fcn8s and fcn32s from the script
FrankZhaodong Sep 8, 2023
6d7d978
Delete trail_detection_node/trail_detection_node/v2_trailDetectionNod…
FrankZhaodong Sep 11, 2023
d52f6b4
Delete trail_detection_node/trail_detection_node/visualizer_v2_trailD…
FrankZhaodong Sep 11, 2023
3849886
merge visualization and msg publish node
FrankZhaodong Sep 11, 2023
975fc45
Update setup.py
FrankZhaodong Sep 17, 2023
9927b75
Update test.py
FrankZhaodong Sep 17, 2023
d42767c
Update package.xml
FrankZhaodong Sep 17, 2023
5bc9924
Update README.md
FrankZhaodong Sep 17, 2023
6ca4640
Update trailDetectionNode.py
FrankZhaodong Sep 17, 2023
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
33 changes: 33 additions & 0 deletions trail_detection_node/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
SETUP GUIDE
=============
1. Create a new folder named ```model``` in trail_detection_node/trail_detection_node
2. Download ```psp_resnet50_pascal_voc_best_model.pth``` in NCRN Google Drive (Trail detection model folder) and put the file in the ```model``` folder
3. Download ```resnet50-25c4b509.pth``` in NCRN Google Drive (Trail detection model folder) and put the file in folder ```~/.torch/models```
4. Build the package

RUN the node
=============
The package contains two nodes:
1. The node that takes the camera and lidar data and sends the Posestamp message
```
ros2 run trail_detection_node trail_detection
```
2. The node that takes the camera and lidar data and shows the visualization of the output
```
ros2 run trail_detection_node visualizer
```

Possible issues
=============
1. **Model doesn't load successfully:**
Change the directory in the ```load model``` function in both ```trail_detection_node/trail_detection_node/v2_trailDetectionNode.py```(line 103 and 104) and ```trail_detection_node/trail_detection_node/visualizer_v2_trailDetectionNode.py```(line 107 and 110)
2. **Subfolder package relative import error:**
Temporary fix: Move the script to the same folder and change the import code

Scripts explanation
=============
1. ```v1_trailDetectionNode.py``` and ```v2_trailDetectionNode.py```: two versions of ros2 node that sends the Posestamp message
FrankZhaodong marked this conversation as resolved.
Show resolved Hide resolved
2. ```visualizer_v1_trailDetectionNode.py``` and ```visualizer_v2_trailDetectionNode.py```: two versions of ros2 visualization node
3. ```GANav_visualizer.py```: ros2 visualization node for GANav model
4. ```jpu.py```, ```model_loader.py```, ```model_store.py```, ```segbase.py```, ```vgg.py```, and ```base_models``` folder: model loaders for FCN32S. FCN8s, and PSPNet. Copied from: https://github.com/Tramac/awesome-semantic-segmentation-pytorch

21 changes: 21 additions & 0 deletions trail_detection_node/package.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
<?xml version="1.0"?>
<?xml-model href="http://download.ros.org/schema/package_format3.xsd" schematypens="http://www.w3.org/2001/XMLSchema"?>
<package format="3">
<name>trail_detection_node</name>
<version>0.0.0</version>
<description>TODO: Package description</description>
<maintainer email="[email protected]">zhaodong</maintainer>
FrankZhaodong marked this conversation as resolved.
Show resolved Hide resolved
<license>TODO: License declaration</license>

<depend>sensor_msgs</depend>
<depend>cv_bridge</depend>

<test_depend>ament_copyright</test_depend>
<test_depend>ament_flake8</test_depend>
<test_depend>ament_pep257</test_depend>
<test_depend>python3-pytest</test_depend>

<export>
<build_type>ament_python</build_type>
</export>
</package>
Empty file.
4 changes: 4 additions & 0 deletions trail_detection_node/setup.cfg
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
[develop]
script_dir=$base/lib/trail_detection_node
[install]
install_scripts=$base/lib/trail_detection_node
28 changes: 28 additions & 0 deletions trail_detection_node/setup.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
from setuptools import setup

package_name = 'trail_detection_node'

setup(
name=package_name,
version='0.0.0',
packages=[package_name],
data_files=[
('share/ament_index/resource_index/packages',
['resource/' + package_name]),
('share/' + package_name, ['package.xml']),
],
install_requires=['setuptools'],
zip_safe=True,
maintainer='zhaodong',
maintainer_email='[email protected]',
FrankZhaodong marked this conversation as resolved.
Show resolved Hide resolved
description='TODO: Package description',
license='TODO: License declaration',
tests_require=['pytest'],
entry_points={
'console_scripts': [
'trail_detection = trail_detection_node.v2_trailDetectionNode:main',
'visualizer = trail_detection_node.visualizer_v2_trailDetectionNode:main',
FrankZhaodong marked this conversation as resolved.
Show resolved Hide resolved
'original_visualizer = trail_detection_node.visualizer_v1_trailDetectionNode:main',
],
},
)
3 changes: 3 additions & 0 deletions trail_detection_node/test.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
from trail_detection_node.visualizer_v2_trailDetectionNode import *

FrankZhaodong marked this conversation as resolved.
Show resolved Hide resolved
main()
25 changes: 25 additions & 0 deletions trail_detection_node/test/test_copyright.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
# Copyright 2015 Open Source Robotics Foundation, Inc.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.

from ament_copyright.main import main
import pytest


# Remove the `skip` decorator once the source file(s) have a copyright header
@pytest.mark.skip(reason='No copyright header has been placed in the generated source file.')
@pytest.mark.copyright
@pytest.mark.linter
def test_copyright():
rc = main(argv=['.', 'test'])
assert rc == 0, 'Found errors'
25 changes: 25 additions & 0 deletions trail_detection_node/test/test_flake8.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
# Copyright 2017 Open Source Robotics Foundation, Inc.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.

from ament_flake8.main import main_with_errors
import pytest


@pytest.mark.flake8
@pytest.mark.linter
def test_flake8():
rc, errors = main_with_errors(argv=[])
assert rc == 0, \
'Found %d code style errors / warnings:\n' % len(errors) + \
'\n'.join(errors)
23 changes: 23 additions & 0 deletions trail_detection_node/test/test_pep257.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
# Copyright 2015 Open Source Robotics Foundation, Inc.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.

from ament_pep257.main import main
import pytest


@pytest.mark.linter
@pytest.mark.pep257
def test_pep257():
rc = main(argv=['.', 'test'])
assert rc == 0, 'Found code style errors / warnings'
Loading