Skip to content

Instantly share code, notes, and snippets.

@Lichor8
Last active August 29, 2015 14:23
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save Lichor8/a802b10a3d6e4a043da2 to your computer and use it in GitHub Desktop.
Save Lichor8/a802b10a3d6e4a043da2 to your computer and use it in GitHub Desktop.
detection.h
//===================================
// include guard (safety measure)
#ifndef DETECTION_H // if not defined
#define DETECTION_H // define
//===================================
// forward declared dependencies
//===================================
// included dependencies
#include <iostream>
#include <emc/io.h> // embedded motion control package
#include <emc/rate.h>
#include <ctime>
#include <string>
#include <unistd.h>
#include <stdlib.h>
#include <cmath> // math operation such as sqrt(),cos()
#include <math.h> // more math
#include <fstream>
#include "picomath.h"
#include "opencvf.h" // contains all the opencv dependencies
#include "eigen3/Eigen/Dense"
//===================================
// the actual class
class Detection {
private:
//general
Point curloc; // current position of the robit (x,y,theta) [m] and [rad].
Point origin; // origin of the coordinate system (x,y,theta) [m] and [rad].
// mprocessing
std::vector<Point> corners;
bool plot;
// sitrec
Situation sit;
Situation sit_prev;
int tol_filter;
int filter;
// slam
// computational entities
// measurement processing
void mprocessing(emc::IO &io, emc::LaserData scan, emc::OdometryData odom);
// situation recognition
void sitrec(emc::IO &io, emc::LaserData scan, emc::OdometryData odom);
// slam
void slam(emc::IO &io, emc::LaserData scan, emc::OdometryData odom);
// subcomputational entities
// slam
void prediction(emc::OdometryData odom);
void save_marker(emc::OdometryData odom, Point x);
int check_marker(Point x, emc::LaserData y);
void update(emc::OdometryData odom, std::vector<Point> edges, emc::LaserData scan);
void MyEllipse( cv::Mat img, cv::Point point, cv::Scalar color );
void MyCircle(cv::Mat img, cv::Point center, int radius, const cv::Scalar color);
void drawing(std::vector<Point> edges);
void drawPoint(int x, int y, int color);
void grid();
cv::Point2f m2px(cv::Point2f, int, int);
cv::Point2f px2m(cv::Point2f, int, int);
public:
// coordinators/composers
void detection(emc::IO &io, emc::LaserData scan, emc::OdometryData odom);
// monitors
bool monitor();
// configurators
void ResetOdomOrigin(Point current_location);
void ResetOdomOrigin(emc::OdometryData current_location);
// class entities
// constructors (sets default values or input values to the private variables when an object of class Detection is made for the first time)
Detection(); // default values
// getters (able to get values of the private variables of this class)
Point getCurrentLocation();
std::vector<Point> getCorners();
Situation getSituation();
// setters (able to set values to the private variables of this class)
};
#endif // CONVERT_H
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment