36 this->
interface = interface;
47 Response response = interface->submitCmd(0x30,
nullptr, 0,
false);
66 printf(
"res_x = %d, res_y = %d, cell_width = %d, cell_height = %d, fullscale = %X\n",
79 for (y = 0; y < height; y++)
81 printf(
"%03X", matrix[y * width]);
83 for (
x = 1;
x < width;
x++)
85 printf(
", %03X", matrix[y * width +
x]);
95 unsigned char payload[1];
97 Response response = interface->submitCmd(0x20, payload,
sizeof(payload),
false);
98 return getFrameData(&response);
104 Response response = interface->receiveWithoutChecks();
106 if (response.
cmdId == 0x21)
108 response = interface->receiveWithoutChecks();
111 if (response.
cmdId == 0x00)
113 return getPeriodicFrameData(&response);
118 str(boost::format(
"Response ID (%02X) does not match submitted command ID (%02X)") %
119 (
int)response.
cmdId % (
int)0x00));
124 TactileSensor::getPeriodicFrameData(
Response* response)
131 int count = (response->
len - offset) / 2;
133 std::shared_ptr<std::vector<short>>
data;
134 data.reset(
new std::vector<short>(count, 0));
137 for (i = 0; i < count; i++)
147 TactileSensor::getFrameData(
Response* response)
154 int count = (response->
len - offset) / 2;
156 std::shared_ptr<std::vector<short>>
data;
157 data.reset(
new std::vector<short>(count, 0));
159 for (i = 0; i < count; i++)
171 unsigned char payload[3];
173 payload[1] = delay_ms & 0xFF;
174 payload[2] = (delay_ms >> 8) & 0xFF;
175 interface->fireAndForgetCmd(0x21, payload,
sizeof(payload),
false);
183 interface->fireAndForgetCmd(0x22,
nullptr, 0,
false);
186 while (waitCount > 0)
188 Response response = interface->receiveWithoutChecks();
190 if (response.
cmdId == 0x22)
198 "stopPeriodicFrameAcquisition :: Discarding Response with ID 0x%02X") %
211 unsigned char payload[1];
214 Response response = interface->submitCmd(0x23, payload,
sizeof(payload),
false);
225 unsigned char payload[4];
230 Response response = interface->submitCmd(0x31, payload,
sizeof(payload),
false);
250 unsigned char payload[2];
251 payload[0] = threshold & 0xFF;
252 payload[1] = (threshold >> 8) & 0xFF;
253 Response response = interface->submitCmd(0x34, payload,
sizeof(payload),
false);
261 Response response = interface->submitCmd(0x35,
nullptr, 0,
false);
275 unsigned char payload[1];
277 Response response = interface->submitCmd(0x36, payload,
sizeof(payload),
false);
289 Response response = interface->submitCmd(0x37,
nullptr, 0,
false);
292 unsigned char gain = response.
getByte(2);
302 Response response = interface->submitCmd(0x38,
nullptr, 0,
false);
305 std::string type = std::string((
char*)response.
data.data() + 2, response.
len - 2);
312 Response response = interface->submitCmd(0x46,
nullptr, 0,
false);
321 Response response = interface->submitCmd(0x50,
nullptr, 0,
false);
339 std::cout << boost::format(
"System Type=%1%, Hardware Revision=%2%, Firmware "
340 "Version=%3%.%4%.%5%.%6% (0x%7$04X), Serial Number=%8%") %
348 unsigned char* payload = (
unsigned char*)tag.c_str();
349 Response response = interface->submitCmd(0x51, payload, tag.length(),
false);
357 Response response = interface->submitCmd(0x52,
nullptr, 0,
false);
360 std::string tag = std::string((
char*)response.
data.data() + 2, response.
len - 2);
367 Response response = interface->submitCmd(0x52,
nullptr, 0,
false);
376 tag = std::string((
char*)response.
data.data() + 2, response.
len - 2);
389 return interface->toString();
395 return strm <<
a.interface;