Skip to content

Commit

Permalink
cvhuigui entfernt, livetest-scripts angepasst
Browse files Browse the repository at this point in the history
  • Loading branch information
deshalb committed Jun 27, 2012
1 parent 5807145 commit afb5f2a
Show file tree
Hide file tree
Showing 5 changed files with 29 additions and 53 deletions.
7 changes: 7 additions & 0 deletions buoy.orogen
Original file line number Diff line number Diff line change
Expand Up @@ -149,3 +149,10 @@ task_context "Detector" do
port_driven("frame")
end

deployment "buoy_test" do
task "buoy_survey", "buoy::Survey"
task "buoy_detector", "buoy::Detector"

add_default_logger
end

12 changes: 10 additions & 2 deletions scripts/livetest.rb
Original file line number Diff line number Diff line change
Expand Up @@ -3,20 +3,28 @@
include Orocos

Orocos::CORBA.name_service = "192.168.128.51"


Orocos.initialize

#Orocos.run "buoydetector" do
Orocos.run("buoydetector_test" => nil, :wait => 20) do
detector = Orocos::TaskContext.get "buoydetector_test"
Orocos.run("buoy_test" => nil, :wait => 20) do
survey = Orocos::TaskContext.get "buoy_survey"
detector = Orocos::TaskContext.get "buoy_detector"
camera = Orocos::TaskContext.get "front_camera"

#Vizkit.display detector.buoy
#Vizkit.display detector.relative_position

camera.frame.connect_to detector.frame
detector.buoy.connect_to survey.input_buoy

detector.configure
detector.start

survey.configure
survey.start

Vizkit.display camera.frame

begin
Expand Down
15 changes: 10 additions & 5 deletions scripts/livetest_simulation.rb
Original file line number Diff line number Diff line change
Expand Up @@ -8,20 +8,25 @@
Orocos.initialize

#Orocos.run "buoydetector" do
Orocos.run("buoydetector_test" => nil, :wait => 20) do
detector = TaskContext.get "buoydetector_test"
#camera = Orocos::TaskContext.get "front_camera"
camera = TaskContext.get 'front_camera_simulation'
Orocos.run("buoy_test" => nil, :wait => 20) do
survey = Orocos::TaskContext.get "buoy_survey"
detector = Orocos::TaskContext.get "buoy_detector"
camera = TaskContext.get 'front_camera'
# camera.start

buoy_monitor = Vizkit.display detector.buoy

Vizkit.display detector.relative_position
Vizkit.display survey.relative_position

camera.frame.connect_to detector.frame
detector.buoy.connect_to survey.input_buoy

detector.configure
detector.start

survey.configure
survey.start

# Vizkit.display camera.frame

begin
Expand Down
47 changes: 2 additions & 45 deletions tasks/Detector.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,6 @@ int buoys_buffer_size=5,buoys_buffer_size_min=3,startvalidation=100,mindist=100,
int vValue = 0;
int hValue = 0;
int sValue = 0;
bool debug_gui = true;

using namespace avalon;
using namespace buoy;
Expand Down Expand Up @@ -106,23 +105,6 @@ bool Detector::startHook()
filter.setMindist(mindist);
filter.setMaxage(maxage,true);

if(_debug_gui){
cvNamedWindow(GUI_WINDOW_NAME, CV_WINDOW_NORMAL);
cvResizeWindow(GUI_WINDOW_NAME, 800, 600);
cvNamedWindow("Trackbars",CV_WINDOW_NORMAL);


cvCreateTrackbar("Hue Threshold", "Trackbars", &hValue, 255, on_change_Hvalue);
cvCreateTrackbar("Saturation Threshold", "Trackbars", &sValue, 255, on_change_Svalue);
cvCreateTrackbar("Hough Threshold", "Trackbars", &houghTh, 256, on_change_hough_th);
cvCreateTrackbar("Sobel Threshold", "Trackbars", &edgeTh, 256, on_change_edge_th);

//cvCreateTrackbar("bufferSize", "Trackbars", &buoys_buffer_size, 30, on_change_bufferSize);
//cvCreateTrackbar("bufferSizeMin", "Trackbars", &buoys_buffer_size_min, 15, on_change_bufferSizeMin);
//cvCreateTrackbar("startValidation", "Trackbars", &startvalidation, 200, on_change_startVal);
//cvCreateTrackbar("mindist", "Trackbars", &mindist, 300, on_change_mindist);
cvCreateTrackbar("maxage in 10ms", "Trackbars", &maxage, 500, on_change_maxage);
}
return true;
}

Expand All @@ -146,38 +128,17 @@ void Detector::updateHook()
}
bool testMode = false;

if(_debug_gui){
detector.configureHoughThreshold(houghTh);
detector.configureEdgeThreshold(edgeTh);

filter.setBufferSize(buoys_buffer_size);
filter.setMinSize(buoys_buffer_size_min);
filter.setStartval(startvalidation);
filter.setMindist(mindist);
filter.setMaxage(maxage,true);
testMode = true;
}else{
filter.setMaxage((double)_filter_timeout);
}
filter.setMaxage((double)_filter_timeout);

BuoyFeatureVector result = detector.buoyDetection(&image, hValue, sValue, _debug_gui);
BuoyFeatureVector result = detector.buoyDetection(&image, _hValue.get(), _sValue.get(), false);
filter.feed(result);

if(_debug_gui){
for(unsigned int i=0;i<result.size();i++)
{
BuoyDetector::draw(&image, result[i], CV_RGB(0,0,255));
}
}

BuoyFeatureVector vector = filter.process();
//wenn die boje gefunden wurde schreibe sie raus
if (vector.size() > 0 && vector.front().validation>-1) {
feature::Buoy& buoy=vector.front();
//vector.front()=buoy;
if(_debug_gui){
BuoyDetector::draw(&image, buoy,CV_RGB(255, 0, 0));
}
_buoy.write(buoy);
current_state = BUOY_FOUND;
}else { //wenn keine boje gefunden wurde, schreibe eine neue mit negativem Radius
Expand All @@ -194,9 +155,5 @@ void Detector::updateHook()

void Detector::cleanupHook() {
DetectorBase::cleanupHook();

if(_debug_gui){
cvDestroyWindow(GUI_WINDOW_NAME);
}
}

1 change: 0 additions & 1 deletion tasks/Detector.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@
#define BUOY_DETECTOR_TASK_HPP

#include "opencv/cv.h"
#include "opencv/highgui.h"
#include "buoy/DetectorBase.hpp"
#include "visual_detectors/buoy_detector.h"
#include "visual_detectors/buoy_estimation_filter.h"
Expand Down

0 comments on commit afb5f2a

Please sign in to comment.