5 PTUFree::PTUFree():ptu_io_service(), timer_io_service(), ptu_port(ptu_io_service) {
13 printf(
"Setting baud rate\n");
14 boost::system::error_code set_option_error_code;
15 ptu_port.set_option(boost::asio::serial_port_base::baud_rate(baud), set_option_error_code);
16 if(set_option_error_code.value() != boost::system::errc::success) {
18 printf(
"Setting baud to %d failed with error message: %s\n", baud, error_reason.c_str());
29 printf(
"Setting new Connection\n");
31 printf(
"Closing current Serial Port Connection\n");
35 boost::system::error_code open_error_code;
36 ptu_port.open(port, open_error_code);
37 if(open_error_code.value() != boost::system::errc::success) {
39 printf(
"Opening port %s failed with error message: %s", port.c_str(), error_reason.c_str());
45 tcflush(
ptu_port.lowest_layer().native_handle(), TCIOFLUSH);
47 ptu_port.set_option(boost::asio::serial_port_base::baud_rate(9600));
48 ptu_port.set_option(boost::asio::serial_port_base::character_size(8));
49 ptu_port.set_option(boost::asio::serial_port_base::stop_bits(boost::asio::serial_port_base::stop_bits::one));
50 ptu_port.set_option(boost::asio::serial_port_base::parity(boost::asio::serial_port_base::parity::none));
51 ptu_port.set_option(boost::asio::serial_port_base::flow_control(boost::asio::serial_port_base::flow_control::none));
72 boost::asio::write(
ptu_port, boost::asio::buffer(request.c_str(), request.size()));
80 std::string recieved_message;
83 boost::asio::read(
ptu_port, boost::asio::buffer(¤t_letter,1));
84 if(current_letter ==
'\n') {
87 size_t start_pos = recieved_message.find(
'*');
88 if(start_pos != std::string::npos) {
89 recieved_message = recieved_message.substr(start_pos);
91 return recieved_message;
94 recieved_message.push_back(current_letter);
100 std::vector<std::string> result;
101 result.push_back(response.substr(0, 1));
102 if(response.at(0) ==
'*') {
103 result.push_back(response.substr(1, response.length() - 1));
104 int start_position = 10000;
105 int end_position = 0;
106 size_t first_found_position = 0;
107 size_t last_found_position = 0;
108 for (
int i = 0; i < 10; i++) {
109 first_found_position = response.find(boost::lexical_cast<std::string>(i));
110 if(first_found_position != std::string::npos) {
111 if((
int) first_found_position < start_position) {
112 start_position = first_found_position;
115 last_found_position = response.rfind(boost::lexical_cast<std::string>(i));
116 if( last_found_position != std::string::npos) {
117 if((
int) last_found_position > end_position) {
118 end_position = last_found_position;
122 if(start_position <= end_position) {
123 if(response.at(start_position - 1) ==
'-') {
126 result.push_back(response.substr(start_position, end_position - start_position + 1));
132 result.push_back(response.substr(1, response.length() - 1));
140 std::string
command =
"pp" + boost::lexical_cast<std::string>(position) +
" ";
143 if(response_parts[0].at(0) ==
'*') {
147 printf(
"Error while setting desired absolute pan position to %d: %s\n", position, response_parts[1].c_str());
153 std::string
command =
"po" + boost::lexical_cast<std::string>(position_offset) +
" ";
156 if(response_parts[0].at(0) ==
'*') {
160 printf(
"Error while adding desired pan position offset of %d: %s\n", position_offset, response_parts[1].c_str());
166 std::string
command =
"ps" + boost::lexical_cast<std::string>(speed) +
" ";
169 if(response_parts[0].at(0) ==
'*') {
173 printf(
"Error while setting desired absolute pan speed to %d: %s\n", speed, response_parts[1].c_str());
181 std::string
command =
"pd" + boost::lexical_cast<std::string>(speed_offset) +
" ";
184 if(response_parts[0].at(0) ==
'*') {
188 printf(
"Error while setting desired pan speed offset to %d: %s\n", speed_offset, response_parts[1].c_str());
194 std::string
command =
"pa" + boost::lexical_cast<std::string>(acceleration) +
" ";
197 if(response_parts[0].at(0) ==
'*') {
201 printf(
"Error while setting absolute pan acceleration to %d: %s\n", acceleration, response_parts[1].c_str());
209 std::string
command =
"pu" + boost::lexical_cast<std::string>(upper_speed_limit) +
" ";
212 if(response_parts[0].at(0) ==
'*') {
216 printf(
"Error while setting absolute pan base speed to %d: %s\n", upper_speed_limit, response_parts[1].c_str());
225 std::string
command =
"pl" + boost::lexical_cast<std::string>(lower_speed_limit) +
" ";
228 if(response_parts[0].at(0) ==
'*') {
232 printf(
"Error while setting absolute lower speed limit to %d: %s\n", lower_speed_limit, response_parts[1].c_str());
238 std::string
command =
"pb" + boost::lexical_cast<std::string>(base_speed) +
" ";
241 if(response_parts[0].at(0) ==
'*') {
245 printf(
"Error while setting pan base speed to %d: %s\n", base_speed, response_parts[1].c_str());
256 if(response_parts[0].at(0) ==
'*') {
257 return boost::lexical_cast<
long>(response_parts[2]);
260 printf(
"Error while getting current pan position: %s\n", response_parts[1].c_str());
269 if(response_parts[0].at(0) ==
'*') {
270 return boost::lexical_cast<
long>(response_parts[2]);
273 printf(
"Error while getting current pan speed: %s\n", response_parts[1].c_str());
285 if(response_parts[0].at(0) ==
'*') {
286 return boost::lexical_cast<
long>(response_parts[2]);
289 printf(
"Error while getting current pan upper speed limit: %s\n", response_parts[1].c_str());
298 if(response_parts[0].at(0) ==
'*') {
299 return boost::lexical_cast<
long>(response_parts[2]);
302 printf(
"Error while getting curent pan lower speed limit: %s\n", response_parts[1].c_str());
311 if(response_parts[0].at(0) ==
'*') {
312 return boost::lexical_cast<
double>(response_parts[2]);
315 printf(
"Error while getting pan resolution: %s\n", response_parts[1].c_str());
324 if(response_parts[0].at(0) ==
'*') {
325 return boost::lexical_cast<
long>(response_parts[2]);
328 printf(
"Error while getting desired pan position: %s\n", response_parts[1].c_str());
337 if(response_parts[0].at(0) ==
'*') {
338 return boost::lexical_cast<
long>(response_parts[2]);
341 printf(
"Error while getting desired pan speed: %s\n", response_parts[1].c_str());
350 if(response_parts[0].at(0) ==
'*') {
351 return boost::lexical_cast<
long>(response_parts[2]);
354 printf(
"Error while getting desired pan acceleration (desired == current in this case): %s\n", response_parts[1].c_str());
363 if(response_parts[0].at(0) ==
'*') {
364 return boost::lexical_cast<
long>(response_parts[2]);
367 printf(
"Error while getting desired pan base speed: %s\n", response_parts[1].c_str());
376 std::string
command =
"tp" + boost::lexical_cast<std::string>(position) +
" ";
379 if(response_parts[0].at(0) ==
'*') {
383 printf(
"Error while setting desired absolute tilt position to %d: %s\n", position, response_parts[1].c_str());
389 std::string
command =
"to" + boost::lexical_cast<std::string>(position_offset) +
" ";
392 if(response_parts[0].at(0) ==
'*') {
396 printf(
"Error while adding desired tilt position offset of %d: %s\n", position_offset, response_parts[1].c_str());
402 std::string
command =
"ts" + boost::lexical_cast<std::string>(speed) +
" ";
405 if(response_parts[0].at(0) ==
'*') {
409 printf(
"Error while setting desired absolute tilt speed to %d: %s\n", speed, response_parts[1].c_str());
417 std::string
command =
"td" + boost::lexical_cast<std::string>(speed_offset) +
" ";
420 if(response_parts[0].at(0) ==
'*') {
424 printf(
"Error while setting desired tilt speed offset to %d: %s\n", speed_offset, response_parts[1].c_str());
430 std::string
command =
"ta" + boost::lexical_cast<std::string>(acceleration) +
" ";
433 if(response_parts[0].at(0) ==
'*') {
437 printf(
"Error while setting absolute tilt acceleration to %d: %s\n", acceleration, response_parts[1].c_str());
445 std::string
command =
"tu" + boost::lexical_cast<std::string>(upper_speed_limit) +
" ";
448 if(response_parts[0].at(0) ==
'*') {
452 printf(
"Error while setting desired tilt base speed to %d: %s\n", upper_speed_limit, response_parts[1].c_str());
461 std::string
command =
"tl" + boost::lexical_cast<std::string>(lower_speed_limit) +
" ";
464 if(response_parts[0].at(0) ==
'*') {
468 printf(
"Error while setting desired tilt lower speed limit to %d: %s\n", lower_speed_limit, response_parts[1].c_str());
474 std::string
command =
"tb" + boost::lexical_cast<std::string>(base_speed) +
" ";
477 if(response_parts[0].at(0) ==
'*') {
481 printf(
"Error while setting tilt base speed to %d: %s\n", base_speed, response_parts[1].c_str());
492 if(response_parts[0].at(0) ==
'*') {
493 return boost::lexical_cast<
long>(response_parts[2]);
496 printf(
"Error while getting current tilt position: %s\n", response_parts[1].c_str());
505 if(response_parts[0].at(0) ==
'*') {
506 return boost::lexical_cast<
long>(response_parts[2]);
509 printf(
"Error while getting current tilt speed: %s\n", response_parts[1].c_str());
521 if(response_parts[0].at(0) ==
'*') {
522 return boost::lexical_cast<
long>(response_parts[2]);
525 printf(
"Error while getting current tilt upper speed limit: %s\n", response_parts[1].c_str());
534 if(response_parts[0].at(0) ==
'*') {
535 return boost::lexical_cast<
long>(response_parts[2]);
538 printf(
"Error while getting curent tilt lower speed limit: %s\n", response_parts[1].c_str());
547 if(response_parts[0].at(0) ==
'*') {
548 return boost::lexical_cast<
double>(response_parts[2]);
551 printf(
"Error while getting tilt resolution: %s\n", response_parts[1].c_str());
560 if(response_parts[0].at(0) ==
'*') {
561 return boost::lexical_cast<
long>(response_parts[2]);
564 printf(
"Error while getting desired tilt position: %s\n", response_parts[1].c_str());
573 if(response_parts[0].at(0) ==
'*') {
574 return boost::lexical_cast<
long>(response_parts[2]);
577 printf(
"Error while getting desired tilt speed: %s\n", response_parts[1].c_str());
586 if(response_parts[0].at(0) ==
'*') {
587 return boost::lexical_cast<
long>(response_parts[2]);
590 printf(
"Error while getting desired tilt acceleration (desired == current in this case): %s\n", response_parts[1].c_str());
599 if(response_parts[0].at(0) ==
'*') {
600 return boost::lexical_cast<
long>(response_parts[2]);
603 printf(
"Error while getting desired tilt base speed: %s\n", response_parts[1].c_str());
622 printf(
"Error while setting limit enforcement mode: Unknown mode\n");
627 if(response_parts[0].at(0) ==
'*') {
631 printf(
"Error while setting limit enforcement: %s\n", response_parts[1].c_str());
637 std::string
command =
"pn" + boost::lexical_cast<std::string>(position) +
" ";
640 if(response_parts[0].at(0) ==
'*') {
644 printf(
"Error while setting minimum user pan position limit to %d: %s\n", position, response_parts[1].c_str());
649 std::string
command =
"px" + boost::lexical_cast<std::string>(position) +
" ";
652 if(response_parts[0].at(0) ==
'*') {
656 printf(
"Error while setting maximum user pan position limit to %d: %s\n", position, response_parts[1].c_str());
661 std::string
command =
"tn" + boost::lexical_cast<std::string>(position) +
" ";
664 if(response_parts[0].at(0) ==
'*') {
668 printf(
"Error while setting minimum user tilt position limit to %d: %s\n", position, response_parts[1].c_str());
673 std::string
command =
"tx" + boost::lexical_cast<std::string>(position) +
" ";
676 if(response_parts[0].at(0) ==
'*') {
680 printf(
"Error while setting maximum user tilt position limit to %d: %s\n", position, response_parts[1].c_str());
690 if(response_parts[0].at(0) ==
'*') {
691 return boost::lexical_cast<
long>(response_parts[2]);
694 printf(
"Error while getting minimum user pan position limit: %s\n", response_parts[1].c_str());
704 if(response_parts[0].at(0) ==
'*') {
705 return boost::lexical_cast<
long>(response_parts[2]);
708 printf(
"Error while getting maximum user pan position limit: %s\n", response_parts[1].c_str());
718 if(response_parts[0].at(0) ==
'*') {
719 return boost::lexical_cast<
long>(response_parts[2]);
722 printf(
"Error while getting minimum user tilt position limit: %s\n", response_parts[1].c_str());
732 if(response_parts[0].at(0) ==
'*') {
733 return boost::lexical_cast<
long>(response_parts[2]);
736 printf(
"Error while getting maximum user tilt position limit: %s\n", response_parts[1].c_str());
757 if(response_parts[0].at(0) ==
'*') {
758 return boost::lexical_cast<
long>(response_parts[2]);
761 printf(
"Error while getting currently used minimum pan position limit: %s\n", response_parts[1].c_str());
769 if(response_parts[0].at(0) ==
'*') {
770 return boost::lexical_cast<
long>(response_parts[2]);
773 printf(
"Error while getting currently used maximum pan position limit: %s\n", response_parts[1].c_str());
781 if(response_parts[0].at(0) ==
'*') {
782 return boost::lexical_cast<
long>(response_parts[2]);
785 printf(
"Error while getting currently used minimum tilt position limit: %s\n", response_parts[1].c_str());
793 if(response_parts[0].at(0) ==
'*') {
794 return boost::lexical_cast<
long>(response_parts[2]);
797 printf(
"Error while getting currently used maximum tilt position limit: %s\n", response_parts[1].c_str());
808 if(response.at(0) ==
'*') {
809 if(response_parts[1].find(
"DISABLED") != std::string::npos) {
812 else if (response_parts[1].find(
"user") != std::string::npos) {
820 printf(
"Error while getting currently used limit enforcement mode, %s\n", response_parts[1].c_str());
837 printf(
"Error while setting position execution mode: Unknown mode\n");
842 if(response_parts[0].at(0) ==
'*') {
847 printf(
"Error while setting position execution mode: %s\n", response_parts[1].c_str());
863 if(response_parts[0].at(0) ==
'*') {
867 printf(
"Error while awaiting command completion: %s\n", response_parts[1].c_str());
884 printf(
"Error while halting axis: Unknown mode\n");
889 if(response_parts[0].at(0) ==
'*') {
893 printf(
"Error while halting axis: %s\n", response_parts[1].c_str());
953 if((0 > preset_index) || (preset_index > 32)) {
956 std::string
command =
"xs" + boost::lexical_cast<std::string>(preset_index) +
" ";
959 if(response_parts[0].at(0) ==
'*') {
963 printf(
"Error while setting position preset: %s\n", response_parts[1].c_str());
970 std::string
command =
"xg" + boost::lexical_cast<std::string>(preset_index) +
" ";
973 if(response_parts[0].at(0) ==
'*') {
977 printf(
"Error while going to position preset: %s\n", response_parts[1].c_str());
987 if(response_parts[0].at(0) ==
'*') {
991 printf(
"Error while clearing position presets: %s\n", response_parts[1].c_str());
1005 printf(
"Error while setting speed control mode: Unknown command\n");
1010 if(response_parts[0].at(0) ==
'*') {
1014 printf(
"Error while setting speed control mode: %s\n", response_parts[1].c_str());
1024 if(response_parts[0].at(0) ==
'*') {
1025 if(response_parts[1].find(
"independent") != std::string::npos) {
1033 printf(
"Error while getting speed control mode: %s\n", response_parts[1].c_str());
1041 printf(
"RESET MESSAGE: %s\n", response.c_str());
1043 if(response_parts[0].at(0) ==
'*') {
1047 printf(
"Error while resetting the ptu unit: %s\n", response_parts[1].c_str());
1067 printf(
"Error while setting reset mode: Unknown command\n");
1072 if(response_parts[0].at(0) ==
'*') {
1076 printf(
"Error while setting reset mode: %s\n", response_parts[1].c_str());
1085 if(response_parts[0].at(0) ==
'*') {
1089 printf(
"Error while saving current axis settings as default: %s\n", response_parts[1].c_str());
1098 if(response_parts[0].at(0) ==
'*') {
1102 printf(
"Error while restoring default axis settings: %s\n", response_parts[1].c_str());
1111 if(response_parts[0].at(0) ==
'*') {
1115 printf(
"Error while restoring factory default axis settings: %s\n", response_parts[1].c_str());
1132 printf(
"Error while setting pan stationary power mode: Unknown command\n");
1137 if(response_parts[0].at(0) ==
'*') {
1141 printf(
"Error while setting pan stationary power mode: %s\n", response_parts[1].c_str());
1158 printf(
"Error while setting pan stationary power mode: Unknown command\n");
1163 if(response_parts[0].at(0) ==
'*') {
1167 printf(
"Error while setting pan stationary power mode: %s\n", response_parts[1].c_str());
1176 if(response_parts[0].at(0) ==
'*') {
1177 if(response_parts[1].find(
"REGULAR") != std::string::npos) {
1180 if(response_parts[1].find(
"LOW") != std::string::npos) {
1188 printf(
"Error while getting pan stationary power mode: %s\n", response_parts[1].c_str());
1196 if(response_parts[0].at(0) ==
'*') {
1197 if(response_parts[1].find(
"REGULAR") != std::string::npos) {
1200 if(response_parts[1].find(
"LOW") != std::string::npos) {
1208 printf(
"Error while getting tilt stationary power mode: %s\n", response_parts[1].c_str());
1225 printf(
"Error while setting pan in-motion power mode: Unknown command\n");
1230 if(response_parts[0].at(0) ==
'*') {
1234 printf(
"Error while setting pan in-motion power mode: %s\n", response_parts[1].c_str());
1250 printf(
"Error while setting tilt in-motion power mode: Unknown command\n");
1255 if(response_parts[0].at(0) ==
'*') {
1259 printf(
"Error while setting tilt in-motion power mode: %s\n", response_parts[1].c_str());
1268 if(response_parts[0].at(0) ==
'*') {
1269 if(response_parts[1].find(
"REGULAR") != std::string::npos) {
1272 if(response_parts[1].find(
"LOW") != std::string::npos) {
1280 printf(
"Error while getting pan in-motion power mode: %s\n", response_parts[1].c_str());
1288 if(response_parts[0].at(0) ==
'*') {
1289 if(response_parts[1].find(
"REGULAR") != std::string::npos) {
1292 if(response_parts[1].find(
"LOW") != std::string::npos) {
1300 printf(
"Error while getting tilt in-motion power mode: %s\n", response_parts[1].c_str());
1306 switch (error.value()) {
1307 case boost::system::errc::success: {
1311 case boost::system::errc::address_family_not_supported: {
1312 return "address_family_not_supported | EAFNOSUPPORT";
1315 case boost::system::errc::address_in_use: {
1316 return "address_in_use | EADDRINUSE";
1319 case boost::system::errc::address_not_available: {
1320 return "address_not_available | EADDRNOTAVAIL";
1323 case boost::system::errc::already_connected: {
1324 return "already_connected | EISCONN";
1327 case boost::system::errc::argument_list_too_long: {
1328 return "argument_list_too_long | E2BIG";
1331 case boost::system::errc::argument_out_of_domain: {
1332 return "argument_out_of_domain | EDOM";
1335 case boost::system::errc::bad_address: {
1336 return "bad_address | EFAULT";
1339 case boost::system::errc::bad_file_descriptor: {
1340 return "bad_file_descriptor | EBADF";
1343 case boost::system::errc::bad_message: {
1344 return "bad_message | EBADMSG";
1347 case boost::system::errc::broken_pipe: {
1348 return "broken_pipe | EPIPE";
1351 case boost::system::errc::connection_aborted: {
1352 return "connection_aborted | ECONNABORTED";
1355 case boost::system::errc::connection_already_in_progress: {
1356 return "connection_already_in_progress | EALREADY";
1359 case boost::system::errc::connection_refused: {
1360 return "connection_refused | ECONNREFUSED";
1363 case boost::system::errc::connection_reset: {
1364 return "connection_reset | ECONNRESET";
1367 case boost::system::errc::cross_device_link: {
1368 return "cross_device_link | EXDEV";
1371 case boost::system::errc::destination_address_required: {
1372 return "destination_address_required | EDESTADDRREQ";
1375 case boost::system::errc::device_or_resource_busy: {
1376 return "device_or_resource_busy | EBUSY";
1379 case boost::system::errc::directory_not_empty: {
1380 return "directory_not_empty | ENOTEMPTY";
1383 case boost::system::errc::executable_format_error: {
1384 return "executable_format_error | ENOEXEC";
1387 case boost::system::errc::file_exists: {
1388 return "file_exists | EEXIST";
1391 case boost::system::errc::file_too_large: {
1392 return "file_too_large | EFBIG";
1395 case boost::system::errc::filename_too_long: {
1396 return "filename_too_long | ENAMETOOLONG";
1399 case boost::system::errc::function_not_supported: {
1400 return "function_not_supported | ENOSYS";
1403 case boost::system::errc::host_unreachable: {
1404 return "host_unreachable | EHOSTUNREACH";
1407 case boost::system::errc::identifier_removed: {
1408 return "identifier_removed | EIDRM";
1411 case boost::system::errc::illegal_byte_sequence: {
1412 return "illegal_byte_sequence | EILSEQ";
1415 case boost::system::errc::inappropriate_io_control_operation: {
1416 return "inappropriate_io_control_operation | ENOTTY";
1419 case boost::system::errc::interrupted: {
1420 return "interrupted | EINTR";
1423 case boost::system::errc::invalid_argument: {
1424 return "invalid_argument | EINVAL";
1427 case boost::system::errc::invalid_seek: {
1428 return "invalid_seek | ESPIPE";
1431 case boost::system::errc::io_error: {
1432 return "io_error | EIO";
1435 case boost::system::errc::is_a_directory: {
1436 return "is_a_directory | EISDIR";
1439 case boost::system::errc::message_size: {
1440 return "message_size | EMSGSIZE";
1443 case boost::system::errc::network_down: {
1444 return "network_down | ENETDOWN";
1447 case boost::system::errc::network_reset: {
1448 return "network_reset | ENETRESET";
1451 case boost::system::errc::network_unreachable: {
1452 return "network_unreachable | ENETUNREACH";
1455 case boost::system::errc::no_buffer_space: {
1456 return "no_buffer_space | ENOBUFS";
1459 case boost::system::errc::no_child_process: {
1460 return "no_child_process | ECHILD";
1463 case boost::system::errc::no_link: {
1464 return "no_link | ENOLINK";
1467 case boost::system::errc::no_lock_available: {
1468 return "no_lock_available | ENOLCK";
1471 case boost::system::errc::no_message_available: {
1472 return "no_message_available | ENODATA";
1475 case boost::system::errc::no_message: {
1476 return "no_message | ENOMSG";
1479 case boost::system::errc::no_protocol_option: {
1480 return "no_protocol_option | ENOPROTOOPT";
1483 case boost::system::errc::no_space_on_device: {
1484 return "no_space_on_device | ENOSPC";
1487 case boost::system::errc::no_stream_resources: {
1488 return "no_stream_resources | ENOSR";
1491 case boost::system::errc::no_such_device_or_address: {
1492 return "no_such_device_or_address | ENXIO";
1495 case boost::system::errc::no_such_device: {
1496 return "no_such_device | ENODEV";
1499 case boost::system::errc::no_such_file_or_directory: {
1500 return "no_such_file_or_directory | ENOENT";
1503 case boost::system::errc::no_such_process: {
1504 return "no_such_process | ESRCH";
1507 case boost::system::errc::not_a_directory: {
1508 return "not_a_directory | ENOTDIR";
1511 case boost::system::errc::not_a_socket: {
1512 return "not_a_socket | ENOTSOCK";
1515 case boost::system::errc::not_a_stream: {
1516 return "not_a_stream | ENOSTR";
1519 case boost::system::errc::not_connected: {
1520 return "not_connected | ENOTCONN";
1523 case boost::system::errc::not_enough_memory: {
1524 return "not_enough_memory | ENOMEM";
1527 case boost::system::errc::not_supported: {
1528 return "not_supported | ENOTSUP";
1531 case boost::system::errc::operation_canceled: {
1532 return "operation_canceled | ECANCELED";
1535 case boost::system::errc::operation_in_progress: {
1536 return "operation_in_progress | EINPROGRESS";
1539 case boost::system::errc::operation_not_permitted: {
1540 return "operation_not_permitted | EPERM";
1553 case boost::system::errc::owner_dead: {
1554 return "owner_dead | EOWNERDEAD";
1557 case boost::system::errc::permission_denied: {
1558 return "permission_denied | EACCES";
1561 case boost::system::errc::protocol_error: {
1562 return "protocol_error | EPROTO";
1565 case boost::system::errc::protocol_not_supported: {
1566 return "protocol_not_supported | EPROTONOSUPPORT";
1569 case boost::system::errc::read_only_file_system: {
1570 return "read_only_file_system | EROFS";
1573 case boost::system::errc::resource_deadlock_would_occur: {
1574 return "resource_deadlock_would_occur | EDEADLK";
1577 case boost::system::errc::resource_unavailable_try_again: {
1578 return "resource_unavailable_try_again | EAGAIN";
1581 case boost::system::errc::result_out_of_range: {
1582 return "result_out_of_range | ERANGE";
1585 case boost::system::errc::state_not_recoverable: {
1586 return "state_not_recoverable | ENOTRECOVERABLE";
1589 case boost::system::errc::stream_timeout: {
1590 return "stream_timeout | ETIME";
1593 case boost::system::errc::text_file_busy: {
1594 return "text_file_busy | ETXTBSY";
1597 case boost::system::errc::timed_out: {
1598 return "timed_out | ETIMEDOUT";
1601 case boost::system::errc::too_many_files_open_in_system: {
1602 return "too_many_files_open_in_system | ENFILE";
1605 case boost::system::errc::too_many_files_open: {
1606 return "too_many_files_open | EMFILE";
1609 case boost::system::errc::too_many_links: {
1610 return "too_many_links | EMLINK";
1618 case boost::system::errc::value_too_large: {
1619 return "value_too_large | EOVERFLOW";
1622 case boost::system::errc::wrong_protocol_type: {
1623 return "wrong_protocol_type | EPROTOTYPE";
1627 return "unknown error";
1637 printf(
"Error getting initial pan position. Expected 0, got %ld\n", pan_pos);
1642 printf(
"Error while setting pan position to 300");
1647 if(desired_pan_position != 300) {
1648 printf(
"Error while setting or getting (desired) pan position. Expected 300, desired %ld", desired_pan_position);
1653 if((pan_pos < 0) || (pan_pos >= 300)) {
1654 printf(
"Error getting pan position while ptu is moving position. Expected value between 0 and 300, got %ld\n", pan_pos);
1655 if(pan_pos == 300) {
1656 printf(
"Pan Position was 300 but it should not be at the moment. This can also happen due to to slow serial port or sceduling, testing will be continued therefore.");
1664 if((pan_pos < 0) || (pan_pos >= 300)) {
1665 printf(
"Error getting pan position while ptu is moving position. Expected value between 0 and 300, got %ld\n", pan_pos);
1666 if(pan_pos == 300) {
1667 printf(
"Pan Position was 300 but it should not be at the moment. This can also happen due to to slow serial port or sceduling, testing will be continued therefore.");
1675 printf(
"Execution of await command failed");
1680 if((pan_pos != 300)) {
1681 printf(
"Setting pan position, getting pan position or await command failed. Expected pan position 300, but got %ld\n", pan_pos);
1687 printf(
"Error getting initial tilt position. Expected 0, got %ld\n", tilt_pos);
1692 printf(
"Error while setting tilt position to -350");
1697 if(desired_tilt_position != -350) {
1698 printf(
"Error while setting or getting (desired) tilt position. Expected -350, desired %ld", desired_tilt_position);
1704 if((tilt_pos > 0) || (tilt_pos <= -350)) {
1705 printf(
"Error getting tilt position while ptu is moving position. Expected value between 0 and -350, got %ld\n", tilt_pos);
1706 if(pan_pos == -350) {
1707 printf(
"Tilt Position was -350 but it should not be at the moment. This can also happen due to to slow serial port or sceduling, testing will be continued therefore.");
1715 if((tilt_pos > 0) || (tilt_pos <= -350)) {
1716 printf(
"Error getting tilt position while ptu is moving position. Expected value between 0 and -350, got %ld\n", tilt_pos);
1717 if(tilt_pos == -350) {
1718 printf(
"Tilt Position was -350 but it should not be at the moment. This can also happen due to to slow serial port or sceduling, testing will be continued therefore.");
1726 printf(
"Execution of await command failed");
1731 if((tilt_pos != -350)) {
1732 printf(
"Setting tilt position, getting tilt position or await command failed. Expected tilt position -350, but got %ld\n", tilt_pos);
1737 printf(
"Setting pan position realtiv failed.");
1742 printf(
"Execution of await command failed");
1747 if(pan_pos != 400) {
1748 printf(
"After setting relative pan position, position == 400 was expected, but position was %ld\n", pan_pos);
1753 printf(
"Setting pan position realtiv failed.");
1758 printf(
"Execution of await command failed");
1763 if(tilt_pos != -250) {
1764 printf(
"After setting relative pan position, position == -250 was expected, but position was %ld\n", tilt_pos);
1769 printf(
"SUCCESS: Setting pan and tilt testing successfull\n");
1774 printf(
"Setting position limit enforcement to factory limits enabled failed\n");
1782 printf(
"setPositionLimitEnforcementMode or the corresponding get method failed. FACOTRY_LIMITS_ENABLED was expected, USER_DEFINED_LIMITS_ENABLE was retrieved\n");
1785 printf(
"setPositionLimitEnforcementMode or the corresponding get method failed. FACOTRY_LIMITS_ENABLED was expected, LIMITS_DISABLED was retrieved\n");
1787 else if(limit_enforcement_mode ==
ERROR) {
1788 printf(
"getPositionLimitEnforcementMode failed with ERROR\n");
1791 printf(
"get_posiion_limit_enforcement_mode returned unexpected value after setting FACTORY_LIMITS_ENABLED\n");
1803 if(pan_upper_limit ==
ERROR) {
1804 printf(
"Function getCurrentUsedMaximumPanPositionLimit returned ERROR when used in FACTORY_LIMITS_ENABLES position enforcement mode\n");
1807 if(pan_lower_limit ==
ERROR) {
1808 printf(
"Function getCurrentUsedMinimumPanPositionLimit returned ERROR when used in FACTORY_LIMITS_ENABLES position enforcement mode\n");
1811 if(tilt_upper_limit ==
ERROR) {
1812 printf(
"Function getCurrentUsedMaximumTiltPositionLimit returned ERROR when used in FACTORY_LIMITS_ENABLES position enforcement mode\n");
1815 if(tilt_lower_limit ==
ERROR) {
1816 printf(
"Function getCurrentUsedMinimumTiltPositionLimit returned ERROR when used in FACTORY_LIMITS_ENABLES position enforcement mode\n");
1821 printf(
"FACTORY_LIMITS_ENABLED mode or any of the get functions did not work properly. Trying to move pan unit over the upper limit did not result in error\n");
1825 printf(
"FACTORY_LIMITS_ENABLED mode or any of the get functions did not work properly. Trying to move pan unit over the lower limit did not result in error\n");
1829 printf(
"FACTORY_LIMITS_ENABLED mode or any of the get functions did not work properly. Trying to move tilt unit over the upper limit did not result in error\n");
1833 printf(
"FACTORY_LIMITS_ENABLED mode or any of the get functions did not work properly. Trying to move tilt unit over the lower limit did not result in error\n");
1915 printf(
"Setting position limit enforcement mode to LIMITS_DISABLED failed");
1922 printf(
"Getting position limit enforcement mode failed. Expected: LIMITS_DISABLED, Got: %ld\n", limit_enforcement_mode);
1927 printf(
"Setting position out of limits with LIMITS_DISABLED failed\n");
1937 printf(
"Testing Limit Enforcement succeeded\n");
1946 if(cur_pan_speed != 0) {
1947 printf(
"Error while getting current pan speed. 0 expected but got %ld\n", cur_pan_speed);
1950 if(cur_tilt_speed != 0) {
1951 printf(
"Error while getting current tilt speed. 0 expected but got %ld\n", cur_tilt_speed);
1957 if(des_pan_speed <= 0) {
1958 printf(
"Error while getting desired pan speed. Value >= 0 expected but got %ld\n", des_pan_speed);
1961 if(des_tilt_speed <= 0) {
1962 printf(
"Error while getting desired tilt speed. Value >= 0 expected but got %ld\n", des_tilt_speed);
1967 printf(
"Error while setting desired pan speed absolute\n");
1972 if(mod_desired_pan_speed != (des_pan_speed - 1)) {
1973 printf(
"Error while getting or setting desired pan speed (absolute set). Expected %ld - 1, but got %ld\n", des_pan_speed, mod_desired_pan_speed);
1978 printf(
"Error while setting desired tilt speed absolute\n");
1983 if(mod_desired_tilt_speed != (des_tilt_speed - 2)) {
1984 printf(
"Error while getting or setting desired tilt speed (absolute set). Expected %ld - 2, but got %ld\n", des_tilt_speed, mod_desired_tilt_speed);
1991 printf(
"Error while setting desired pan speed realtive\n");
1996 if(mod_desired_pan_speed != (des_pan_speed - 2)) {
1997 printf(
"Error while getting or setting desired pan speed (realtive set). Expected %ld - 2, but got %ld\n", des_pan_speed, mod_desired_pan_speed);
2002 printf(
"Error while setting desired tilt speed relative\n");
2007 if(mod_desired_tilt_speed != (des_tilt_speed - 4)) {
2008 printf(
"Error while getting or setting desired tilt speed (relative set). Expected %ld - 4, but got %ld\n", des_tilt_speed, mod_desired_tilt_speed);
2017 if(upper_limit_pan ==
ERROR) {
2018 printf(
"Error while getting upper speed limit pan.\n");
2021 if(lower_limit_pan ==
ERROR) {
2022 printf(
"Error while getting lower speed limit pan.\n");
2025 if(upper_limit_tilt ==
ERROR) {
2026 printf(
"Error while getting upper speed limit tilt.\n");
2029 if(lower_limit_tilt ==
ERROR) {
2030 printf(
"Error while getting lower speed limit tilt.\n");
2035 printf(
"Error while setting upper speed limit pan\n");
2039 printf(
"Error while setting lower speed limit pan\n");
2043 printf(
"Error while setting upper speed limit tilt\n");
2047 printf(
"Error while setting lower speed limit tilt\n");
2064 if(mod_lower_limit_pan != (57)) {
2065 printf(
"Error while getting or setting lower speed limit pan. Expected 57, but got %ld\n", mod_lower_limit_pan);
2074 if(mod_lower_limit_tilt != (58)) {
2075 printf(
"Error while getting or setting lower speed limit tilt. Expected 58, but got %ld\n", mod_lower_limit_tilt);
2081 if(pan_base_speed <= 0) {
2082 printf(
"Error while getting pan_base_speed\n");
2085 if(tilt_base_speed <= 0) {
2086 printf(
"Error while getting tilt_base_speed\n");
2090 printf(
"Error while setting pan_base_speed\n");
2094 printf(
"Error while setting tilt_base_speed\n");
2099 if((pan_base_speed - 1) != mod_pan_base_speed) {
2100 printf(
"Error while getting pan_base_speed. Expected %ld - 1, got %ld\n", pan_base_speed, mod_pan_base_speed);
2103 if((tilt_base_speed - 1) != mod_tilt_base_speed) {
2104 printf(
"Error while getting tilt_base_speed. Expected %ld - 1, got %ld\n", tilt_base_speed, mod_tilt_base_speed);
2110 if(pan_accel <= 0) {
2111 printf(
"Error while getting pan acceleration\n");
2114 if(tilt_accel <= 0) {
2115 printf(
"Error while getting tilt acceleration\n");
2119 printf(
"Setting desired pan acceleration absolute failed\n");
2123 printf(
"Setting desired pan acceleration absolute failed\n");
2128 if((pan_accel - 1) != mod_pan_accel) {
2129 printf(
"Error while getting pan acceleration. Expected %ld - 1, got %ld\n", pan_accel, mod_pan_accel);
2132 if((tilt_accel - 1) != mod_tilt_accel) {
2133 printf(
"Error while getting tilt acceleration. Expected %ld - 1, got %ld\n", tilt_accel, mod_tilt_accel);
2137 printf(
"Speed testing successfull\n");
2142 if(pan_res <= 0.0) {
2143 printf(
"Error while getting pan resolution");
2146 if(tilt_res <= 0.0) {
2147 printf(
"Error while getting tilt resolution");
2151 printf(
"Resolution testing successfull with Pan Resolution %f und Tilt Resolution %f\n", pan_res, tilt_res);
2155 printf(
"Error while setting position execution mode to SLAVED_POSITION_EXECUTION_MODE\n");
2160 printf(
"Error while getting or setting position execution mode. SLAVED_POSITION_EXECUTION_MODE expected, got %ld\n", pos_ex_mode);
2164 printf(
"Error while setting position execution mode to IMMEDIATE_POSITION_EXECUTION_MODE\n");
2169 printf(
"Error while getting or setting position execution mode. IMMEDIATE_POSITION_EXECUTION_MODE expected, got %ld\n", pos_ex_mode);
2176 printf(
"Error while executing halt command with HALT_BOTH\n");
2180 printf(
"Error while executing halt command with HALT_PAN_ONLY\n");
2184 printf(
"Error while executing halt command with HALT_TILT_ONLY\n");
2189 printf(
"Problem while setting preset with current location\n");
2195 if(cur_pan_pos != 300 || cur_tilt_pos != 300) {
2196 printf(
"Synchronous setting of pan and tilt axis in setDesiredPanTiltPositionAbsoluteSlaved did not work properly, false position was set\n");
2246 printf(
"Error while setting speed control mode to PURE_VELOCITY_CONTROL_MODE\n");
2251 printf(
"Error while getting or setting speed controle mode. Expected PURE_VELOCITY_CONTROL_MODE, got %ld\n", cur_speed_control_mode);
2256 printf(
"Error while setting speed control mode to INDEPENDENT_SPEED_MODE\n");
2261 printf(
"Error while getting or setting speed controle mode. Expected INDEPENDENT_SPEED_MODE, got %ld\n", cur_speed_control_mode);
2276 printf(
"Error while setting pan stationary power mode to REGULAR_HOLD_POWER_MODE\n");
2280 printf(
"Error while setting tilt stationary power mode to REGULAR_HOLD_POWER_MODE\n");
2286 printf(
"Error while getting or setting pan stationary power mode. Expected: REGULAR_HOLD_POWER_MODE, got %ld\n", cur_pan_stat_power_mode);
2290 printf(
"Error while getting or setting tilt stationary power mode. Expected: REGULAR_HOLD_POWER_MODE, got %ld\n", cur_pan_stat_power_mode);
2295 printf(
"Error while setting pan stationary power mode to LOW_HOLD_POWER_MODE\n");
2299 printf(
"Error while setting tilt stationary power mode to LOW_HOLD_POWER_MODE\n");
2305 printf(
"Error while getting or setting pan stationary power mode. Expected: LOW_HOLD_POWER_MODE, got %ld\n", cur_pan_stat_power_mode);
2309 printf(
"Error while getting or setting tilt stationary power mode. Expected: LOW_HOLD_POWER_MODE, got %ld\n", cur_pan_stat_power_mode);
2314 printf(
"Error while setting pan stationary power mode to OFF_HOLD_POWER_MODE\n");
2318 printf(
"Error while setting tilt stationary power mode to OFF_HOLD_POWER_MODE\n");
2324 printf(
"Error while getting or setting pan stationary power mode. Expected: OFF_HOLD_POWER_MODE, got %ld\n", cur_pan_stat_power_mode);
2328 printf(
"Error while getting or setting tilt stationary power mode. Expected: OFF_HOLD_POWER_MODE, got %ld\n", cur_pan_stat_power_mode);
2338 printf(
"Error while setting pan in_motion power mode to REGULAR_MOVE_POWER_MODE\n");
2342 printf(
"Error while setting tilt in_motion power mode to REGULAR_MOVE_POWER_MODE\n");
2348 printf(
"Error while getting or setting pan in_motion power mode. Expected: REGULAR_MOVE_POWER_MODE, got %ld\n", cur_pan_stat_power_mode);
2352 printf(
"Error while getting or setting tilt in_motion power mode. Expected: REGULAR_MOVE_POWER_MODE, got %ld\n", cur_pan_stat_power_mode);
2357 printf(
"Error while setting pan in_motion power mode to LOW_MOVE_POWER_MODE\n");
2361 printf(
"Error while setting tilt in_motion power mode to LOW_MOVE_POWER_MODE\n");
2367 printf(
"Error while getting or setting pan in_motion power mode. Expected: LOW_MOVE_POWER_MODE, got %ld\n", cur_pan_stat_power_mode);
2371 printf(
"Error while getting or setting tilt in_motion power mode. Expected: LOW_MOVE_POWER_MODE, got %ld\n", cur_pan_stat_power_mode);
2376 printf(
"Error while setting pan in_motion power mode to HIGH_MOVE_POWER_MODE\n");
2380 printf(
"Error while setting tilt in_motion power mode to HIGH_MOVE_POWER_MODE\n");
2386 printf(
"Error while getting or setting pan in_motion power mode. Expected: HIGH_MOVE_POWER_MODE, got %ld\n", cur_pan_stat_power_mode);
2390 printf(
"Error while getting or setting tilt in_motion power mode. Expected: HIGH_MOVE_POWER_MODE, got %ld\n", cur_pan_stat_power_mode);
2398 printf(
"Testing successfull\n");
long getFactoryMaximumPanPositionLimit()
getFactoryMaximumPanPositionLimit Method to get the factory defined maximum pan position.
void test()
test Method to test the methods of this program, for DEBUG/DEVELOPMENT purpose, changes PTU settings ...
long getCurrentPanSpeed()
getCurrentPanSpeed Method that queries the current pan speed
bool setDesiredTiltUpperSpeedLimit(short int upper_speed_limit)
setDesiredTiltUpperSpeedLimit Method that sets the upper speed limit for tilt (position/second). WARNING: Takes extremly long or does not work on every ptu
bool setDesiredPanSpeedAbsolute(short int speed)
setDesiredPanSpeedAbsolute Method that sets absolute pan speed (position/second)
bool setDesiredTiltPositionRelative(short int position_offset)
setDesiredTiltPositionRelative Method that sets current tilt position by offset (current pos + offset...
long getUserMinimumTiltPositionLimit()
getUserMinimumTiltPositionLimit Method to get the user defined minimum tilt position. WARNING: Does not work on older PTUs and is not tested.
#define IMMEDIATE_POSITION_EXECUTION_MODE
long getCurrentUsedMaximumTiltPositionLimit()
getCurrentUsedMaximumTiltPositionLimit Method to get the currently used maximum tilt position...
long getSpeedControlMode()
getSpeedControlMode Method to get the currently used sped control mode of the ptu.
long getDesiredTiltSpeed()
getDesiredTiltSpeed Method that queries the desired tilt speed
bool setResetMode(long mode)
setResetMode Method to set the reset mode of the ptu. Saved to EEPROM, do not use too often...
double getTiltResolution()
getTiltResolution Method that queries the tilt resolution (seconds/arc per position). Divide by 3600 to get Degree.
bool setDesiredTiltPositionAbsolute(short int position)
setDesiredTiltPositionAbsolute Method that sets absolute tilt position
#define OFF_HOLD_POWER_MODE
bool setDesiredPanLowerSpeedLimit(short int lower_speed_limit)
setDesiredPanLowerSpeedLimit Method that sets the lower speed limit for pan (position/second). WARNING: Takes extremly long or does not work on every ptu
long getCurrentUsedMinimumPanPositionLimit()
getCurrentUsedMinimumPanPositionLimit Method to get the currently used minimum pan position...
std::string readPTUResponse()
readPTUResponse Method that reads from the PTU until delimitor (' ') appears. Then the read data is r...
long getFactoryMaximumTiltPositionLimit()
getFactoryMaximumTiltPositionLimit Method to get the factory defined maximum tilt position...
long getTiltAcceleartion()
getTiltAcceleartion Method that queries the tilt acceleration (no current or desired here) ...
long getPanInMotionPowerMode()
getPanInMotionPowerMode Method to get the move power mode for pan axis.
void closeSerialConnection()
closeSerialConnection Closes currently used serial port
#define SLAVED_POSITION_EXECUTION_MODE
#define HIGH_MOVE_POWER_MODE
bool isOpen()
isOpen Method to determine if used port is open or closed.
#define USER_DEFINED_LIMITS_ENABLED
long getCurrentTiltSpeed()
getCurrentTiltSpeed Method that queries the current tilt speed
bool setTiltBaseSpeed(short int base_speed)
setTiltBaseSpeed Method that sets the base speed for tilt (position/second)
long getTiltUpperSpeedLimit()
getTiltUpperSpeedLimit Method that queries the tilt upper speed limit WARNING: This Method consumes e...
long getUserMaximumTiltPositionLimit()
getUserMaximumTiltPositionLimit Method to get the user defined maximum tilt position. WARNING: Does not work on older PTUs and is not tested.
#define INDEPENDENT_SPEED_MODE
std::string getErrorString(boost::system::error_code error)
long getCurrentUsedMinimumTiltPositionLimit()
getCurrentUsedMinimumTiltPositionLimit Method to get the currently used minimum tilt position...
long getDesiredPanSpeed()
getDesiredPanSpeed Method that queries the desired pan speed
long getUserMaximumPanPositionLimit()
getUserMaximumPanPositionLimit Method to get the user defined maximum pan position. WARNING: Does not work on older PTUs and is not tested.
bool setDesiredPanUpperSpeedLimit(short int upper_speed_limit)
setDesiredPanUpperSpeedLimit Method that sets the upper speed limit for pan (position/second). WARNING: Takes extremly long or does not work on every ptu
#define FACTORY_LIMITS_ENABLED
bool setNewSerialConnection(std::string port, int baud)
setNewSerialConnection Establishes a new connection via serial port specified by 'port' to a target d...
bool setPanStationaryPowerMode(long mode)
setPanStationaryPowerMode Method to set the stationary power mode for pan axis.
PTUFree()
PTUFree Constructor for PTUFree object. Not connected to any port.
long getTiltStationaryPowerMode()
getTiltStationaryPowerMode Method to get the stationary power mode for tilt axis. ...
bool setDesiredPanAccelerationAbsolute(short int acceleration)
setDesiredPanAccelerationAbsolute Method that sets the absolute pan acceleration (position/second^2) ...
long getFactoryMinimumTiltPositionLimit()
getFactoryMinimumTiltPositionLimit Method to get the factory defined minimum tilt position...
long getPositionLimitEnforcementMode()
getPositionLimitEnforcementMode Method to get the currently used position limit enforcement mode...
bool setMaximumPanPositionLimit(short int position)
setMaximumPanPositionLimit Method that is used to set a user defined maximum pan position limit...
std::vector< std::string > evaluateResponse(std::string response)
evaluateResponse Method that preprocesses the answer of the PTU. Splits the PTU to a maximum of 3 par...
std::string communicate(std::string request)
communicate Method to send a command 'request' to the serial port (and the device) and recieve the an...
bool clearPreset()
clearPreset Method to delete all existing presets. WARNING: Does not work on older PTUs and is not te...
bool setDesiredTiltSpeedRelative(short int speed_offset)
setDesiredTiltSpeedRelative Method that sets the desired tilt speed relative to the CURRENT (not the ...
bool setDesiredTiltAccelerationAbsolute(short int acceleration)
setDesiredTiltAccelerationAbsolute Method that sets the absolute tilt acceleration (position/second^2...
bool setPreset(int preset_index, short int pan, short int tilt)
setPreset Method that allows to associate a pan and tilt position with a preset index. Moves to the pan and tilt position and saves the position as a preset. WARNING: Does not work on older PTUs and is not tested.
bool setDesiredPanPositionRelative(short int position_offset)
setDesiredPanPositionRelative Method that sets current pan position by offset (current pos + offset =...
bool setPanBaseSpeed(short int base_speed)
setPanBaseSpeed Method that sets the base speed for pan (position/second)
bool setPositionExecutionMode(long mode)
setPositionExecutionMode Method to set the position execution mode.
long getTiltInMotionPowerMode()
getTiltInMotionPowerMode Method to get the move power mode for tilt axis.
ROSLIB_DECL std::string command(const std::string &cmd)
long getPanLowerSpeedLimit()
getPanLowerSpeedLimit Method that queries the pan lower speed limit. WARNING: This Method consumes ei...
bool setSpeedControlMode(long mode)
setSpeedControlMode Method to set the sped control mode of the ptu.
long getPanAcceleartion()
getPanAcceleartion Method that queries the pan acceleration (no current or desired here) ...
bool setMinimumPanPositionLimit(short int position)
setMinimumPanPositionLimit Method that is used to set a user defined minimum pan position limit...
bool gotoPreset(int preset_index)
gotoPreset Method that moves the ptu to a existing preset of pan and tilt corrdiantes. WARNING: Does not work on older PTUs and is not tested.
long getPanUpperSpeedLimit()
getPanUpperSpeedLimit Method that queries the pan upper speed limit WARNING: This Method consumes eit...
long position_execution_mode
long getTiltBaseSpeed()
getTiltBaseSpeed Returns the current tilt base speed
long getDesiredPanPosition()
getDesiredPanPosition Method that queries the desired pan position
boost::asio::io_service timer_io_service
long getCurrentPanPosition()
getCurrentPanPosition Method that queries the current pan position
bool setDesiredPanSpeedRelative(short int speed_offset)
setDesiredPanSpeedRelative Method that sets the desired pan speed relative to the CURRENT (not the de...
bool halt(long axis)
halt Method that halts movement on specified axis.
bool restoreFactoryDefault()
restoreFactoryDefault Method to set default settings to factory defaults. Saved to EEPROM...
double getPanResolution()
getPanResolution Method that queries the pan resolution (seconds/arc per position). Divide by 3600 to get Degree.
long getPanBaseSpeed()
getPanBaseSpeed Returns the current pan base speed
bool awaitPositionCommandCompletion()
awaitPositionCommandCompletion Method to wait for the completion of the last issued pan and tilt posi...
#define PAN_ONLY_RESET_MODE
#define LOW_HOLD_POWER_MODE
bool restoreDefault()
restoreDefault Method to restore default settings. WARNING: Not tested.
long getPanStationaryPowerMode()
getPanStationaryPowerMode Method to get the stationary power mode for pan axis.
long getTiltLowerSpeedLimit()
getTiltLowerSpeedLimit Method that queries the tilt lower speed limit. WARNING: This Method consumes ...
#define REGULAR_HOLD_POWER_MODE
bool setDesiredPanTiltPositionAbsoluteSlaved(short int pan, short int tilt)
setDesiredPanTiltPositionAbsoluteSlaved Method that allows a movement of pan and tilt axis to specifi...
long getFactoryMinimumPanPositionLimit()
getFactoryMinimumPanPositionLimit Method to get the factory defined minimum pan position.
#define LOW_MOVE_POWER_MODE
bool setBaudRate(int baud)
setBaudRate Sets the baud rate for the serial port that is used. Only use of serial connection is est...
long getCurrentUsedMaximumPanPositionLimit()
getCurrentUsedMaximumPanPositionLimit Method to get the currently used maximum pan position...
bool setMinimumTiltPositionLimit(short int position)
setMinimumTiltPositionLimit Method that is used to set a user defined minimum tilt position limit...
bool setPositionLimitEnforcementMode(long enable)
setPositionLimitEnforcementMode Method to set the position limit enforcement mode. Warning: USER_DEFINED_LIMITS_ENABLED does not work on older PTUs and setting of this value is not tested.
bool setDesiredPanPositionAbsolute(short int position)
setDesiredPanPositionAbsolute Method that sets absolute pan position
bool saveDefault()
saveDefault Method to save the current axis settings as default at power up. Note: This class sets th...
#define REGULAR_MOVE_POWER_MODE
#define PURE_VELOCITY_CONTROL_MODE
bool setDesiredTiltLowerSpeedLimit(short int lower_speed_limit)
setDesiredTiltLowerSpeedLimit Method that sets the lower speed limit for tilt (position/second). WARNING: Takes extremly long or does not work on every ptu
boost::asio::serial_port ptu_port
bool setTiltStationaryPowerMode(long mode)
setTiltStationaryPowerMode Method to set the stationary power mode for tilt axis. ...
bool setMaximumTiltPositionLimit(short int position)
setMaximumTiltPositionLimit Method that is used to set a user defined maximum tilt position limit...
bool setTiltInMotionPowerMode(long mode)
setTiltInMotionPowerMode Method to set the move power mode for tilt axis.
#define TILT_ONLY_RESET_MODE
bool reset()
reset Method to reset the ptu (pan and/or tilt axis depending on reset mode)
long getCurrentTiltPosition()
getCurrentTiltPosition Method that queries the current tilt position
const std::string response
long getUserMinimumPanPositionLimit()
getUserMinimumPanPositionLimit Method to get the user defined minimum pan position. WARNING: Does not work on older PTUs and is not tested.
bool setDesiredTiltSpeedAbsolute(short int speed)
setDesiredTiltSpeedAbsolute Method that sets absolute tilt speed (position/second) ...
bool setPanInMotionPowerMode(long mode)
setPanInMotionPowerMode Method to set the move power mode for pan axis.
long getDesiredTiltPosition()
getDesiredTiltPosition Method that queries the desired tilt position
long getPositionExecutionMode()
getPositionExecutionMode Method to get the currently used position execution mode. Can return IMMEDIATE_POSITION_EXECUTION_MODE or SLAVED_POSITION_EXECUTION_MODE.