/simple_serial_port_reader

Read, search, and format texts from a serial port

Primary LanguageCMakeMIT LicenseMIT

simple_serial_port_reader

Read, search, and format texts from a serial port

Published topics

formatted (simple_serial_port_reader_msgs/StringStamped)

  • formatted texts

Parameters

~device (string, default: "/dev/ttyUSB0")

~baud_rate (int, default: 9600)

~start_command (string, default: "")

  • command to write just after opening the serial port
  • write nothing if empty
  • c/c++ espace sequences are replaced to corresponding characters (ex. "\n" to newline, "\r" to carriage return)

~match_expression (string, default: "(.+)\r?\n")

  • regular expression to match read texts
  • the default matches each entire line

~format_expression (string, default: "$1")

  • format string to be applied to match results
  • the default extracts 1st matched group in the match expression (i.e. with the default match expression, all charactors except newline charactors will be extracted)

~stop_command (string, default: "")

  • command to write just before closing the serial port
  • write nothing if empty
  • c/c++ espace sequences are replaced to corresponding characters before writing

~verbose (bool, default: false)

  • print texts wrote, read and formatted if true

Example