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
#ifdef ENABLE_VISP_NAMESPACE
#endif
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 {
robot.setDoF(opt_dof);
robot.setPluginLocation(opt_plugin_path);
robot.setCommandLayer(opt_command_layer);
int n_devices = robot.connect();
if (!n_devices) {
std::cout << "There is no Kinova device connected." << std::endl;
return EXIT_SUCCESS;
}
robot.homing();
for (unsigned int i = 0; i < 300; i++) {
}
robot.homing();
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
}
Implementation of column vector and the associated operations.
error that can be emitted by ViSP classes.
const std::string & getStringMessage() const
static double rad(double deg)
void setVelocity(const vpRobot::vpControlFrameType frame, const vpColVector &vel) VP_OVERRIDE
void setVerbose(bool verbose)
@ STATE_POSITION_CONTROL
Initialize the position controller.
@ STATE_VELOCITY_CONTROL
Initialize the velocity controller.
virtual vpRobotStateType setRobotState(const vpRobot::vpRobotStateType newState)
VISP_EXPORT int wait(double t0, double t)