24 size_t len = s.size();
25 const uint8_t *data =
reinterpret_cast<const uint8_t *
>(s.c_str());
33 for (
auto const &val : values)
43 LOG_DEBUG(
"Sending program [%s]", s.c_str());
49 if (voltage != 0 || voltage != 12 || voltage != 24)
52 std::ostringstream out;
53 out <<
"set_tool_voltage(" << (int)voltage <<
")\n";
54 std::string
s(out.str());
60 std::ostringstream out;
61 out <<
"set_flag(" << (int)pin <<
"," << (value ?
"True" :
"False") <<
")\n";
62 std::string
s(out.str());
67 std::ostringstream out;
68 out <<
"set_payload(" << std::fixed << std::setprecision(5) << value <<
")\n";
69 std::string
s(out.str());
75 std::ostringstream out;
76 out <<
"stopj(" << std::fixed << std::setprecision(5) << a <<
")\n";
77 std::string
s(out.str());
83 std::ostringstream out;
84 out << std::fixed << std::setprecision(5);
87 out <<
"," << acceleration <<
"," << 0.02 <<
")\n";
88 std::string
s(out.str());
93 std::ostringstream out;
94 out <<
"sec io_fun():\n" 95 <<
"set_analog_out(" << (int)pin <<
"," << std::fixed << std::setprecision(4) << value <<
")\n" 97 std::string
s(out.str());
103 std::ostringstream out;
104 out <<
"sec io_fun():\n" 105 <<
"set_digital_out(" << (int)pin <<
"," << (value ?
"True" :
"False") <<
")\n" 107 std::string
s(out.str());
113 std::ostringstream out;
114 out <<
"sec io_fun():\n" 115 <<
"set_standard_analog_out(" << (int)pin <<
"," << std::fixed << std::setprecision(5) << value <<
")\n" 117 std::string
s(out.str());
123 std::ostringstream out;
128 func =
"set_standard_digital_out";
132 func =
"set_configurable_digital_out";
137 func =
"set_tool_digital_out";
143 out <<
"sec io_fun():\n" 144 << func <<
"(" << (int)pin <<
"," << (value ?
"True" :
"False") <<
")\n" 146 std::string
s(out.str());
152 std::ostringstream out;
153 out << std::fixed << std::setprecision(5);
156 out <<
"," << acceleration <<
")\n";
157 std::string
s(out.str());
163 std::ostringstream out;
164 out << std::fixed << std::setprecision(5);
167 out <<
"," << acceleration <<
"," << 0.008 <<
")\n";
168 std::string
s(out.str());
virtual bool setDigitalOut(uint8_t pin, bool value)
virtual bool setAnalogOut(uint8_t pin, double value)
void formatArray(std::ostringstream &out, std::array< double, 6 > &values)
bool uploadProg(const std::string &s)
#define LOG_DEBUG(format,...)
bool setToolVoltage(uint8_t voltage)
virtual bool speedj(std::array< double, 6 > &speeds, double acceleration)
virtual bool setAnalogOut(uint8_t pin, double value)
bool setPayload(double value)
bool stopj(double a=10.0)
bool write(const std::string &s)
bool setFlag(uint8_t pin, bool value)
virtual bool speedj(std::array< double, 6 > &speeds, double acceleration)
virtual bool setDigitalOut(uint8_t pin, bool value)
bool write(const uint8_t *buf, size_t buf_len, size_t &written)
virtual bool speedj(std::array< double, 6 > &speeds, double acceleration)