User Tools

Site Tools


ece4560:piktul:interfacing

Manipulator Interface Code: Execution

This section further discusses the interface code, beyond the calibration variables. The code described here should not be run until AFTER you have configured and calibrated the manipulator and the piktul m-file.

Invocation and Basic Usage.

The main invocation is:

  arm = piktul();

which returns a handle. An optional setup parameter can be used to specify the overall configuration of the manipulator. If this is not given, then default values are used. Let's say that you have calibrted and saved the calibration file under the filename 'pikparms.mat' then using them involves

  pp = load('pikparms.mat');
  arm = piktul(pp);

or in one step

  arm = piktul(load('pikparms.mat'));

The next thing one should do is to tell the manipulator to go to its sleep position until it finally does so (repeated attempts may be necessary). After that, commands will function as intended. Prior to that, the manipulator circuit board is not initialized and may not behave as commanded. Going to sleep is done by invoking

  arm.gotoSleep();

Once enabled and sent to sleep (you should see it twitch into place), then you are ready to go home, then start working with the manipulator. Going to home is done by invoking,

  arm.gotoHome();

After this, the manipulator can be interfaced without problems, hopefully. You can determine what this home position is by modifying the appropriate internal variable.

Access to the manipulator functions are through the handle that is returned. For example to directly send a low-level PWM command to the manipulator, you would do:

  arm.setServos( pwmvector, duration)

where pwmvector is a vector of the PWM command to send and duration is the desired duration of the command. The PWM command is given in servo command units [500, 2500] whose limits respect the limits you've identified from the calibration step. If the internal variables of the interface object are setup correctly, you should be able to avoid sending direct servo commands and instead send joint angle commands. You can command the joints only, or the joints and the gripper,

  arm.setArm( jointvector, duration)

The function will determine if you intended to send only joint angles or if you'd also like to command the gripper position.

Please note that when I say something is a vector, that means it should be a column vector. The code will ignore any argument that is not a column vector.

Termination

Because the system opens up a serial port for communication, you will have to properly shut down the interface object. Also, the manipulator should be commanded to the sleep position. The sleep position should be a joint configuration that makes sense for storing and moving the manipulator about; one that does not lead to it flopping about so much. Termination would then go as follows:

  arm.gotoSleep();
  arm.shutdown();

Back

ece4560/piktul/interfacing.txt · Last modified: 2023/03/06 10:31 by 127.0.0.1