Example that allows to control Kinova Jaco robot joints.
#include <iostream>
#include <visp3/core/vpConfig.h>
#include <visp3/robot/vpRobotKinova.h>
int main(int argc, char*argv[])
{
#ifdef VISP_HAVE_JACOSDK
std::string opt_plugin_path = "./";
bool opt_verbose = false;
unsigned int opt_dof = 6;
for (int i = 1; i < argc; i++) {
if (std::string(argv[i]) == "--plugin" && i + 1 < argc) {
opt_plugin_path = std::string(argv[i + 1]);;
}
if ((std::string(argv[i]) == "--command_layer" || std::string(argv[i]) == "-l") && i + 1 < argc) {
if (std::string(argv[i + 1]) == "usb") {
}
else if (std::string(argv[i + 1]) == "ethernet") {
}
else {
}
}
else if (std::string(argv[i]) == "--dof") {
opt_dof = static_cast<unsigned int>(std::atoi(argv[i + 1]));
}
else if (std::string(argv[i]) == "--verbose" || std::string(argv[i]) == "-v") {
opt_verbose = true;
}
else if (std::string(argv[i]) == "--help" || std::string(argv[i]) == "-h") {
std::cout << "SYNOPSYS" << std::endl
<< " " << argv[0] << " [--plugin <path>] [--command_layer <name>] [--dof <4,6,7>] "
<< "[--verbose] [--help] [-v] [-h]\n" << std::endl;
std::cout << "DESCRIPTION" << std::endl
<< " --plugin <path>" << std::endl
<< " Path to Jaco SDK .so or .dll plugin location. Default: \"./\"." << std::endl << std::endl
<< " --command_layer <name>, -l <name>" << std::endl
<< " Command layer name, either \"usb\" or \"ethernet\"." << std::endl << std::endl
<< " --dof" << std::endl
<< " Degrees of freedom. Possible values are 4, 6 or 7. Default value: 6." << std::endl << std::endl
<< " --verbose, -v" << std::endl
<< " Enable verbose mode to print addition information." << std::endl << std::endl
<< " --help, -h" << std::endl
<< " Print this helper message." << std::endl << std::endl;
std::cout << "EXAMPLE" << std::endl
#ifdef __linux__
<< " " << argv[0] << " --plugin /opt/JACO-SDK/API"
#elif _WIN32
<< " " << argv[0] << " --plugin \"C:\\Program Files(x86)\\JACO - SDK\\API\\x64\""
#endif
<< " --command_layer usb" << std::endl << std::endl;
return EXIT_SUCCESS;
}
}
try {
if (!n_devices) {
std::cout << "There is no Kinova device connected." << std::endl;
return EXIT_SUCCESS;
}
for (unsigned int i = 0; i < 300; i++) {
}
q1 = q;
q2 = q;
}
}
std::cout << "The end" << std::endl;
return EXIT_SUCCESS;
#else
(void)(argc);
(void)(argv);
std::cout << "Install Jaco SDK, configure and build again ViSP to use this example..." << std::endl;
#endif
}