Node for publishing dish states from a CSV file. More...
#include <csv_recv.h>
Public Member Functions | |
CsvReceiver () | |
Private Member Functions | |
bool | getParams () |
Gets server parameters. | |
void | init () |
Initializes and runs the node. | |
void | initPubs () |
Initializes ROS publishers. | |
const neuro_recv::dish_state | parse (const std::string &, bool record_time) |
Parses a single line in a CSV file and returns a new dish state. | |
void | publish () |
Publishes all remaining dish states. | |
void | publishBuffer () |
Publishes dish states used to buffer the burst creator. | |
Private Attributes | |
int | buffer_size_ |
ros::Publisher | dish_pub_burst_ |
ros::Publisher | dish_pub_viz_ |
ros::Publisher | dish_pub_volt_ |
bool | do_burst_calc_ |
bool | do_volt_distr_ |
std::ifstream | file_ |
std::string | file_name_ |
int | loop_rate_ |
ros::NodeHandle | n_ |
ros::Duration | offset_ |
int | skip_lines_ |
Node for publishing dish states from a CSV file.
This node receives data from a CSV file in order to test other nodes without needing a live link. The file path of the CSV file is a server parameter.
Definition at line 24 of file csv_recv.h.
CsvReceiver::CsvReceiver | ( | ) | [inline] |
Definition at line 27 of file csv_recv.h.
bool CsvReceiver::getParams | ( | ) | [private] |
Gets server parameters.
Definition at line 54 of file csv_recv.cpp.
void CsvReceiver::init | ( | ) | [private] |
Initializes and runs the node.
Gets server parameters, attempts to open the CSV file, initializes publishers, reads and parses file data, and publishes the dish states.
Definition at line 16 of file csv_recv.cpp.
void CsvReceiver::initPubs | ( | ) | [private] |
Initializes ROS publishers.
Definition at line 104 of file csv_recv.cpp.
const neuro_recv::dish_state CsvReceiver::parse | ( | const std::string & | s, |
bool | record_time | ||
) | [private] |
Parses a single line in a CSV file and returns a new dish state.
The input string must be 61 comma-separated values. The first value is an index and is ignored. The remaining 60 values are voltages for each channel in the MEA.
s | the input string |
record_time | whether or not to record the current time in the dish state |
Definition at line 221 of file csv_recv.cpp.
void CsvReceiver::publish | ( | ) | [private] |
Publishes all remaining dish states.
These dish states are sent to burst_creator, dish_viz, and volt_distr. This method must be called after publishBuffer.
Definition at line 163 of file csv_recv.cpp.
void CsvReceiver::publishBuffer | ( | ) | [private] |
Publishes dish states used to buffer the burst creator.
These dish states are only sent to the burst_creator node. This method must be called before publish.
Definition at line 134 of file csv_recv.cpp.
int CsvReceiver::buffer_size_ [private] |
Definition at line 49 of file csv_recv.h.
ros::Publisher CsvReceiver::dish_pub_burst_ [private] |
Definition at line 40 of file csv_recv.h.
ros::Publisher CsvReceiver::dish_pub_viz_ [private] |
Definition at line 39 of file csv_recv.h.
ros::Publisher CsvReceiver::dish_pub_volt_ [private] |
Definition at line 38 of file csv_recv.h.
bool CsvReceiver::do_burst_calc_ [private] |
Definition at line 47 of file csv_recv.h.
bool CsvReceiver::do_volt_distr_ [private] |
Definition at line 46 of file csv_recv.h.
std::ifstream CsvReceiver::file_ [private] |
Definition at line 44 of file csv_recv.h.
std::string CsvReceiver::file_name_ [private] |
Definition at line 43 of file csv_recv.h.
int CsvReceiver::loop_rate_ [private] |
Definition at line 50 of file csv_recv.h.
ros::NodeHandle CsvReceiver::n_ [private] |
Definition at line 37 of file csv_recv.h.
ros::Duration CsvReceiver::offset_ [private] |
Definition at line 41 of file csv_recv.h.
int CsvReceiver::skip_lines_ [private] |
Definition at line 48 of file csv_recv.h.