forked from leggedrobotics/darknet_ros
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request leggedrobotics#287 from leggedrobotics/feature/nod…
…eletize Feature/nodeletize
- Loading branch information
Showing
6 changed files
with
88 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
<?xml version="1.0" encoding="utf-8"?> | ||
|
||
<launch> | ||
<!-- Console launch prefix --> | ||
<arg name="launch_prefix" default=""/> | ||
|
||
<!-- Config and weights folder. --> | ||
<arg name="yolo_weights_path" default="$(find darknet_ros)/yolo_network_config/weights"/> | ||
<arg name="yolo_config_path" default="$(find darknet_ros)/yolo_network_config/cfg"/> | ||
|
||
<!-- ROS parameter files --> | ||
<arg name="ros_param_file" default="$(find darknet_ros)/config/ros.yaml"/> | ||
<arg name="network_param_file" default="$(find darknet_ros)/config/yolov2-tiny.yaml"/> | ||
|
||
<!-- Load parameters --> | ||
<rosparam command="load" ns="darknet_ros_nodelet" file="$(arg ros_param_file)"/> | ||
<rosparam command="load" ns="darknet_ros_nodelet" file="$(arg network_param_file)"/> | ||
|
||
<!-- Darknet and ros wrapper nodelet manager --> | ||
<node name="darknet_ros_nodelet_manager" type="nodelet" pkg="nodelet" args="manager" output="screen"/> | ||
|
||
<!-- Start darknet and ros wrapper --> | ||
<node pkg="nodelet" type="nodelet" name="darknet_ros_nodelet" output="screen" launch-prefix="$(arg launch_prefix)" args="load darknet_ros_nodelet darknet_ros_nodelet_manager"> | ||
<param name="weights_path" value="$(arg yolo_weights_path)" /> | ||
<param name="config_path" value="$(arg yolo_config_path)" /> | ||
</node> | ||
|
||
|
||
<!--<node name="republish" type="republish" pkg="image_transport" output="screen" args="compressed in:=/front_camera/image_raw raw out:=/camera/image_raw" /> --> | ||
</launch> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
<library path="lib/libdarknet_ros_nodelet"> | ||
|
||
<!-- Darknet Ros Plugin --> | ||
<class name="darknet_ros_nodelet" type="DarknetRosNodelet" base_class_type="nodelet::Nodelet"> | ||
<description>Darknet Ros Nodelet.</description> | ||
</class> | ||
|
||
</library> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
/* | ||
* Author: Timon Homberger | ||
* Institute: ETH Zurich, Robotic Systems Lab | ||
*/ | ||
|
||
#include <nodelet/nodelet.h> | ||
#include <pluginlib/class_list_macros.h> | ||
#include <ros/ros.h> | ||
#include <darknet_ros/YoloObjectDetector.hpp> | ||
|
||
class DarknetRosNodelet : public nodelet::Nodelet { | ||
public: | ||
DarknetRosNodelet() = default; | ||
~DarknetRosNodelet() { | ||
if (darknetRos_) delete darknetRos_; | ||
} | ||
|
||
private: | ||
virtual void onInit() { | ||
ros::NodeHandle NodeHandle("~"); | ||
NodeHandle = getPrivateNodeHandle(); | ||
darknetRos_ = new darknet_ros::YoloObjectDetector(NodeHandle); | ||
} | ||
|
||
darknet_ros::YoloObjectDetector* darknetRos_; | ||
}; | ||
|
||
// Declare as a Plug-in | ||
PLUGINLIB_EXPORT_CLASS(DarknetRosNodelet, nodelet::Nodelet); |