Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Can this library support control with two jaco arms at the same time? #38

Open
mirsking opened this issue Sep 17, 2015 · 1 comment
Open

Comments

@mirsking
Copy link

Firstly, thank you for your hard work for the wpi_jaco library, it really saves much time for me.

Now I'm working to control two jaco arms in one robot, and I'm confused that I haven't found any code for suiting two arms in wpi_jaco library.

In the official ros repository I've found the following code

    std::vector<KinovaDevice> devices_list;
    result = NO_ERROR_KINOVA;
    jaco_api_.getDevices(devices_list, result);
    if (result != NO_ERROR_KINOVA)
    {
        throw JacoCommException("Could not get devices list", result);
    }

    bool found_arm = false;
    for (int device_i = 0; device_i < devices_list.size(); device_i++)
    {
        // If no device is specified, just use the first available device
        if ((serial_number == "")
            || (std::strcmp(serial_number.c_str(), devices_list[device_i].SerialNumber) == 0))
        {
            result = jaco_api_.setActiveDevice(devices_list[device_i]);
            if (result != NO_ERROR_KINOVA)
            {
                throw JacoCommException("Could not set the active device", result);
            }

            GeneralInformations general_info;
            result = jaco_api_.getGeneralInformations(general_info);
            if (result != NO_ERROR_KINOVA)
            {
                throw JacoCommException("Could not get general information about the device", result);
            }

            ClientConfigurations configuration;
            getConfig(configuration);

            QuickStatus quick_status;
            getQuickStatus(quick_status);

            robot_type_ = quick_status.RobotType;
            if ((robot_type_ != 0) && (robot_type_ != 1) && (robot_type_ != 3))
            {
                ROS_ERROR("Could not get the type of the arm from the quick status, expected "
                          "either type 0 (JACO), or type 1 (MICO), got %d", quick_status.RobotType);
                throw JacoCommException("Could not get the type of the arm", quick_status.RobotType);
            }

            switch (robot_type_) {
                case 0:
                case 3:
                    num_fingers_ = 3;
                    break;
                case 1:
                    num_fingers_ = 2;
                    break;
                default:
                    break;
            }

            ROS_INFO_STREAM("Found " << devices_list.size() << " device(s), using device at index " << device_i
                            << " (model: " << configuration.Model
                            << ", serial number: " << devices_list[device_i].SerialNumber
                            << ", code version: " << general_info.CodeVersion
                            << ", code revision: " << general_info.CodeRevision << ")");

            found_arm = true;
            break;
        }
    }

    if (!found_arm)
    {
        ROS_ERROR("Could not find the specified arm (serial: %s) among the %d attached devices",
                  serial_number.c_str(), static_cast<int>(devices_list.size()));
        throw JacoCommException("Could not find the specified arm", 0);
    }

Now I'd like to know whether wpi_jaco library can support dual arms. And if not, I'd like to try to contribute some code to make it possible.

@dekent
Copy link
Contributor

dekent commented Nov 24, 2015

Currently the wpi_jaco package only supports one arm. If you'd like to contribute code to support multiple arms, that would be great! I halted development on this package for a while since I haven't had an arm to test on during the last few months, but we're getting a new arm very soon, so if you have contributions that can extend the functionality of the package, I'll be able to test them again and accept pull requests.

Thanks for your interest, and sorry for the delayed response!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants