Skip to content
Snippets Groups Projects
Commit c18de7e4 authored by simon.fanetti's avatar simon.fanetti
Browse files

add valgrind debug

parent 2b8b819f
Branches
No related tags found
No related merge requests found
include ../ar_sandbox_lib/dep.mk
API_PATH=../ar_sandbox_lib API_PATH=../ar_sandbox_lib
CFLAGS=-std=c++11 -Wall -Wextra -g CFLAGS=-std=c++11 -Wall -Wextra -g
CCP=g++ CCP=g++
all: app all:
$(MAKE) -C app
app: app.o
$(CCP) $^ -o $@ -L$(API_PATH)/build -lsandbox $(DEP_SANDBOX)
%.o: %.cpp
$(CCP) $(CFLAGS) -I$(API_PATH)/inc -c $< -o $@
run: run:
./app $(MAKE) run -C app
setup: setup:
$(API_PATH)/app/SandboxSetup/SandboxSetup $(API_PATH)/app/SandboxSetup/SandboxSetup
debug:
$(MAKE) debug -C app
clean: clean:
rm -f *.o app $(MAKE) clean -C app
include ../../ar_sandbox_lib/dep.mk
API_PATH=../../ar_sandbox_lib
CFLAGS=-std=c++11 -Wall -Wextra -g
CCP=g++
all: app
app: app.o
$(CCP) $^ -o $@ -L$(API_PATH)/build -lsandbox $(DEP_SANDBOX)
%.o: %.cpp
$(CCP) $(CFLAGS) -I$(API_PATH)/inc -c $< -o $@
run:
./app
debug:
$(shell cd ../valgrind_profiles && valgrind --tool=callgrind --dump-instr=yes --simulate-cache=yes --collect-jumps=yes --collect-atstart=no --instr-atstart=no ../app/app)
clean:
rm -f *.o app
#include "app.h" #include "app.h"
#include <valgrind/callgrind.h>
Sandbox sandbox; Sandbox sandbox;
void (*apps[1])() = {showLevel}; void (*apps[1])() = {showLevel};
int main(int argc, char *argv[]) int main(int argc, char *argv[])
{ {
if(sandbox.loadConfig()){ if(sandbox.loadConfigFrom("../sandbox_conf.yaml")){
std::cout << "Failed to load the configuration" << std::endl; std::cout << "Failed to load the configuration" << std::endl;
return 1; return 1;
} }
...@@ -35,17 +35,55 @@ void showLevel(){ ...@@ -35,17 +35,55 @@ void showLevel(){
cv::namedWindow(windowName, CV_WINDOW_NORMAL); cv::namedWindow(windowName, CV_WINDOW_NORMAL);
cv::setWindowProperty(windowName, CV_WND_PROP_FULLSCREEN, CV_WINDOW_FULLSCREEN); cv::setWindowProperty(windowName, CV_WND_PROP_FULLSCREEN, CV_WINDOW_FULLSCREEN);
//
// Debug
//
/*
sandbox.captureFrame();
cv::Mat depth = sandbox.getDepthFrame();
cv::Mat colored = colorizeDepth(depth, top, sandboxHeight);
cv::Mat res;
cv::cvtColor(colored, res, CV_BGR2RGB);
CALLGRIND_START_INSTRUMENTATION;
CALLGRIND_TOGGLE_COLLECT;
res = sandbox.adjustProjection(res);
CALLGRIND_TOGGLE_COLLECT;
CALLGRIND_STOP_INSTRUMENTATION;
cv::imshow(windowName, res);
*/
//
// Default
//
do{ do{
sandbox.captureFrame();
cv::Mat depth = sandbox.getDepthFrame(); cv::Mat depth = sandbox.getDepthFrame();
cv::Mat colored = colorizeDepth(depth, top, sandboxHeight); cv::Mat colored = colorizeDepth(depth, top, sandboxHeight);
cv::Mat res; cv::Mat res;
cv::cvtColor(colored, res, CV_BGR2RGB); cv::cvtColor(colored, res, CV_BGR2RGB);
res = sandbox.adjustProjection(res); res = sandbox.adjustProjection(res);
cv::imshow(windowName, res); cv::imshow(windowName, res);
} while (cv::waitKey(10) != ESCAPE_CHAR); } while (cv::waitKey(10) != ESCAPE_CHAR);
//
// End
//
cv::destroyAllWindows(); cv::destroyAllWindows();
} }
......
#ifndef MY_APPS_H #ifndef MY_APPS_H
#define MY_APPS_H #define MY_APPS_H
#include "../ar_sandbox_lib/inc/sandbox.h" #include <sandbox.h>
#include <opencv2/opencv.hpp> #include <opencv2/opencv.hpp>
#define ESCAPE_CHAR 27 #define ESCAPE_CHAR 27
......
This diff is collapsed.
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment