User Tools

Site Tools


ece4560:lynx6: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 lynx6 m-file.

Invocation and Basic Usage.

The main invocation is:

  lh = lynx6();

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. The next thing one should do is to tell the manipulator to go to its home 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 home is done by invoking,

  lh.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:

  lh.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,

  lh.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:

  lh.gotoSleep();
  lh.shutdown();

Serial Port Issues

Since it is common for there to be serial port issues during debugging, a static member function exists that should find any open serial ports and close them. It is invoked via:

  lynx6.closeSerialPorts();
ece4560/lynx6/interfacing.txt · Last modified: 2024/08/20 21:38 by 127.0.0.1