Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -2,3 +2,7 @@
examples/build/*
data/*
!data/.gitkeep

src/evl/html
src/docs/build
src/docs/doxygen/*
29 changes: 28 additions & 1 deletion src/evl/core/common.hpp
Original file line number Diff line number Diff line change
@@ -1,9 +1,36 @@
// Copyright 2018 Event Vision Library.
/******************************************************************************/
/*! @addtogroup EVL_CORE
@file common.hpp
@brief Common header file for global mutex variable.
*******************************************************************************
Detail We have "mutex" in common for multi threading.
*******************************************************************************
@date 2018/09/01
@author Event Vision Library
@par Revision
0.1
@par Copyright
2018-2018 Event Vision Library. All rights reserved.
*******************************************************************************
@par History
- 2018/09/01 shiba
-# Initial Version
******************************************************************************/

/*! @ingroup EVL_CORE */
/* @{ */

#ifndef SRC_EVL_CORE_COMMON_HPP_
#define SRC_EVL_CORE_COMMON_HPP_

#include <mutex>

/*! @var mutex
@brief Global variable inside this library.

mutex lock for multi threading.

*/
extern std::mutex mtx;

#endif // SRC_EVL_CORE_COMMON_HPP_
34 changes: 32 additions & 2 deletions src/evl/core/initialize_davis.hpp
Original file line number Diff line number Diff line change
@@ -1,10 +1,40 @@
// Copyright 2018 Event Vision Library.
/******************************************************************************/
/*! @addtogroup EVL_CORE
@file initialize_davis.hpp
@brief Initializing DAVIS.
*******************************************************************************
Detail
*******************************************************************************
@date 2018/09/01
@author Event Vision Library
@par Revision
0.1
@par Copyright
2018-2018 Event Vision Library. All rights reserved.
*******************************************************************************
@par History
- 2018/09/01 shiba
-# Initial Version
******************************************************************************/

/*! @ingroup EVL_CORE */
/* @{ */

#ifndef SRC_EVL_CORE_INITIALIZE_DAVIS_HPP_
#define SRC_EVL_CORE_INITIALIZE_DAVIS_HPP_

#include "types.hpp"

namespace evl {
namespace evl {

/******************************************************************************/
/*! @brief Initialize DAVIS before reading data.

Configuring several parameters and setting up ready to read DAVIS.
@return Success 1, failure 0
@exception Raise error when there is no DAVIS connected.
@todo(shiba) Input argument as DAVIS ID (default=1).
******************************************************************************/
Davis initializeDavis(void);
} // namespace evl

Expand Down
45 changes: 44 additions & 1 deletion src/evl/core/read_buffer.hpp
Original file line number Diff line number Diff line change
@@ -1,4 +1,25 @@
// Copyright 2018 Event Vision Library.
/******************************************************************************/
/*! @addtogroup EVL_CORE
@file read_buffer.hpp
@brief
*******************************************************************************
Detail
*******************************************************************************
@date 2018/09/01
@author Event Vision Library
@par Revision
0.1
@par Copyright
2018-2018 Event Vision Library. All rights reserved.
*******************************************************************************
@par History
- 2018/09/01 shiba
-# Initial Version
******************************************************************************/

/*! @ingroup EVL_CORE */
/* @{ */

#ifndef SRC_EVL_CORE_READ_BUFFER_HPP_
#define SRC_EVL_CORE_READ_BUFFER_HPP_

Expand All @@ -7,7 +28,29 @@
#include "types.hpp"

namespace evl {

/******************************************************************************/
/*! @brief Read buffered events based on lifetime.
Reading event data based on lifetime timestamp.

@param[in] *buffer (EventBuffer) Buffer to read events from.
@param[in] lifetime (int) Lifetime of events to read.

@return event_tuple (std::vector<EventTuple>) Vector of EventTuples.
@exception none
******************************************************************************/
std::vector<EventTuple> readBufferOnLifetime(EventBuffer *buffer, int lifetime);

/******************************************************************************/
/*! @brief Read buffered events based on number of events.
Reading event data based on how many events to read.

@param[in] *buffer (EventBuffer) Buffer to read events from.
@param[in] number (int) Number of events to read.

@return event_tuple (std::vector<EventTuple>) Vector of EventTuples.
@exception none
******************************************************************************/
std::vector<EventTuple> readBufferOnNumber(EventBuffer *buffer, int number);
} // namespace evl

Expand Down
33 changes: 32 additions & 1 deletion src/evl/core/save_csv.hpp
Original file line number Diff line number Diff line change
@@ -1,4 +1,24 @@
// Copyright 2018 Event Vision Library
/******************************************************************************/
/*! @addtogroup EVL_CORE
@file save_csv.hpp
@brief
*******************************************************************************
Detail
*******************************************************************************
@date 2018/09/01
@author Event Vision Library
@par Revision
0.1
@par Copyright
2018-2018 Event Vision Library. All rights reserved.
*******************************************************************************
@par History
- 2018/09/01 shiba
-# Initial Version
******************************************************************************/

/*! @ingroup EVL_CORE */
/* @{ */

#ifndef SRC_EVL_CORE_SAVE_CSV_HPP_
#define SRC_EVL_CORE_SAVE_CSV_HPP_
Expand All @@ -7,6 +27,17 @@
#include "types.hpp"

namespace evl {

/******************************************************************************/
/*! @brief Save buffered events to file.
Saving event data into csv file.

@param[in] *buffer (EventBuffer) Buffer which stores events.
@param[in] lifetime (int) Lifetime of events to read.
@param[in] filename (std::string) Filename to save event data (.csv or .txt).

@exception none
******************************************************************************/
void saveBuffer(EventBuffer *buffer, int lifetime, std::string filename);
} // namespace evl

Expand Down
43 changes: 37 additions & 6 deletions src/evl/core/shutdown.hpp
Original file line number Diff line number Diff line change
@@ -1,16 +1,47 @@
// Copyright 2018 Event Vision Library.
/******************************************************************************/
/*! @addtogroup EVL_CORE
@file shutdown.hpp
@brief
*******************************************************************************
Detail
*******************************************************************************
@date 2018/09/01
@author Event Vision Library
@par Revision
0.1
@par Copyright
2018-2018 Event Vision Library. All rights reserved.
*******************************************************************************
@par History
- 2018/09/01 shiba
-# Initial Version
******************************************************************************/

/*! @ingroup EVL_CORE */
/* @{ */

#ifndef SRC_EVL_CORE_SHUTDOWN_HPP_
#define SRC_EVL_CORE_SHUTDOWN_HPP_

#include <atomic>

namespace evl {

/*! @class Shutdown
@brief Shutdown handler of events.
Handling SIGINT when pushed CTRL+C.
*/
class Shutdown {
public:
static std::atomic_bool globalShutdown;
static void globalShutdownSignalHandler(int signal);
static void usbShutdownHandler(void *ptr);
int setSigHandler();
public:
/*! @var globalShutdown
@brief Shutdown signal

When get SIGINT, this variable is 1.
*/
static std::atomic_bool globalShutdown;
static void globalShutdownSignalHandler(int signal);
static void usbShutdownHandler(void *ptr);
int setSigHandler();
};
} // namespace evl

Expand Down
46 changes: 44 additions & 2 deletions src/evl/core/store_buffer.hpp
Original file line number Diff line number Diff line change
@@ -1,11 +1,53 @@
// Copyright 2018 Event Vision Library.
/******************************************************************************/
/*! @addtogroup EVL_CORE
@file store_buffer.hpp
@brief Store buffer of event data.
*******************************************************************************
Detail
*******************************************************************************
@date 2018/09/01
@author Event Vision Library
@par Revision
0.1
@par Copyright
2018-2018 Event Vision Library. All rights reserved.
*******************************************************************************
@par History
- 2018/09/01 shiba
-# Initial Version
******************************************************************************/

/*! @ingroup EVL_CORE */
/* @{ */

#ifndef SRC_EVL_CORE_STORE_BUFFER_HPP_
#define SRC_EVL_CORE_STORE_BUFFER_HPP_

#include "types.hpp"

namespace evl {
void storeBufferFromCsv(EventBuffer *buffer, char* fname);

/******************************************************************************/
/*! @brief Store events from CSV file to buffer.
Store events from CSV file to buffer.
Offline reader.

@param[in] *buffer (EventBuffer) Buffer to store events.
@param[in] *fname (char) Filename of saved events (.csv or .txt).

@exception none
******************************************************************************/
void storeBufferFromCsv(EventBuffer *buffer, char *fname);

/******************************************************************************/
/*! @brief Store events from DAVIS to buffer.
Store events from DAVIS to buffer.
Online reader.

@param[in] *buffer (EventBuffer) Buffer to store events.

@exception none
******************************************************************************/
void storeBufferFromDavis(EventBuffer *buffer);
} // namespace evl

Expand Down
54 changes: 52 additions & 2 deletions src/evl/core/types.hpp
Original file line number Diff line number Diff line change
@@ -1,4 +1,25 @@
// Copyright 2018 Event Vision Library.
/******************************************************************************/
/*! @addtogroup EVL_CORE
@file types.hpp
@brief Type definitions for EVL.
*******************************************************************************
Detail
*******************************************************************************
@date 2018/09/01
@author Event Vision Library
@par Revision
0.1
@par Copyright
2018-2018 Event Vision Library. All rights reserved.
*******************************************************************************
@par History
- 2018/09/01 shiba
-# Initial Version
******************************************************************************/

/*! @ingroup EVL_CORE */
/* @{ */

#ifndef SRC_EVL_CORE_TYPES_HPP_
#define SRC_EVL_CORE_TYPES_HPP_

Expand All @@ -8,10 +29,39 @@
#include <libcaercpp/libcaer.hpp>
#include <libcaercpp/devices/davis.hpp>

namespace evl {
/*! @namespace evl
@brief Base namespace.

Base namespce for this library.
*/
namespace evl
{

/*! @var EventTuple
@brief Tuple of events

Tuple of <int32_t timestamp, uint16_t x, uint16_t y, bool polarity>.
*/
typedef std::tuple<int32_t, uint16_t, uint16_t, bool> EventTuple;

/*! @var EventBuffer
@brief Buffer of events, using boost::circular_buffer.

This variable uses boost::circular_buffer.
@todo(shiba) more details here...
*/
typedef boost::circular_buffer<EventTuple> EventBuffer;

/*! @var EventPolarity
@brief Polarity of events, using libcaer.

Polarity means increase (+1) of decrease (0) of events.
*/
typedef libcaer::events::PolarityEventPacket EventPolarity;

/*! @var Davis
@brief Davis camera instance.
*/
typedef libcaer::devices::davis Davis;
} // namespace evl

Expand Down
Loading