/Arduino-sketch_ar2_control

The motor controller for AR2 arm with adaption to MoveIt

Primary LanguageC++Apache License 2.0Apache-2.0

Arduino-sketch_ar2_control

This is the motor controller for AR2 arm. Though AR2 has its Arduino sketch already, it is not designed for ROS MoveIt. Extending the AR2 to MoveIt application for which is this repository aims.

With a thorough refactor, it can catch up with the frequency of the hardware interface by removing many logics that are redundant to MoveIt and introducing timer-interrupt for bit banging. Meanwhile, it keeps the “MJ” protocol as exact as before, which enables communication to “AR2.py” as well.

Prerequisites

It relies on rosserial library to communicate, so please install such library from library managment of Arduino IDE. image

To avoid jerking, the timer-interrupt mechanism was introduced for bit banging, so also please install the library "TimerOne" from Arduino IDE. image

Potential issue

image

The compile error: "Rosserial_Arduino_Library\src/ros/msg.h:40:10: fatal error: cstring: No such file or directory" would be prompted, if version 0.9.1 is installed, which is still an open issue in this thread#518.

Degrade the version to 0.7.9 for a temporary solution.

Wiring

Please check electrical wiring meets the pin’s definition. Two major parts: the direction and pulse of the stepper driver, and the input of the limit switch.

const int joint_step_pin_[JOINT_NUM] = { 2, 4, 6, 8, 10, 12 };
const int joint_dir_pin_[JOINT_NUM] = { 3, 5, 7, 9, 11, 13 };
const int joint_limit_pin_[JOINT_NUM] = { 22, 23, 24, 25, 26, 27 };

Usage

With MoveIt

First make sure the MOVEIT is defined to 1, then compile and upload

#define MOVEIT 1

Please go to link https://github.com/xinjuezou-whi/ar2_arm_interface to refer its usage with MoveIt

With AR2.py

Change the definition of MOVEIT to 0, then compile and upload

#define MOVEIT 0

Limit

  • By running the AR2.py, only the joint movement is valid, which means the "Millimeters to Jog" is unfunctional. Because the Cartesian motion is not implemented so far
  • There will be obvious jerk if the frequency is up to 1.6+KHz, that is 30+ of speed ratio