Problems mapping a joystick for the Jaco arm

Hello,

I’ve spent about a week on this now and could use some help. I’m trying to create my own mapping for a new joystick to use with the Jaco arm. I think I understand most of what I’m doing, but I guess I’m doing something wrong. If I change something in the ControlMappingCharts and send it to the arm using Jaco.ConfigurationsManager.SetControlMappingCharts(…), I can turn around and call Jaco.ConfigurationsManager.GetControlMappingCharts() and see that the change did not take place.

For example, something as simple as

MappingCharts = Jaco->ConfigurationsManager->GetControlMappingCharts();
MappingCharts->ActualControlMapping = 0;
Jaco->ConfigurationsManager->SetControlMappingCharts(MappingCharts);

//Then check to see if it worked
MappingCharts = Jaco->ConfigurationsManager->GetControlMappingCharts();
std::cout << MappingCharts->ActualControlMapping; //This will print out 2 instead of 0

Is there an example somewhere I could follow? In the developer’s guide on page 31 in the section titled “Set the Control Mapping”, there is a bit of code, but it isn’t complete.

Or is there a possibility I’ve stumbled on a bug?

Thanks,
Aaron

Hi Aaron,

I’ve looked into your code and noticed that you use the variable actualControlMapping. Don’t use that variable and use the method StartControlAPI from the control manager. It will set the mapping correctly automatically. Also, the actual control mapping system already support + and - for 6 DOF, you could use that instead of building your own. Unfortunately, you can’t map the functionalities OpenFinger and CloseFinger to a ButtonEvent, you’ll have to create 2 different mode, one for the movement and another for the hand.

If you want to test things with the mapping system, I suggest you use the application Jacosoft, it will be easier and quicker for you.

Hi Aaron,

My name is Hugo, software engineer at Kinova.
When you need to update the mapping of the robot, you need to reboot the robot after the new mapping has been set.
After the reboot, the new mapping will be updated and you’ll have access to it.

Have a nice day,

Hugo

That is a very specific question. We have contacted the manufacturer in order to find an appropriate answer. We (or the manufacturer directly) will update the thread and soon as we have an answer.

Hugo,

I was thinking that StartControlAPI only gave the API permission to command physical movements to the robot, which I was not doing with those two programs. Are you saying that the API/laptop can’t even read or write correctly without running StartControlAPI?

Also, is there positively no way of using the gripper and arm in the same mode? Given that I have the laptop interpreting the mouse signals, I figured I could have a mapping with 14 functions: 12 for the arm and 2 for the gripper. With the 2 gipper functions assigned a CJacoStructures.ControlFunctionalityValues.OpenHandThreeFingers and CloseHandThreeFingers. But in my software (on the laptop) when a button event from the mouse is received, I simply assign a predetermined value to those functions (it’s not variable like with a joystick).

Is the limitation simply that CJoystickValue can only contain 6 joystick-like commands, and the gripper must have joystick/analog input?

As a constructive suggestion/observation, I think there should be API functions such as translateGripper(float X, float Y, float Z), rotateGripper(float X, float Y, float Z) for example for cartesian movements and even moveJoints(float J1, float J2, float, J3, float J4, float J5, float J6) for joint space control and openGripper(float speed) for gripper control rather than having to deal with added abstraction involved with emulating a joystick for all movements. I imagine that the current construct is useful when someone only wants to plug in a usb input device into the robot without a laptop in the loop, but many research applications will have a laptop involved (and no joystick at all for that matter, which is my next task).

Hello Hugo,

Thanks, for the fast reply. I tried rebooting the robot after changing the control map chart, but it didn’t change the behavior. Would you mind peeking at my code? I tried to simplify it as much as possible. There is a setMapping.cpp, getMapping.cpp, and CMakeLists.txt (you can only upload .txt, so just remove the extra extensions). setMapping.cpp simply tries to set ActualControlMapping to 3, while getMapping.cpp reads the ActualControlMapping back and prints it to screen…it’s always 2 no matter what I’ve tried.

I’m writing it in a C++ application so /clr and /EHa compiler flags are needed incase you want to try it out (the flags are already in the attached CMakesLists.txt if you use cmake). Do you see anything obvious that I might be doing wrong?

I’ll tell you a little bit more about my applicaiton. I’m driving the jaco with a 6 dof mouse…but I have the mouse connected to a laptop. The laptop reads in the mouse values, then outputs to the robot. Right now I can drive the robot around really well in all 6 dof by sending joystick values using the default mapping. But I can’t open and close the gripper because the default mapping doesn’t include gripper movements in the same mode as arm movements (to my knowledge). So I’m trying to write my own control mapping that contains all 12 stick events (+ and - for each dof) and 2 additional button events to open and close the gripper (the 6 dof mouse has many buttons).

Thanks,
Aaron