Skip to content

Commit

Permalink
chore: rename package to adhere naming conventions.
Browse files Browse the repository at this point in the history
  • Loading branch information
jws-1 committed Jan 29, 2024
1 parent d51889e commit a8cd19c
Show file tree
Hide file tree
Showing 15 changed files with 33 additions and 27 deletions.
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
cmake_minimum_required(VERSION 3.0.2)
project(lasr_face_recognition)
project(lasr_vision_deepface)

## Compile as C++11, supported in ROS Kinetic and newer
# add_compile_options(-std=c++11)
Expand Down Expand Up @@ -104,7 +104,7 @@ catkin_generate_virtualenv(
## DEPENDS: system dependencies of this project that dependent projects also need
catkin_package(
# INCLUDE_DIRS include
# LIBRARIES lasr_face_recognition
# LIBRARIES lasr_vision_deepface
# CATKIN_DEPENDS rospy
# DEPENDS system_lib
)
Expand All @@ -122,7 +122,7 @@ include_directories(

## Declare a C++ library
# add_library(${PROJECT_NAME}
# src/${PROJECT_NAME}/lasr_face_recognition.cpp
# src/${PROJECT_NAME}/lasr_vision_deepface.cpp
# )

## Add cmake target dependencies of the library
Expand All @@ -133,7 +133,7 @@ include_directories(
## Declare a C++ executable
## With catkin_make all packages are built within a single CMake context
## The recommended prefix ensures that target names across packages don't collide
# add_executable(${PROJECT_NAME}_node src/lasr_face_recognition_node.cpp)
# add_executable(${PROJECT_NAME}_node src/lasr_vision_deepface_node.cpp)

## Rename C++ executable without prefix
## The above recommended prefix causes long target names, the following renames the
Expand Down Expand Up @@ -200,7 +200,7 @@ catkin_install_python(PROGRAMS
#############

## Add gtest based cpp test target and link libraries
# catkin_add_gtest(${PROJECT_NAME}-test test/test_lasr_face_recognition.cpp)
# catkin_add_gtest(${PROJECT_NAME}-test test/test_lasr_vision_deepface.cpp)
# if(TARGET ${PROJECT_NAME}-test)
# target_link_libraries(${PROJECT_NAME}-test ${PROJECT_NAME})
# endif()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,15 +6,15 @@
<arg name="dataset" default="lab" doc="Dataset to use for the demo" />

<!-- yolo service -->
<include file="$(find lasr_face_recognition)/launch/service.launch">
<include file="$(find lasr_vision_deepface)/launch/service.launch">
<arg name="debug" value="true" />
</include>

<!-- show debug topic -->
<node name="image_view" pkg="rqt_image_view" type="rqt_image_view" respawn="false" output="screen" args="/recognise/debug" />

<!-- start relay service -->
<node name="relay" pkg="lasr_face_recognition" type="relay" respawn="false" output="screen" args="/camera/image_raw $(arg dataset)" />
<node name="relay" pkg="lasr_vision_deepface" type="relay" respawn="false" output="screen" args="/camera/image_raw $(arg dataset)" />

<!-- launch video stream -->
<include file="$(find video_stream_opencv)/launch/camera.launch">
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@

<arg name="debug" default="false" doc="Whether to publish plotted images to /recognise/debug" />

<node name="face_recognition_service" pkg="lasr_face_recognition" type="service" output="screen">
<node name="face_recognition_service" pkg="lasr_vision_deepface" type="service" output="screen">
<param name="debug" type="bool" value="$(arg debug)" />
</node>
</launch>
Original file line number Diff line number Diff line change
Expand Up @@ -2,30 +2,33 @@

import re
import rospy
import lasr_face_recognition as face_recognition
import lasr_vision_deepface as face_recognition
from sensor_msgs.msg import Image
from lasr_vision_msgs.srv import Recognise, RecogniseRequest, RecogniseResponse

rospy.init_node('recognise_service')
rospy.init_node("recognise_service")

# Determine variables
DEBUG = rospy.get_param('~debug', False)
DEBUG = rospy.get_param("~debug", False)

debug_publishers = {}
if DEBUG:
debug_publisher = rospy.Publisher("/recognise/debug", Image, queue_size=1)

def detect(request : RecogniseRequest) -> RecogniseResponse:

def detect(request: RecogniseRequest) -> RecogniseResponse:
debug_publisher = None
if DEBUG:
if request.dataset in debug_publishers:
debug_publisher = debug_publishers[request.dataset]
else:
topic_name = re.sub(r'[\W_]+', '', request.dataset)
debug_publisher = rospy.Publisher(f'/recognise/debug/{topic_name}', Image, queue_size=1)
topic_name = re.sub(r"[\W_]+", "", request.dataset)
debug_publisher = rospy.Publisher(
f"/recognise/debug/{topic_name}", Image, queue_size=1
)
return face_recognition.detect(request, debug_publisher)


rospy.Service('/recognise', Recognise, detect)
rospy.loginfo('Face Recognition service starter')
rospy.spin()
rospy.Service("/recognise", Recognise, detect)
rospy.loginfo("Face Recognition service starter")
rospy.spin()
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
<?xml version="1.0"?>
<package format="2">
<name>lasr_face_recognition</name>
<name>lasr_vision_deepface</name>
<version>0.0.0</version>
<description>The lasr_face_recognition package</description>
<description>The lasr_vision_deepface package</description>

<!-- One maintainer tag required, multiple allowed, one person per tag -->
<!-- Example: -->
Expand All @@ -19,7 +19,7 @@
<!-- Url tags are optional, but multiple are allowed, one per tag -->
<!-- Optional attribute type can be: website, bugtracker, or repository -->
<!-- Example: -->
<!-- <url type="website">http://wiki.ros.org/lasr_face_recognition</url> -->
<!-- <url type="website">http://wiki.ros.org/lasr_vision_deepface</url> -->


<!-- Author tags are optional, multiple are allowed, one per tag -->
Expand Down
Original file line number Diff line number Diff line change
@@ -1,10 +1,12 @@
#!/usr/bin/env python3

import sys
import lasr_face_recognition as face_recognition
import lasr_vision_deepface as face_recognition

if len(sys.argv) < 3:
print("usage: rosrun lasr_face_recognition create_dataset.py <dataset> <name> [size=50]")
print(
"usage: rosrun lasr_vision_deepface create_dataset.py <dataset> <name> [size=50]"
)
exit(0)

dataset = sys.argv[1]
Expand All @@ -22,7 +24,9 @@ import os
import cv2_img
import cv2

DATASET_ROOT = os.path.join(rospkg.RosPack().get_path("lasr_face_recognition"), "datasets")
DATASET_ROOT = os.path.join(
rospkg.RosPack().get_path("lasr_vision_deepface"), "datasets"
)
DATASET_PATH = os.path.join(DATASET_ROOT, dataset, name)
if not os.path.exists(DATASET_PATH):
os.makedirs(DATASET_PATH)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,7 @@
from catkin_pkg.python_setup import generate_distutils_setup

setup_args = generate_distutils_setup(
packages=['lasr_face_recognition'],
package_dir={'': 'src'}
packages=["lasr_vision_deepface"], package_dir={"": "src"}
)

setup(**setup_args)
setup(**setup_args)
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
from lasr_vision_msgs.srv import RecogniseRequest, RecogniseResponse

DATASET_ROOT = os.path.join(
rospkg.RosPack().get_path("lasr_face_recognition"), "datasets"
rospkg.RosPack().get_path("lasr_vision_deepface"), "datasets"
)

Mat = int # np.typing.NDArray[np.uint8]
Expand Down

0 comments on commit a8cd19c

Please sign in to comment.