Note: Knowledge of ROS basics, TF and URDF is must.
The idea is to create a robot arm that can perform pick and place objects using object recognition. I used Arduino Mega 2560 along with RAMP 1.4 for connecting motors, performing task. I used an external library called AccelStepper for motion control of the stepper motors. Arduino is connected with PC serially which has ROS for visualization, planning trajectory of robotic arm along with TensorFlow and OpenCV for object detection. All joints are actuated with stepper motors except the parallel-jaw gripper which is actuated with a servo.
Bill of Materials (BOM)- Arduino Mega $40
- RAMP 1.4 $7
- TB6560 stepper motor driver (x5) $42
- NEMA23 stepper motor (x2) $ 24.18
- NEMA17 stepper motor $ 6.55
- NEMA17 long stepper motor $ 11.85
- NEMA17 5:1 geared motor $26.89
- NEMA14 stepper motor $7.62
- Servo motor $ 32.48
- 65cm T5 belt $27
- M4 heat-set inserts $3.14
- M5 heat-set inserts $3.66
- M5 x 14mm screw $ 2
- M8 x 65mm screw $0.37
- M3 x 25mm screw $ 0.61
- M4 x 20mm screw $0.70
- M3 x 40mm screw $0.67
- M3 x 10mm screw $1.40
- M4 x 10mm screw $0.33
- M3 x 16mm screw $0.84
- M3 x 30mm screw $0.18
- M4 x 55mm screw $0.70
- M4 x 45mm screw $0.84
- M3 thread-forming screw $ 1.41
- M3 nut $0.08
- M4 nut $0.32
- M8 locknut $0.16
- M3 washer $0.11
- M4 washer $0.22
- Wires $10
- Logitech c270 webcam $24
Total cost of project is $574. 3D printing parts not included.
Arduino MegaThe Arduino Mega 2560 is a microcontroller board based on ATmega2560. It has 54 digital input/output pins(of which 14 can be used as PWM outputs), 16 analog inputs, 4 UARTs(hardware serial ports), a 16 MHz crystal oscillator, a USB connection, a power jack, an ICSP header, and a reset button. It has 16 analog inputs, each of which provide 10 bits of resolution (i.e. 1024 different values). By default they measure from ground to 5 volts, though is it possible to change the upper end of their range using the AREF pin and analogReference() function.
Features
- ATmega2560 processor running at 16MHz
- CH340 Serial to USB converter
- 256KB Flash memory
- 54 Digital I/O
- 15 PWM shared with the digital I/O
- 16 Analog inputs that can also be used as digital I/O for a total of up to 70 digital I/O
- 4 Hardware serial ports
- 5V Operation
The MEGA 2560 operates at 5V which can be supplied via an external power supply or through the USB port connection. The power source is selected automatically if both are available.
Specifications
Microcontroller ==> ATmega2560
- Operating Voltage ==> 5V
- Input Voltage (recommended) ==> 7-12V
- Input Voltage (limits) ==> 6-20V
- Analog Input Pins ==> 16
- DC Current per I/O Pin ==> 40 mA
- DC Current for 3.3V Pin ==> 50 mA
- Flash Memory ==> 256 KB of which 8 KB used by bootloader
- SRAM ==> 8 KB
- EEPROM ==> 4 KB
- Clock Speed ==> 16 MHz
The board can operate on an external supply of 6 to 20 volts. If supplied with less than 7V, however, the 5V pin may supply less than five volts and the board may be unstable. If using more than 12V, the voltage regulator may overheat and damage the board.
- VIN ==> The input voltage to the Arduino board when it's using an external power source (as opposed to 5 volts from the USB connection or other regulated power source). You can supply voltage through this pin, or, if supplying voltage via the power jack, access it through this pin.
- 5V ==>The regulated power supply used to power the microcontroller and other components on the board. This can come either from VIN via an on-board regulator, or be supplied by USB or another regulated 5V supply.
- 3V3 ==> A 3.3 volt supply generated by the on-board regulator. Maximum current draw is 50 mA.
- GND ==> Ground pins.
- Serial ==> 0 (RX) and 1 (TX); Serial 1: 19 (RX) and 18 (TX); Serial 2: 17 (RX) and 16 (TX); Serial 3: 15 (RX) and 14 (TX). Used to receive (RX) and transmit (TX) TTL serial data.
- External Interrupts ==> 2 (interrupt 0), 3 (interrupt 1), 18 (interrupt 5), 19 (interrupt 4), 20 (interrupt 3), and 21 (interrupt 2). These pins can be configured to trigger an interrupt on a low value, a rising or falling edge, or a change in value.
- PWM ==> 0 to 13 provide 8-bit PWM output with the analogWrite() function.
- SPI ==> 50 (MISO), 51 (MOSI), 52 (SCK), 53 (SS). These pins support SPI communication using the SPI library. The SPI pins are also broken out on the ICSP header, which is physically compatible with the Uno, Duemilanove and Diecimila.
- LED ==> There is a built-in LED connected to digital pin 13. When the pin is HIGH value, the LED is on, when the pin is LOW, it's off.
- TWI ==> 20 (SDA) and 21 (SCL). Support TWI communication using the Wire library
- AREF ==>Reference voltage for the analog inputs.
- Reset ==> Bring this line LOW to reset the microcontroller.
RAMPS interfaces an Arduino Mega with the powerful Arduino MEGA platform and has plenty room for expansion. The modular design includes plug in stepper drivers and extruder control electronics on an Arduino MEGA shield for easy service, part replacement, upgrade-ability and expansion. Additionally, a number of Arduino expansion boards can be added to the system as long as the main RAMPS board is kept to the top of the stack.
Version 1.4 uses surface mount capacitors and resistors to further cover edge issue cases.
Features
- It has provisions for the cartesian robot and extruder.
- Expandable to control other accessories.
- 3 mosfets for heater / fan outputs and 3 thermistor circuits.
- Fused at 5A for additional safety and component protection
- Heated bed control with additional 11A fuse
- Fits 5 Pololu stepper driver board
- Pololu boards are on pin header sockets so they can be replaced easily or removed for use in future designs.
- I2C and SPI pins left available for future expansion.
- All the Mosfets are hooked into PWM pins for versatility.
- Servo style connectors are used to connect to the endstops, motors, and leds. These connectors are gold plated, rated for 3A, very compact, and globally available.
- USB type B receptacle
- SD Card add on available — Available now made by Kliment – Sdramps
- LEDs indicate when heater outputs on
- Option to connect 2 motors to Z for Prusa Mendel
You will need the Arduino software to upload the firmware to Arduino Mega. The version of Arduino you need may be determined by the firmware you want to use
Troubleshooting: You may need to make sure that the driver is installed for the Arduino MEGA by going to Control Panel -> Hardware and Sound -> Device Manager or by simply search device manager. If the device that appears/disappears when you plug in and unplug the board USB is “Unknown Device” under “Other devices”, then you need to right click on the device and click the update driver button. Find where on your computer you saved/installed the Arduino software, and tell the wizard to search in the driver folder there. Windows 8 will give this error: “The third party INF does not contain digital signature”. If so, save the zip for the latest version of Arduino on your PC, and repeat the steps above with the driver folder in there. It should contain the digital signature Windows needs.
Sprinter and Marlin are popular and stable firmwares for RAMPS.
Working preconfigured Marlin firmware can be downloaded is for mechanical endstops. For optical, you will need to reverse the endstop logic in configuration.h. The language of display is in italian, but can easy be changed in language.h. It is preconfigured for the RepRap Discount Smart Controller and similar LCD module. You will need to disable LCD in configuration.h if not using it.
mechanical endstops require (#define OPTO_PULLUPS_INTERNAL 1) to be added to configuration.h if not there by default.
RAMPS 1.4 Pinout
#define X_STEP_PIN ==> 54
#define X_DIR_PIN ==> 55
#define X_ENABLE_PIN ==> 38
#define X_MIN_PIN ==> 3
#define X_MAX_PIN ==> 2
#define Y_STEP_PIN ==> 60
#define Y_DIR_PIN ==> 61
#define Y_ENABLE_PIN ==> 56
#define Y_MIN_PIN ==> 14
#define Y_MAX_PIN ==> 15
#define Z_STEP_PIN ==> 46
#define Z_DIR_PIN ==> 48
#define Z_ENABLE_PIN ==> 62
#define Z_MIN_PIN ==> 18
#define Z_MAX_PIN ==> 19
#define E_STEP_PIN ==> 26
#define E_DIR_PIN ==> 28
#define E_ENABLE_PIN ==> 24
#define SDPOWER ==> -1
#define SDSS ==> 53
#define LED_PIN ==> 13
#define FAN_PIN ==> 9
#define PS_ON_PIN ==> 12
#define KILL_PIN ==> -1
#define HEATER_0_PIN ==> 10
#define HEATER_1_PIN ==> 8
#define TEMP_0_PIN ==> 13 // ANALOG NUMBERING
#define TEMP_1_PIN ==> 14 // ANALOG NUMBERINGStandard RAMPS has a 5A PTC fuse that runs the Arduino Mega, the stepper motor drivers, and the D10 and D9 outputs. This PTC fuse is rated for a max of 30V, however other components on the board are rated for lower voltages, so care should be taken when using any voltage >12V.
Standard RAMPS has a 11A PTC fuse that runs the D8 output. This PTC fuse is rated for a max of 16V.
The 3 pins next to the reset switch are meant to optionally connect to your PSU. The PS_ON pin is intended to switch your power supply on and off.
Without D1 installed, or when the 12VIN is not connected, the Arduino gets its power from USB. If you want your kit powered without USB connect VCC to your PSU.
If you want to use PS_ON to turn on your power supply then don’t use diode D1, you need your Arduino to be powered from 5Vsb otherwise when no USB is connected the PS_ON pin floats (and your power supply pulses on and off).
The 5V pin in that connector on RAMPS only supplies the 5V to the auxiliary servo connectors. It is designed so that you can jumper it to the VCC pin and use the Arduino’s power supply to supply 5V for extra servos if you are only powered from USB or 5V. Since there is not a lot of extra power from the Arduino’s power supply you can connect it directly to your 5V power supply if you have one. You can also leave this pin not connected if you have no plan to add extra servos.
Power Supply without diode
- The Arduino Mega maximum input voltage
- Filtering capacitor maximum voltages
- PTC fuse maximum voltages
First, the 1N4004 diode connects the RAMPS input voltage to the Arduino Mega which has a recommended maximum input voltage of 12 volts. If your board does not have this diode soldered in (or if you cut it), you will need to power the Mega through the USB connector or through a separate 5v line, but this allows a higher RAMPS voltage.
Second, most boards use 25v or 35v aluminum electrolytic capactors (C2, C3, C4, C6, C7, C9, and C10). To be safe, you should only go to half of your rated maximum voltage — thus if your board has 35v capacitors (code VZA) then you should use a maximum input of 17.5v. The absolute maximum voltage is determined by the pololu servo drivers, which themselves are limited to 35V.
Third, the MF-R500 (5A) PTC fuse is rated to 30V and the MF-R1100 (11A) PTC fuse is rated to 16V. They will need to be replaced with real fuses.
Power Supply with diode
If your board has a 1N4004 diode soldered in, do not apply more than 12 V to it. Original flavor Arduino Mega are rated to 12 V input. While Arduino Mega 2560 can take 20 V, it is not recommended.
TB6560 Single-Axis Controller Stepper Motor DriverFeatures The current level is adjustable to meet your various application requirements
- Automatic semi-flow adjustable;
- The use of high-speed optical coupling 6N137,
- ensuring high speed without losing step; The board printed setup instructions
- good heat dissipation.
Specification
- Working voltage: DC 10~35V, recommended using switch DC 24V power supply;
- Uses 6N137 high speed optocoupler, ensuring high speed never lost steps;
- Uses Toshiba TB6560AHQ brand new genuine chip, with low voltage shutdown, over-temperature and over-current protection circuit parking, to ensure optimum performance.
- Rated maximum output is about 3A, peak value is 3.5A
- Suitable 42, 57 3A stepper within two / four phase, four wire / six wire stepper motor, not suitable for more than 3A stepper motor
- Automatic half current function; Segments: full step, half step, 1/8 step, 1/16 step, up to 16 segments
Wiring to controller
Wiring to stepper
Terminal description
Name ==> Description
- +24V, GND The power supply for motor
- A+ A- Motor phase A
- B+ B- Motor phase B
- CLK+ CLK- pulse positive and negative
- CW+ CW- direction positive and negative
- EN+ EN- enable positive and negative
CLK, CW and EN can be configured to work as high TTL or Low TTL
If use 12V signal, connect a 1K resistor, if use 24V signal, connect a 2.4K resistor
Working when CLK pulse signal is received, and enter into stop current mode when no CLK signal to lock motor
CW run the motor clockwise on high TTL or flow TTL, and vice verse on low TTL
EN enable module working mode on low or flow TTL, and vice verse on high TTL for stand by mode.
Stepper motorThe name Stepper Motor itself shows that the rotor movement is in the form of various steps or discrete steps. It is also known as Stepping Motor. The number of pulses fed into the controller circuit determines the angular rotation of the motor. Each input pulse produces one step of the angular movement. The drive is considered as an analog to digital converter. It has an inbuilt logic, which causes appropriate windings to be energised and de-energized by the solid state switches in the required sequence.
Step angle (step resolution)
It is defined as the angle with which the rotor of a stepper motor moves when one pulse is applied to the input of the stator.
or
We can say how much degree the motor will rotate when a single pulse is applied.
Step angle = degree of motor rotation / pulse
The positioning of a motor is decided by the step angle and is expressed in degrees.
The step angle of the motor will tell us that how many pulses should be applied to the motor to complete 360 degree rotation – that means one revolution.
Example
If a motor has step angle 1.8, means it rotates 1.8 degree per pulse
For 360 degree it should be 360 / 1.8 = 200 pulses.
So it is very much essential to know the step angle of the motor to rotate it to a specific number of revolutions or to rotate it to a specific degree. The step angle of the motor is always specified by its manufacturer in its datasheet. As we are working with 1.8 degree step angle.
Detent torque
It is the amount of torque the motor produces when the windings are not energized. The effect of detent torque can be felt when moving the motor shaft by hand, in the form of torque pulsations or cogging. Detent torque reduces both the ideal power and ideal torque that the motor could produce, with the effect becoming larger as speed increases.
Detent torque can be beneficial when stopping the motor. The momentum of the moving rotor is countered by the detent torque and the friction in the rotating components. Therefore, a higher detent torque will help the motor to stop more quickly. The detent torque typically ranges from 5 to 20% of the holding torque.
Holding torque
It is the amount of torque needed in order to move the motor one full step when the windings are energized but the rotor is stationary.
Holding torque is the sum of the magnetic force exerted by the coils to hold the motor current position plus the detent torque. Once the motor is moving, the torque available at low speeds equals the holding torque minus two times the detent torque because the motor has to work against the detent torque.
Stepper Motor Speed
By comparison with regular DC motors stepper motors are very slow devices. Typical speeds might be 1000 to 4000 steps per second and for a 200 step motor that would represent 5 to 20 rps (300 to 1200 rpm). The motor with low coil resistance and high currents (and low nominal voltages) will be most suitable for higher speeds. A high voltage will also be needed for high speed.
Acceleration
If the stepper motor is required to move a heavy load it will be necessary to start the movement slowly and accelerate to the desired speed and, equally, to decelerate when it is necessary to stop.
If you try to start or stop a stepper motor too quickly it will simply skip steps with no damage to motor. However, The Arduino has no means to know whether or how many steps have been missed and all of the position control will be lost. For this reason, in particular, it is essential to choose a motor with sufficient torque for the job and to use acceleration and deceleration when necessary.
Position Feedback
Stepper motors do not have the ability to tell the Arduino what position they are at, nor do they have the ability to go to a particular position. All they can do is move N steps from where they are now.
Initial Position
When it starts up the Arduino has no means of knowing where the stepper motor is positioned. The usual way to establish a datum for counting steps is with a limit switch. At startup the Arduino will move the motor until it triggers the switch. The Arduino will then regard that step position as step zero for the purpose of future position keeping.
Nema 23 stepper motor
- Motor Type: Bipolar Stepper
- Step Angle: 1.8 deg
- Holding Torque: 1.26Nm(178.4oz.in)
- Rated Current/phase: 2.8A
- Voltage: 2.5V
- Phase Resistance: 0.9ohms
- Inductance: 2.5mH ± 20%(1KHz)
Nema17 5:1 Gearbox Stepper motor
Electrical Specification
- Motor Type: Bipolar Stepper
- Step Angle: 0.35 deg
- Holding Torque without Gearbox: 22Ncm(31.2oz.in)
- Rated Current/phase: 0.4A
- Phase Resistance: 30ohms
- Voltage: 12V
- Inductance: 34mH ± 20%(1KHz)
Gearbox Specifications
- Gearbox Type: Planetary
- Gear Ratio: 5.18: 1
- Efficiency: 90%
- Backlash at No-load: <=1 deg
- Max.Permissible Torque: 2Nm(283oz.in)
- Moment Permissible Torque: 4Nm(566oz.in)
- Shaft Maximum Axial Load: 50N
- Shaft Maximum Radial Load: 100N
Nema 17 Stepper motor
Electrical Specification
- Motor Type: Bipolar Stepper
- Step Angle: 1.8 deg
- Holding Torque: 26Ncm(36.8oz.in)
- Rated Current/phase: 0.4A
- Voltage: 12V
- Phase Resistance: 30ohms
- Inductance: 37mH ± 20%(1KHz)
Nema 17 Stepper motor (long)
Electrical Specification
- Motor Type: Uni-polar Stepper
- Step Angle: 1.8 deg
- Holding Torque: 65Ncm(92oz.in)
- Rated Current/phase: 1.2A
- Voltage: 7.2V
- Phase Resistance: 6.0ohms
- Inductance: 7.0mH ± 20%(1KHz)
Nema 14 Stepper motor
Electrical Specification
- Motor Type: Bipolar Stepper
- Step Angle: 1.8 deg
- Holding Torque: 18Ncm(25.5oz.in)
- Rated Current/phase: 0.8A
- Voltage: 5.4V
- Phase Resistance: 6.8ohms
- Inductance : 10mH ± 20%(1KHz)
Tune Stepper driver current
Rated current => maximum value of current beyond which the motor will not be operating according to its desired operation.
In order to determine the maximum current each stepper driver is set to deliver, we will measure the reference voltage. Determining the reference voltage that corresponds to the current we want involves a very simple calculation:
Vref = 0.5Ω * Imax
Where Vref is the reference voltage and Imax is the maximum current the stepper driver will deliver.
Each of the stepper motors needs a different amount of current. Therefore, we will need to calculate the target reference voltage for each stepper driver.
Nema 17 long (base motor)
Maximum current rating: 1.2A
Running current: 1A
Vref = 0.5 Ω * 1A
Vref = 0.5V
Nema 23 (shoulder motors)
Maximum current rating: 2.8A
Running current: 2A
Vref = 0.5 Ω * 2A
Vref = 1V
5:1 Nema17geared stepper (elbowmotor)
Maximum current rating: 0.4A
Running current: 0.3A
Vref = 0.5 Ω * 0.3A
Vref = 0.15V
Nema 17 (wrist motor for twist) means left and right movement
Maximum current rating: 0.4A
Running current: 0.4A
Vref = 0.5 Ω * 0.4A
Vref = 0.2V
Nema 14 (wristmotor for tilt) means up and down movement
Maximum current rating: 0.8A
Running current: 0.6A
Vref = 0.5 Ω * 0.6A
Vref = 0.3V
The servo Motor basically consists of a DC motor, a gear system, a position sensor and a control circuit. The DC motors get powered from a battery and run at high speed and low torque. The Gear and shaft assembly connected to the DC motors lower this speed into sufficient speed and higher torque. The position sensor senses the position of the shaft from its definite position and feeds the information to the control circuit. The control circuit accordingly decodes the signals from the position sensor and compares the actual position of the motors with the desired position and accordingly controls the direction of rotation of the DC motor to get the required position.
A servo motor is controlled by controlling its position using Pulse Width Modulation Technique. The width of the pulse applied to the motor is varied and send for a fixed amount of time.
Continuous rotation servos are standard RC servos that have been modified to offer open-loop speed control instead of their usual closed-loop position control. The modification effectively turns them into motors with integrated motor drivers in a compact, inexpensive package.
TensorFlow is an open-source software library for data flow programming across a range of tasks. We will use TensorFlow’s (TF) new Object Detection API and OpenCV in Python 3. We will Create a virtualenv that has Python 3, OpenCV 3, and TensorFlow 1.10. TensorFlow version should be more than 1.2.
Real-Time Object Recognition
During real-time object recognition, the label of the recognized object is sent via ZMQ to a node in ROS. Then, the node in ROS publishes to a rostopic. The intermediate step of sending via ZMQ is necessary because ROS only supports Python 2, whereas the object recognition app uses Python 3. Thus, ZMQ really is just used to send the detected object information from a Python 3 (non-ROS friendly) environment to a Python 2 (ROS friendly) environment.
About ZMQ
Using Real-Time Object Recognition to Perform Object-Specific Pick and Place
The node, moveo_objrec_publisher.py receives the label of the recognized object from the object_detection_multithreading.py script, and publishes a sequence of trajectories (on the /joint_steps topic) to perform a 'pick and place' motion for that specific object. The Arduino subscribes to the /joint_steps topic and performs the trajectories.
1. Prerequisites
sudo apt-get update
sudo apt-get upgrade
sudo apt-get install build-essential cmake gfortran git pkg-config
sudo apt-get install python-dev software-properties-common wget vim
sudo apt-get install python-pip python-dev build-essential
sudo apt-get install python3-pip python3-dev build-essential
2.
Install the virtual environment wrapper which enables us to create and work on virtual environments in python.
sudo pip3 install virtualenv virtualenvwrapper
echo "# Virtual Environment Wrapper" >> ~/.bashrc
echo "source /usr/local/bin/virtualenvwrapper.sh" >> ~/.bashrc
source ~/.bashrc
Create a virtual environment for python 3. You can give any name.
mkvirtualenv robo-py3 -p python3
Activate the virtual environment
workon robo-py3
pip install numpy scipy matplotlib scikit-image scikit-learn
3. Install TensorFlow
pip install tensorflow
To exit from virtual environment use command
deactivate
OpenCV (Open Source Computer Vision Library) is an open source computer vision and machine learning software library. OpenCV was built to provide a common infrastructure for computer vision applications and to accelerate the use of machine perception. It has 2500 optimized algorithms, these algorithms can be used to detect and recognize faces, identify objects, classify human actions in videos, track camera movements, track moving objects, extract 3D models of objects ans so on.
Please read all the steps before installing.
1. Install dependencies
sudo apt-get install checkinstall yasm
sudo apt-get install libjpeg8-dev libjasper-dev libpng12-dev
sudo apt-get install libtiff5-dev
sudo apt-get install libavcodec-dev libavformat-dev libswscale-dev libdc1394-22-dev
sudo apt-get install libxine2-dev libv4l-dev
sudo apt-get install libgstreamer0.10-dev libgstreamer-plugins-base0.10-dev
sudo apt-get install libqt4-dev libgtk2.0-dev libtbb-dev
sudo apt-get install libfaac-dev libmp3lame-dev libtheora-dev
sudo apt-get install libvorbis-dev libxvidcore-dev
sudo apt-get install libopencore-amrnb-dev libopencore-amrwb-dev
sudo apt-get install x264 v4l-utils
2. Download OpenCV source
git clone https://github.com/opencv/opencv.git
cd opencv
git checkout 3.3.0
cd ..
git clone https://github.com/opencv/opencv_contrib.git
cd opencv_contrib
git checkout 3.3.0
cd ..
3. Configuring and compiling OpenCV
Activate virtual environment
workon robo-py3
setup and configure our build using CMake
cd opencv
mkdir build
cd build
cmake -D CMAKE_BUILD_TYPE=RELEASE \
-D CMAKE_INSTALL_PREFIX=/usr/local \
-D INSTALL_C_EXAMPLES=ON \
-D INSTALL_PYTHON_EXAMPLES=ON \
-D WITH_TBB=ON \
-D WITH_V4L=ON \
-D WITH_QT=ON \
-D WITH_OPENGL=ON \
-D OPENCV_EXTRA_MODULES_PATH=../../opencv_contrib/modules \
-D BUILD_EXAMPLES=ON ..
Compile and Install
make -j4
sudo make install
sudo sh -c 'echo "/usr/local/lib" >> /etc/ld.so.conf.d/opencv.conf'
sudo ldconfig
4. Finish your OpenCV install
Change the name of file cv2.cpython to cv2
cd /usr/local/lib/python3.5/site-packages/
sudo mv cv2.cpython-35m-x86_64-linux-gnu.so cv2.so
creation of symlinks
cd ~/.virtualenvs/robo-py3/lib/python3.5/site-packages/
ln -s /usr/local/lib/python3.5/site-packages/cv2.so cv2.so
As I am working with ROS it also have OpenCV package. So if you call OpenCV (import cv2). It will try to load ROS package.
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
ImportError: /opt/ros/kinetic/lib/python2.7/dist-packages/cv2.so: undefined symbol: PyCObject_Type
******************************************IMPORTANT******************************************
To fix that you can either change ln -s /usr/local/lib/python3.5/site-packages/cv2.so cv2.so to ln -sf /usr/local/lib/python3.5/site-packages/cv2.so cv2.so if this fix you problems that will be cool otherwise you have to comment source /opt/ros/kinetic/setup.bash in bash file. You can call source /opt/ros/kinetic/setup.bash anytime to run ROS.
****************************************************************************************************
ROS is an open source robotic software system that can be used without licensing fees. It is sometimes called a meta operating system because it performs many functions of an operating system, but it requires a computer's operating system such as Linux. One of its main purposes is to provide communication between the user, the computer's operating system, and equipment external to the computer. ROS modules can be written in any language like C++, Python, MATLAB, JAVA and so on.
ROS Master
The ROS Master provides naming and registration services to the nodes in the ROS system. It tracks publishers and subscribers to the topics.The role of the Master is to enable individual ROS nodes to locate one another.The most often used protocol for connection is the standard Transmission Control Protocol/Internet Protocol (TCP/IP) or Internet Protocol called TCPROS in ROS.Once these nodes are able to locate one another, they can communicate with each other peer-to-peer.One responsibility of the Master is to keep track of nodes when new nodes are executed and come into the system.
==> Manages communication between nodes.
==> Every node must be register at startup with the master.
To start master use command
roscore
ROS Node
Nodes are processes that perform some action. The nodes themselves are really software modules but with the capability to register with the ROS Master node and communicate with other nodes in the system.Each node is an independent module that interacts with other nodes using the ROS communication capability.A node can independently execute code to perform its task but can communicate with other nodes by sending or receiving messages. The messages can consist of data, or commands, or other information necessary for the application or some nodes provide information for other nodes.
To run a node
rosrun package_name node_name
See active node
rosnode list
To see information of node
rosnode info node_name
ROS Topics
Nodes communicate with each other using topics. Node can publish or subscribe to a topic. One publisher and N subscriber. Topics is a stream of messages. Messages defines the data structure of information that flows from one node to another.
==> Node 1 and Node 2 is register to ROS Master.
==> Node 1 tell the Master that I am a Publisher to this topic.
==> Node 2 tell the Mater that I am a Subscriber to the topic.
==> Message flows from publisher to subscriber.
To see active topics
rostopic list
To show information about a topic
rostopic info /topic_name
To see type of topic
rostopic type /topic_name
ROS Service
ROS Service allow us to code a specific functionality for our robot and provide anyone to call it. One side, we have the server and on the other side, client who want to use it.
Services are synchronous means when we call service our program can not continue until it receive a result from the service.
To see the list of running services
rosservice list
To see information of the service
rosservice info /name
It contain Node that provide service, type of message used by the service, argument service use to take inputs or to perform functionality.
To call service
rosservice call /service_name
Structure of the service message
Request
---
Response
Request is the part of the service message that defines how you will call service
Response is the part of the service message that defines how your service will respond.
Service message file have the extension.srv while topic file have.msg
ROS Action
ROS action is same as topics. It is asynchronous means when we call an action our program can perform other tasks while action being performed. When we call an action, we are calling a functionality that node is providing. When node calls an action, it doesn't necessarily have to wait fr action to complete. It is divided in 2 parts.
1. Action Server 2. Action Client
The node that provide functionality has to contain an action server. The action server allows other node to call that action functionality.
The node that calls to the functionality has to contain action client. The action client allows a node to connect to action server.
To see list of action
rostopic list
To know which is action you will see something like this
/....action_server/...
Action message is divided in three parts.
goal
---
result
---
feedback
Goal defines how we call or communicate with server.
Result defines what it will return.
All the packages should be installed in catkin workspace. When you create catkin workspace there should be these three folders
Always create a package in src directory.
catkin_create_pkg package_name dependencies
Example
catkin_create_pkg my_exam rospy
Once my_exam package created it contains CmakeList.txt, Package.xml and src. Inside of my_exam directory create launch directory.
==> Launch folder contain launch file.
==> src folder contain source file.
==> CMakeList.txt contain list of cmake rules for compilation.
==> Package.xml contain package info and dependencies.
To create launch file
touch launch/ launch_file_name.launch
or
roscd my exam
cd launch
nano launch_file_name.launch
launch_file_name.launch
<launch>
<node pkg="name_of_package" type="name_of_file" name="name_of_node" output="screen"/>
</launch>
To launch launch file
roslaunch package_name launch_file_name.launch
Example
roslaunch my_exam launch_file_name.launch
How to call launch file in another launch file.
<include file="$(find package_where_launch_file_is)/launch/name_of_launch_file.launch">
Example
<include file="$(find gazebo_ros)/launch/empty_world.launch">
Parameter server
is a directory that ROS uses to store parameters.
To get list of parameters
rosparam list
To get a value of a particular parameter.
rosparam get <parameter name>
RViz(ROS Visualisation)
RVizis a 3D visualizer for displaying sensor data and state information from ROS.
How to install ROS kinetic in Ubuntu 16.0.41. Setup your computer to accept software from packages.ros.org.
sudo sh -c 'echo "deb http://packages.ros.org/ros/ubuntu $(lsb_release -sc) main" > /etc/apt/sources.list.d/ros-latest.list'
2. Setup key.
sudo apt-key adv --keyserver hkp://ha.pool.sks-keyservers.net:80 --recv-key 421C365BD9FF1F717815A3895523BAEEB01FA116
sudo apt-get update
3. Install desktop version.
sudo apt-get install ros-kinetic-desktop-full
4. Initialize rosdep.
sudo rosdep init
rosdep update
5. Environment setup.
echo "source /opt/ros/kinetic/setup.bash" >> ~/.bashrc
source ~/.bashrc
6. Dependencies for building packages.
sudo apt-get install python-rosinstall python-rosinstall-generator python-wstool build-essential
7. Create a catkin workspace
mkdir -p ~/catkin_ws/src
cd ~/catkin_ws/src
catkin_init_workspace
cd ~/catkin_ws/
catkin_make
Whenever new package is build, update environment.
source devel/setup.bash
8. when setup is complete run command roscore to start master node.
roscore
Universal Robotic Description Format (URDF)
URDF is an XML file format used in ROS to describe all elements of a robot. In this file we define weight, inertia, joints, links, sensor plugins. URDF model not only needed for simulation they are also used for having virtual description of the real robot. All stl files should be included in meshes folder.
Packages needed to be installed for robotic arm
sudo apt-get install ros-kinetic-moveit-core
sudo apt-get install ros-kinetic-moveit-ros-planning
sudo apt-get install ros-kinetic-moveit-ros-planning-interface
sudo apt-get install ros-kinetic-moveit-visual-tools
sudo apt-get install ros-kinetic-moveit-fake-controller-manager
sudo apt-get install ros-kinetic-moveit-plugins
sudo apt-get install ros-kinetic-moveit-planners
sudo apt-get install ros-kinetic-moveit-planners-ompl
sudo apt-get install ros-kinetic-moveit-ros-robot-interaction
sudo apt-get install ros-kinetic-moveit-ros-move-group
sudo apt-get install ros-kinetic-moveit-ros-visualization
After creating package(my_exam) in src directory don't forget to use catkin_make in catkin_ws or whatever you named your workspace.
catkin_make
Update environment
source devel/setup.bash
or
source /home/username/catkin_ws/devel/setup.bash
Installing and Setting Up Arduino with ROS KineticDownload and install Arduino IDE
Open the browser in Ubuntu and open the link below.
https://www.arduino.cc/en/Main/Software
Then, download Linux 64 version and extract it by command.
tar -xf file name
After extracting you will see a new directory. Here I am using arduino-1.8.2 IDE. Then go to directory by using command.
cd arduino-1.8.2
To run Arduino, use command in arduino-1.8.2 directory.
./arduino
After installing the Arduino IDE, the next step is installing the package that allows communication between ROS and the serial port of the Arduino board. The package is called rosserial_arduino and allows the node that will run on the Arduino to publish or subscribe to the nodes running on Ubuntu. The rosserial package contains three other packages: rosserial_msgs, rosserial_client, and rosserial_python.
sudo apt-get install ros-kinetic-rosserial-arduino
sudo apt-get install ros-kinetic-rosserial
Install the ros_lib library
The link between ROS and Arduino is through the ros_lib library. This library will be used as any other Arduino library.To install the ros_lib library, type the following commands in the Ubuntu terminal.
rosrun rosserial_arduino make_library.py /home/user_name/arduino1.8.2/libraries
or
ros_lib library (Directly download from here and copy it in libraries folder of Arduino)
To install AccelStepper library. Just go to sketch section => include libraries ==> manage libraries and search library AccelStepper and install it.
Highly recommend:- Install AccelStepper library from inside of IDE, if you install library from browser and copy it in library folder it will give you error.
Make sure you download the AccelStepper and ros_lib libraries into your Arduino environment. If libraries are not installed you will get an error saying "ArmJointState.h: no such file".
Run this command after setting up to start master node. Don't forget to run source /home/username/catkin_ws/devel/setup.bash
roscore
In another terminal run source /home/username/catkin_ws/devel/setup.bash before running this command.
roslaunch moveo_moveit_config demo.launch
You
can check active topics using commands
rostopic list
Pitch, Roll and Yaw
It is common though not essential for end effectors to provide three degrees of movement and to offer three degrees of freedom to compliment the three already present on the Robot. The three degrees of movement are termed pitch roll and yaw,
Pitch => is angular rotation in the vertical plane, it can be likened to waving with the fingers pointing up and down.
Roll => is angular movement about the axis of the arm, it can be likened to turning a door knob in either a clockwise or anti-clockwise direction.
Yaw => is angular rotation in the horizontal plane, it can be demonstrated by allowing the hand to remain horizontal whilst moving the fingers to the left or right.
Manipulator KinematicsRobot manipulator is defined as serial assemblage(chain) of links and joints. One end is connected to ground and free end is connected to an end effector or gripping device.
A material body which is common to two or more kinematic pairs is called a link.Link is the rigid part of the robot body.
Joint => is a part of the robot body which allows controlled or free relative motion of two links. Types of joints are (I am not explaining every joint).
- Revolute joints (R) => revolute joints have one DoF and are used to describe rotational movements (with 1 DoF) between objects. Their configuration is defined by one value that represents the amount of rotation about their first reference frame's z-axis.
- Prismatic joints (P) => prismatic joints have one DoF and are used to describe translational movements between objects. Their configuration is defined by one value that represents the amount of translation along their first reference frame's z-axis.
End effector => is the link of the manipulator which is used to hold the tools (gripper, spray gun, welding gun etc).
Kinematic chain => It is a combination of interconnected links or it is a series of links connected by kinematic pairs. It is of 2 types
Planar => All links moves in parallel planes.
Spatial => Link motion not restricted to a plane.
Kinematic pair => It is a mathematical models of the connections or joint between two links which allow some relative motion.
.Kinematic diagram => is a schematic line diagram showing arrangement of links and their interconnection.
Degree of freedom => Minimum number of independent coordinates(variable) that needed to be specified to fix configuration of a mechanism.
DOF of planar mechanism
F = 3(nl - 1) - 3 nj + ∑ fi
nl ==> Number of joints, nj ==> Number of joints
∑ fi ==> sum of degree of freedom of each joints.
DOF of spatial mechanism
F = 6(nl - 1) - 6 nj + ∑ fi
In a plane, rigid body have 3 DOF.
In a space, rigid body have 6 DOF.
Axis 1
This axis, located at the robot base, allows the robot to rotate from left to right. This sweeping motion extends the work area to include the area on either side and behind the arm. This axis allows the robot to spin up to a full 180 degree range from the center point.
Axis 2
This axis allows the lower arm of the robot to extend forward and backward. It is the axis powering the movement of the entire lower arm.
Axis 3
The axis extends the robot's vertical reach. It allows the upper arm to raise and lower. On some articulated models, it allows the upper arm to reach behind the body, further expanding the work envelope. This axis gives the upper arm the better part access.
Axis 4
Working in conjunction with the axis 5, this axis aids in the positioning of the end effector and manipulation of the part. Known as the wrist roll, it rotates the upper arm in a circular motion moving parts between horizontal to vertical orientations.
Axis 5
This axis allows the wrist of the robot arm to tilt up and down. This axis is responsible for the pitch and yaw motion. The pitch, or bend, motion is up and down, much like opening and closing a box lid. Yaw moves left and right, like a door on hinges.
Axis 6
This is the wrist of the robot arm. It is responsible for a twisting motion, allowing it to rotate freely in a circular motion, both to position end effectors and to manipulate parts. It is usually capable of more than a 360 degree rotation in either a clockwise or counterclockwise direction.
Pin and setting up of arm with arduinoChange the pin numbers in 'moveo_moveit_arduino.ino' sketch which you have made between your robot and the RAMPS 1.4 and select board and port, upload the file to your Arduino MEGA 2560.
Make sure the robot and the simulation are in the same position to set the simulation upright initially-- go to planning section select "Upright" from "Select Goal States" in RVIZ.
When you select upright in planning section you will see like this.
Update it and select plan and execute.
In 'moveit_convert.cpp' replace the stepsPerRevolution array with the steps/revolution of each of your motors.
Note==> if you don't already know these values, you can experimentally get how many microsteps/revolution your motors have using the MultiStepperTest.ino
With the simulation already running, execute each of the following commands in separate terminal. Don't forget to run source /home/username/catkin_ws/devel/setup.bash in each terminal.
In first terminal (establishes rosserial node that communicates with Arduino)
rosrun rosserial_python serial_node.py /dev/ttyARM0
In second terminal (converts simulation joint_state rotations to steps and publishes on the /joint_steps topic, which the Arduino script subscribes to).
rosrun moveo_moveit moveit_convert
In terminal three (publishes gripper_angle)
rostopic pub gripper_angle std_msgs/UInt16 <angle 0-180>
After executing above 3 commands there will be three new topics.
- /joint_steps ==> steps necessary to move each motor to desired position
- /joint_steps_feedback ==> same as /joint_steps, except published back by Arduino to check that information is being received by Arduino correctly
- /gripper_angle: current angle of the gripper.
To check the topics you can use either of 2 commands
rostopic list
or
rostopic echo /gripper_angle
rostopic echo /joint_steps
rostopic echo /joint_steps_feedback
To move Moveo from the command line
rostopic pub joint_steps moveo_moveit/ArmJointState <Joint1 Joint2 Joint3 Joint4 Joint5 0>
Change Joint1, Joint2 so on to the number of steps you want each joint to move.
Some results
Arm connected with Arduino will be performed motion similar to the motion of an arm in virtual environment.
How to use TensorFlow with ROS for performing pick and placeWork in progress will be updated soon
TensorFlow’s (TF) new Object Detection API (understanding the API)
The API has been trained on the COCO dataset(Common Objects in Context). This is a dataset of 300k images of 90 most commonly found objects.
COCO is a large-scale object detection, segmentation, and captioning dataset. COCO has several features:
- Object segmentation
- Recognition in context
- Superpixel stuff segmentation
- 330K images (>200K labeled)
- 1.5 million object instances
- 80 object categories
- 91 stuff categories
- 5 captions per image
- 250, 000 people with keypoints
The API provides 5 different models that provide a trade off between speed of execution and the accuracy in placing bounding boxes.
mAP (mean average precision) is the product of precision and recall on detecting bounding boxes.The higher the mAP score, the more accurate the network is but that comes at the cost of execution speed.
******************************************IMPORTANT******************************************
Please note that as I have not setup ROS environment because of OpenCV issue so I have to run source /home/username/catkin_ws/devel/setup.bash every time in each terminal(whenever I want to run ROS commands).
****************************************************************************************************
Parts needed for robotic arms1. Rotary Base (x1)
2. Rotary plate (x1)
3. Base motor mount (x1)
4. Shoulder joint (x1)
5. Shoulder joint (x1)
6. Shoulder base (x1)
7. Shoulder base tension-er left (x1)
8. Shoulder base tensioner right (x1)
9. Shoulder shaft cover (x2)
10. Elbow base (x1)
11. Elbow belt tensioner (x1)
12. Elbow joint (x1)
13. Elbow joint (x1)
14. Elbow shaft cover (x2)
15. Wrist base (x1)
16. Wrist belt tensioner (x1)
17. Wrist back cover (x2)
18. Wrist joint (x1)
19. Wrist joint (x1)
20. Wrist shaft cover (x2)
21. Gripper bottom plate (x1)
22. Gripper top plate (x1)
23. Pivot arm (x2)
24 Servo gear A (x1)
25 Servo gear B (x1)
26 Gripper right (x1)
27. Gripper left (x1)
28. Base legs (x4)
29. Cylinder (x2)
Please read all the steps before start assembling.
1. Install heat-set inserts into rotary base
To install the heat set inserts, warm your soldering iron to 230 degree C. If available, choose a soldering iron tip large enough to provide a stable pressure on the center of the heat-set insert, but small enough not to touch any other part of the 3D printed object. Place the heat-set insert on the printed part with the smaller diameter facing down into the hole. Touch the tip of the soldering iron to the top of the heat-set insert. Wait for just a few seconds. The weight of the soldering iron should allow the heat-set insert to settle into the mounting point.Slowly, gently, and evenly press down until the top of the heat-set insert is level with the surrounding plastic.Remove heat and allow to cool.
2. Add 8mm bearings to rotary base
To provide low-friction movement, we will install two ball bearings into the Rotary Base.
Upper side
Down side
3. Attach ball Bearings to rotary base
Using M5 x 14mm screws, attach a 5mm ball bearing to each of the eight heat-set inserts around the periphery of the Rotary Base part. Tighten the screws enough that the ball bearings to do wiggle too much, but not so tight that the bearings are unable to move smoothly.
4. Install heat-set inserts to rotary plate
install six M4 heat-set inserts into the top of the Rotary Plate part.
5. Assemble base motor
For the base of the robot, we will use a Nema 17 motor with a body length of 60mm. To assemble the base motor, insert the Nema 17 motor into the 3D printed Base Motor Holder component. Secure the motor in place with four M3 x 10mm screws.
6. Add belt pulley to base motor
With the base motor installed in its mount, now need to install the T5 belt pulley onto the motor that will drive belt used to move the Rotary Plate. Affter that apply a bit of thread locking compound into the pulley bore. Then, press the pulley onto the motor shaft with the narrower part of the pulley first. Hold the pulley in place for a few minutes until the thread locking compound cures enough to hold the pulley in place.
7. Install heat-set inserts into shoulder joint
The Shoulder Joint is built in two halves to make printing the parts much easier. We will join the two halves of the joint using heat-set inserts and machine screws.
In order to identify in which half of the Shoulder Joint should be used to insert heat-set inserts, look for the half with chamfered holes. Install M4 heat-set insert into each of the four holes on top of the Shoulder Joint half using solder iron.
8. Connect shoulder joint halves
With heat-set inserts installed in one half of the shoulder joint, we can now join the two halves together. Simply place the two halves together and connect them using four M4 x 55mm screws.
9. Install heat-set inserts into shoulder joint assembly
After connecting the two halves of the assembly. Install four M4 heat-set inserts into the base of the Shoulder Assembly. These heat-set inserts will be used to connect the next joint assembly on the arm, the "elbow."
10. Add belts to the shoulder joint
The last thing to do is attach the T5 belts to the Shoulder Joint. If you look at the Shoulder Joint part, you will notice that the teeth around the edge of the part These groves will be used to lock the belt in place. Cut off two 36cm lengths of T5 belt. Then, with each belt, slide the ends into the slots in the Shoulder Joint. For now the belts will just be loosely hanging off the part.
11. Install heat-set inserts into shoulder base
First, near the base of the part on each side, install M5 heat-set insert in to each hole. Where the Nema 23 stepper motors will be installed later on.
Then, near the top of the part install M3 heat-set insert into each of the three holes in the circular cutout. Later on, it will be used to install a shaft into the top of this part that will form the middle of the shoulder joint. To hold the shaft in place, two 3D printed cover parts will be installed. The three M3 heat-set inserts on each side of the Shoulder Base part will be used to connect these covers in a later step.
Base
Top
12. Install two more heat-set inserts into shoulder base
Two inserts will be installed on the back side of the part. As most moving parts of the robot arm are driven by belts. For each belt in the robot arm, we will include a device for adjusting the tension on the belt.
13. Assemble base belt tensioners (for both sides)
First, place three 4mm x 13mm x 5mm ball bearings. Then, insert an M4 x 20mm screw through the entire part. Finally, place a nut on the end of the screw.
Next, on the side of the Base Belt Tensioner 3D printed parts opposite the bearings we just assembled, you will notice a hexagonal spot press an M3 nut into this spot.
14. Install base belt tensioners
You will notice a small hole next to the larger hole for the motor shaft. Simply insert an M3 x 25mm screw into each side of the Shoulder Base.
Next, to install the Base Belt Tensioners simply place each tensioner onto the screws and tighten them down. They should be installed such that the M3 nut is on the inside of the part.
15. Add Nema 23 motors to shoulder base
To install the motors, simply screw them in place using four M5 x 14mm screws.
16. Add belt pulleys to Nema 23 motors
Install the two T5 belt pulleys using thread locking compound. First, apply a bit of thread locking compound into the pulley. Then, press the pulley onto the motor shaft with the narrow shank of the pulley closest to the pulley.
17. Mount shoulder joint onto shoulder base
First, press 8mm x 22mm x 7mm ball bearing into each side of the part.
Next, mount the Shoulder Joint onto the Shoulder Base by sliding a smooth rod through the bearings on either side of the Shoulder Base and through the Shoulder Joint at the same time, wrapping the belts around the pulleys on the motors. The best way to do this is to first set the Shoulder Joint part inside the Shoulder Base so that the belts hang loosely out of the bottom of the Shoulder Base, then wrap the belts around the pulleys on the Nema 23 motors. Finally, lift up the Shoulder Joint and insert the smooth rod through the middle.
18. Insert shoulder belt tensioner screws
As shoulder Joint is mounted onto the Shoulder Base, the last step is to add the screws for adjusting the tension on the belts. Into each of the heat-set inserts behind the Base Belt Tensioners, insert an M4 x 20mm screw. Then, screw in each screw until the belt is tight enough that it does not slip on the pulleys.
19. Attach shoulder shaft covers
To install the caps, simply place them in the holes on either side of the Shoulder Base and secure them in place with three M3 x 10mm screws.
20. Install heat-set inserts into elbow base
First, on each side of the Elbow Base, install three M3 heat-set inserts.
Next, seventh heat-set insert (M4) will be installed on the side of the Elbow Base.
21. Assemble elbow belt tensioner
First, press the M4 nut into place. Second, stack three 8mm x 22mm x 7mm bearings together and hold them in place with an M4 x 20mm screw.
22. Add elbow belt tensioner nut
Installing the Elbow Belt Tensioner is tricky part. If you look at the side of the Elbow Base with the hole for the motor, you will find a small hole above right of the spot for the motor. Behind this hole you will find a spot for inserting a captive nut. The easiest way to install the nut is by using a screw as a handle for the nut and press the nut into the hole.
23. Attach elbow base to shoulder joint
As we have not attached motor yet because the motor actually blocks two of the screws for connecting the Elbow Base to the Shoulder Joint so we need to connect these two parts first, and install the motor after that.
Four screws connect the Elbow Base to the Shoulder Joint. Position the Elbow Base so that the heat-set inserts on the back of the part, which will be used later for the Elbow Belt Tensioner, is on the same side as the corresponding part on the Shoulder Base. Then, connect the parts with four M4 x 10mm screws.
24. Install elbow belt tensioner
With the captive nut in place and the Elbow Base connected to the Shoulder Joint, Just place the Elbow Belt Tensioner into the slot in the Elbow Base, insert an M3 x 40mm screw through the Elbow Base and the belt tensioner, and screw it into the captive nut.
25. Add elbow base rod bearings
The process for installing the ball bearings into the Elbow Base is the same as we used for the Shoulder Base ball bearings.
26. Install elbow motor
The motor used for the shoulder joint is the one with a built-in 5:1 gearbox. Because the elbow is low enough on the robot arm that it still needs to move the fairly heavy load of the rest of the arm, we need quite a bit of torque for this joint. The gearbox gives the elbow motor a mechanical advantage for moving the rest of the arm, without using multiple motors which would add a great deal of weight and size. Just insert the motor into the left side of the Elbow Base. Then, secure it in place with four M3 x 10mm screws.
27. Add belt pulley to elbow motor
First, apply a bit of thread-locking compound onto the pulley bore. Then, press the belt pulley onto the elbow motor shaft until it lines up with the Elbow Belt Tensioner.
28. Install heat-set inserts into elbow joint
Elbow Joint is made in two pieces. The heat-set inserts will be installed into the half without the teeth for the belt. A total of six M3 heat-set inserts are needed for the Elbow Joint. For the Elbow Joint heat-set inserts, keep applying pressure to sink the inserts at least 6mm below the surface of the part.
29. Mount wrist motor 1 into elbow joint
On the Elbow Joint half with the belt teeth, you will find two holes on the end of the part. These holes will be used to mount the wrist motor into the part. In front of the pocket for the motor there is a smaller half-cylindrical pocket. This pocket will hold a shaft coupler that connects the motor shaft to the 8mm threaded rod used for the wrist joint. At the end of the 3D printed part, there is a small pocket for a ball bearing.
Before mounting the motor into the Elbow Joint, we need to attach the shaft coupler and the 8mm shaft to the motor. The shaft coupler has a 5mm hole on one side and an 8mm hole on the other. Attach the shaft coupler to the motor with about a 2mm gap between the coupler and the motor body. Tighten the set screws to hold the coupler in place.
Next, insert an 8mm x 40mm threaded rod into the shaft coupler and tighten down the other set screws to hold the rod in place.
Now, install the motor into the Elbow Joint. To do this, simply place the motor assembly into the rectangular cutout in the Elbow Joint with the motor wires facing upwards.
Then, place an 8mm x 22mm x 7mm ball bearing onto the 8mm threaded rod. And finally, to fasten the motor to the Elbow Joint, use two 3mm x 10mm screws inserted from the end of the Elbow Joint part.
30. Connect other elbow joint half
With the wrist motor mounted into one half of the Elbow Joint part. Now, attach the other half of the Elbow Joint. Firstly, the wires coming from the wrist motor is passed through the hole of other half. Then, simply place the two halves of the Elbow Joint together, using six M3 x 50mm screws connect the two parts together.
31. Add belt to elbow joint
Add T5 belt to the Elbow Joint before mounting it onto the Elbow Base. Take a look at the Elbow Joint, you will see that the tooth profile running around the periphery of the part extends towards the center of the part at the base of the Elbow Joint. Press one end of a 46cm length of T5 belt into one side of the Elbow Joint. Then, wrap the belt around the part and connect press the other end of the belt into place.
32. Mount elbow joint onto elbow base
Firstly, set the Elbow Joint part inside the Elbow Base without inserting the smooth rod. There should be enough slack in the belt to wrap it around the pulley on the motor. Once the belt is in place, lift the Elbow Joint part into its final position, with the hole in the center of the part lining up with the ball bearings on either side of the Elbow Base. Finally, place an 8mm x 115mm smooth rod through the entire assembly.
33. Attach elbow shaft covers
Place each cover into the round cutouts on either side of the Elbow Base and fasten them in place with three M3 x 10mm screws each.
34. Install heat-set Inserts into wrist base
M3 heat-set inserts will be needed for the Wrist Base. On each side of the Wrist Base, install three M3 heat-set inserts into the holes for the rod covers.
Next, install the heat-set inserts into the back of the part.
The final two heat-set inserts will be used for the cover near the bottom of the part.
35. Add ball bearings to wrist base
Add the two ball bearings to the Wrist Base that will be used for the Wrist Joint sub-assembly to pivot smoothly. Press an 8mm x 22mm x 7mm ball bearing into each side of the Wrist Base.
36. Mount the captive nut for the wrist belt tensioner
Install the captive nut to hold the Wrist Belt Tensioner. We will use the same technique in this step that we used to install the captive nut for the Elbow Base.
37. Assemble wrist belt tensioner
Firstly, press an M3 nut into the hexagonal hole. Next, stack three of the little 3mm x 10mm x 4mm ball bearings into the middle of the belt tensioner. Hold the assembly together with an M3 x 20mm screw.
38. Install wrist belt tensioner
To install the Wrist Belt Tensioner, place it inside the Wrist Base part, lining it up with the captive nut we installed earlier. Then, use an M3 x 20mm screw to hold the belt tensioner in place.
39. Mount wrist motor 2
The Nema14 motor mounts into the Wrist Base part on the side opposite the belt tensioner. Small cutout on the bottom of the part is used for the wrist motor wires. To mount the wrist motor into the Wrist Base simply place it into the square cutout and secure it in place with four M3 x 10mm screws.
40. Connect wrist base and elbow joint
At the back of the Wrist Base part, there is "T" shaped hole. We will install two parts into this hole that will be used to form the connection between the Wrist Base and the Elbow Joint. Firstly, in the wider part of the hole, insert an 8mm x 22mm x 7mm ball bearing. Press the bearing into the hole until the bore lines up with the 8mm hole on the bottom of the Wrist Base. Next, in the smaller part of the "T" shaped hole, on top of the bearing, insert an M8 lock nut. With the bearing and the lock nut installed, screw the Wrist Base onto the threaded rod from the Elbow Joint. Tighten down the Wrist Base as much as you can until the wrist motor starts turning along with the Wrist Base.
41. Attach wrist back cover
Add a cover to hide the ball bearing and lock nut inside the Wrist Base. This cover fits over the "T" shaped hole in the back of the Wrist Base. To connect the cover, simply screw it in place using two M3 x 10mm screws.
42. Add belt pulley to wrist motor
Add a belt pulley to drive the Wrist Joint. Applying some thread lock compound into the belt pulley bore then, press the belt pulley onto the motor shaft so that the pulley lines up with the Wrist Belt Tensioner.
43. Install heat-set inserts into wrist joint half
Three heat-set inserts will be used to fasten the two halves of the Wrist Joint together. These heat-set inserts will be installed into the half of the Wrist Joint without teeth for the belt.
44. Join together wrist joint halves
With heat-set inserts installed into one half of the Wrist Joint. Simply line up the two halves and then use three M3 x 25mm screws to connect them to each other.
45. Install heat-set inserts into wrist joint bottom
Install four M3 heat-set inserts at the joint bottom. These inserts will be used to connect the gripper to the Wrist Joint.
46. Add belt to wrist joint
Attach an 18mm length of T5 timing belt to the Wrist joint the same way we attached belts to the Shoulder Joint and to the Elbow Joint, by pressing the ends of the belts into the sections of the tooth profile that extend towards the center of the Wrist Joint.
47. Mount wrist joint onto wrist base
Mount the Wrist Joint onto the Wrist Base. Again the first step is to place the Wrist Joint into the Wrist Base and wrap the T5 belt around the pulley. With the belt in place, lift the Wrist Joint into its final position and secure it in place by inserting an 8mm x 80mm smooth rod.
48. Attach wrist shaft covers
Attach one cover to each side of the Wrist Base, using three M3 x 10mm screws on each side to hold the covers in place.
49. Insert wrist belt tensioner screw
Screw M3 x 20mm screw into this heat-set insert and tighten it until the belt reaches the appropriate tension.
50. Install heat-set inserts into gripper bottom plate
Install heat-set inserts into the gripper bottom plate.
51. Add screws to gripper top plate
There are eight holes out of which six are used. Insert Six M3 x 16mm screw into the countersunk holes. Then, on the other side of the Gripper Top Plate, place a washer on the four screws on the outsides of the Gripper Top Plate.
52. Add gripper motion parts and spacers
Firstly, the Gripper uses four arms extending from the center of the body to the gripper jaws. It consist of two arms per jaw ensures that the jaws are always parallel to each other. Two of the arms are geared, allowing a single motor to move both jaws simultaneously.
In this step, add three of the four arms to the Gripper assembly. First, two spacer parts (cylinder 3D part used as spacer) mount onto the two screws in the middle of the Gripper assembly. Then, Install two identical non-geared arms on the two screws on the front of the Gripper Top Plate that are spaced closer together than the other screws.
Finally, there are two arms with gear teeth. One has one hole in the middle and the other has three holes in total. Add the geared arm with only one hole. If you are looking at the Gripper Top Plate with the screws sticking up towards you, the geared arm goes onto the screw on the left. The gears should face the front of the Gripper.
53. Install heat-set insert Into gripper gear arm A
Install a M3 heat-set insert into the Gripper Gear Arm A (middle one) that will allow the arm to be connected rigidly to the servo motor.
54. Add final gear arm to gripper assembly
Apply a bit of thread locking compound to the heat-set insert in the geared arm. Then the arm simply screws onto the only open screw left on the Gripper Top Plate. When installing the arm, position both of the geared arms so that the arms themselves are co-linear. Once you installed add a washer on top of the three arms.
55. Attach gripper bottom plate
Simply place the Gripper Bottom Plate onto the rest of the assembly. Tighten all of the screws until the Gripper assembly does not wiggle or twist.
56. Install heat-set inserts into gripper jaws
Install two M3 heat-set inserts into each of the jaws(left and right).
57. Connect jaws to gripper assembly
Connect the jaws to the gripper arms. After the jaws are installed, the flat side of the jaws will meet when the jaws close. Connect the jaws to the gripper arms using M3 x 16mm screws.
58. Attach gripper assembly to wrist joint
Before adding the servo motor, attach the Gripper to the Wrist Joint because the servo will block two of the screws.The Gripper attaches to the Wrist Joint using the four heat-set inserts on the top of the Wrist Joint. Place the Gripper on the Wrist Joint.Connect the Gripper using four M3 x 10mm screws.
Wow, we are done with robotic arm. Now, we proceed to base section(on which robot arm mounted).
59. Drill center hole in base
Cut a square piece of 3/4 inch plywood measuring 16 inches on each side. The first step in preparing the base is to drill a hole in the middle of the base. The entire robot arm will attach to the base via an M8 bolt. The hole in the middle of the base will allow the locknut on the base to be tightened from underneath of the platform.
60. Drill rotary base mounting holes
I am assuming we have a hole in the wooden platform for accessing the M8 locknut for the Rotary Plate. For drilling mounting holes for the Rotary Base. I find that the easiest way to do this is first, place the Rotary Base onto the wooden platform so that the ball bearings line up with the hole. Then, using a long 4mm drill bit, drill down through the Rotary Base and into the wooden platform. The Rotary Base has a total of four mounting holes.
61. Drill base leg mounting holes
As we have printed four legs. One leg mounts on each corner of the wooden platform. Use 4mm drill bit, position a leg on each corner of the platform, then drill down through the leg to create a mounting hole.
62. Install heat-set inserts into base legs
Install M4 heat-set inserts into the each Base Legs for attaching them to the wooden platform.
63. Attach base legs to wooden platform
First place the legs under the platform. Place a washer onto four M4 x 40mm screws. Then, use the screws to attach the legs to the platform. Keep in mind that the weight of the robot arm will effectively be working with the screws to hold down the wooden platform.
64. Attach rotary base to wooden platform
The first step is to add the mounting screws to the Rotary Base. Insert four M4 x 55mm screws into the four mounting holes around the outer part of the Rotary Base. Then, place the Rotary Base onto the wooden platform with the mounting screws protruding through the platform and out the bottom. Finally, secure the Rotary Base in place using a washer and nut on each of the mounting screws.
65. Add shaft for rotary plate
With the Rotary Base in place, we can now add the Rotary Plate to the assembly. Here, add an M8 x 65mm screw to the Rotary Plate that will act as the rotational shaft and connect the Rotary Plate and Rotary Base together.
On the side of the Rotary Plate with the heat-set inserts, you will notice that in the middle of the part there is a hexagonal cutout for the head on the M8 bolt. To install the Rotary Plate shaft, simply press an M8 x 65mm bolt into the hole in the middle of the piece.
66. Add a belt to the rotary plate
Install the timing belt onto the Rotary Plate. The Rotary Plate is ringed by a tooth profile for the T5 belt. The tooth profile extends into the center of the plate. Place the ends of a 65cm length of T5 belt into the tooth profiles that extend towards the center of the Rotary Plate.
67. Mount the rotary plate onto the rotary base
Firstly, place the Rotary Plate onto the Rotary Base with the M8 bolt inserted through the ball bearings in the Rotary Base. Then, insert M8 locknut through the hole in the center of the wooden base.
68. Mount base motor onto the base
As with the Rotary Base, the easiest way to attach the base motor to determine its location empirically. First, if you take a look at the Rotary Base and the Rotary Plate, you will notice that each part has a small triangle on one side. Rotate the Rotary Plate until the two triangles on the parts match up.
The base motor does its job best when it is mounted on the side of the Rotary Base opposite the two small triangles that are now lined up. Place the motor assembly onto the wooden platform with the Rotary Plate belt wrapped around the pulley on the motor.
Adjust the position of the belt motor until the belt is tight enough to avoid slipping but not so tight that the motor can't move the Rotary Plate. Once base motor is positioned where you want it, drill four holes through the mounting holes in the Base Motor Holder. Finally, secure the base motor in place using four M4 x 45mm screws, with washers and nuts on the underside of the wooden platform.
69. Mount robot arm onto rotary base
The robot arm mounts onto the Rotary Base using six M4 x 40mm screws that will thread into the heat-set inserts we installed into the Rotary Plate long ago. So, simply place the robot arm onto the Rotary Plate with the six holes aligned. Then, fasten the robot arm down using M4 x 40mm screws.
70. Assemble controller
The controller for the robot arm consists of several parts
- For the controller, Arduino Mega 2560 used.
- To allow the Arduino to interface with the motors on the robot arm, RAMPS shield used.
- Equip the RAMPS shield with TB6560 stepper drivers.
First, place the RAMPS shield onto the Arduino Mega and apply firm pressure to connect the two boards. The RAMPS shield should be oriented with the power screw terminals on the same side as the USB port on the Arduino.With the RAMPS shield mounted onto the Arduino board we now need to connect the TB6560 stepper drivers.
71. Add pin headers tomotor cables
Finding the Coil Pairs on a stepper motor
Bipolar motors have 4 wires (2 pairs), Unipolar motors typically have 6. Some other motors have 5, or 8.
Bipolar motors (4 wire) are preferred over unipolar motors because bipolars will have lower coil impedance and therefore more power transfer and torque.
Wire pairs are often color coded by convention. Common wire pairings are:
- Green goes with Black. Yellow is often used for the center tap of the Green/Black pair in a unipolar motor.
- Red goes with Blue. White is often used for the center tap of the Red/Blue pair in a unipolar motor.
Use your volt meter to verify that green and black connect together, and red and blue connect together, and that they don't connect to the other pair. Typical DC resistance across a winding is about 1 to 5 ohms. If you have a Unipolar motor you can just leave the center taps disconnected.
To find wire pairs for a bipolar (4 wire) motor. Spin your stepper motor with your fingers. Depending on the size / holding torque this could be easy or pretty hard. All you really want from this is to get a feel how the motor spins without any of the wires connected to each other. Now that you know how hard it is to spin with your fingers, connect 2 wires together. Just pick any two. Try to spin the motor again. If it feels the same then more than likely these are NOT connected to the same coil. Disconnect these wires. Connect one of the other wires to one of the first wire pairs you tried. Try to spin the motors again. This should be much harder. If so, you have found your wire pairs. Tape these 2 together (not wired but just taped to group them). Tape the remaining 2 wires together as well.
Add headers to the ends of the cables so they can be connected to the RAMPS shield in an upcoming step. Connecting headers to the wires is done using crimp pins and a crimping tool.
For the two wrist motors, the elbow motor, the base motor, and one shoulder motor, install a 4-pin header and housing onto the end of each stepper motor cable. When inserting the wires into the pin housings, the order of the cables should be black, green, red, blue. 3-pin housing for the servo cable.
one of the shoulder motors with the wiring order is black, green, red, blue because if we had wired both shoulder steppers that way, when facing each other they would have turned in opposite directions. Moreover, the Shoulder Joint would not move because it would be pulled equally in both directions. Therefore, we need to change the wiring order for one of the stepper motors, for detailed info of wiring.
For the second shoulder motor, the wiring order should be green, black, red, blue. By reversing the black and green wires, which are connected to one coil pair in the motor, the two shoulder stepper motors will now turn in opposite directions when given the same drive signal, the way they are mounted onto the robot arm, this means the two motors will work together to move the Shoulder Joint.
72. Wire the robot arm (check very carefully)
When connecting all of the stepper motors, keep in mind that the blue wire will always be closest to the side of the RAMPS shield with the power screw terminals.
- Firstly, since both of the shoulder motors will work together to move the arms, they will be connected to the same motor driver. Since the only motor driver on the RAMPS shield with two sets of connections is the Z-Axis driver, the shoulder motors will connect to that driver. With the blue wire closest to the power screw terminals, connect the two shoulder motors to the pins next to the Z-Axis stepper driver.
- Secondly, connect the elbow motor to the Y-Axis stepper driver, again with the blue wire closest to the power screw terminals.
- Thirdly, connect the first wrist motor to the X-Axis motor driver.
- Fourthly, connect the second wrist motor to the E1 stepper driver. We will use the E1 driver for another movement axis.
- Finally, the last motor left to be connected is the servo motor on the gripper. Servo motors are not commonly used but the RAMPS shield does have connectors for servo motors. If you take a look at the side of the board next to the yellow fuses and the reset button, you will find a set of servo connectors. Plug the gripper servo into the connector farthest from the power screw terminal.
73. Wire RAMPS to power supply
On the power supply, there is a large screw terminal with four connection points, and a small screw terminal with two connection points. The terminal closest to the power plug is the positive connection. Connect a red wire to this terminal. The second connection from the plug is ground. Connect a black wire to this terminal.
Then, on the RAMPS shield, there is a bank of six screw terminals and a bank of four screw terminals. We need to connect the wires from the power supply to the bank of four screw terminals. The ground (black) wire connects to the terminal closest to the edge of the board. Then the positive (red) terminal connects to the next terminal. Don't forget to tune current of motor driver.
***************************************************************************************************
Please note that as work is in progress so after checking all the things; schematic, some pictures and program will be uploaded soon.
***************************************************************************************************
Thanks to Jesse.
Comments