Introduction: Interactive Path Following Robotic Arm Using PfodApp
Introduction
This instructable is an extension to Remote controlled Robotic Arm using pfodApp that lets you interactively program a complex path for your robotic arm and then have the arm cycle through the defined path.
Just install the latest pfodParser library and the latest pfodApp and the new sketch. The 10 programmable positions in the sketch can be easily increased to 26, see below.
This project uses the new isRefresh() method and requires the pfodParser library V2.10+ and pfodApp version 1.2.84+. If you have already made the previous project Remote controlled Robotic Arm using pfodApp™ you will need to update the pfodParser library and your pfodApp to these versions.
Step 1: Background
This project has personal connection for me. It is an implementation of the method my father, Dr P.W. Ford, first proposed in the mid 1970's. At the time he was working for Itec Inc. and responding to a request from the Cincinnati Milling Machine Company to automate a work station in their machinery production line with a multi-purpose robotic arm for drilling, machining etc. The problem was how to program the complex path the arm had to follow to machine the part without hitting anything.
My father's solution was to set the arm's joint controls so that the arm was just self supporting and then have a human operator manually move the head in the required path, i.e. hold the head in his hand and move it as required, while the computer recorded the joint movements. The computer could then play back the moments to make the arm follow the required complex path. Ultimately the physical movement of the arm head by the operator was replaced with driving the arm manually from a controller over the required path.
This approach has become the universal method for programming the paths of robotic arms in manufacturing.
Step 2: Interactively Programming the Arm's Path
The complete sketch for this program is here RoboticPathFollower.ino which connects via the bluetooth shield to the pfodApp. See pfodAppForAndroidGettingStarted.pdf for how to create new connection in pfodApp.
When pfodApp connects it will display the main menu (above)
From here you can manually move the arm using the sliders and store that position using “Store Point”. The green positions have something stored in them. The black positions are empty. The text at the bottom of the screen shows the current position.
If you press “Store Point” while on the last green position, the sketch stores the current arm's position and then moves on to then next position. In this sketch there are 10 positions defined.
You can edit the line
const size_t MAX_STEPS = 10; // can increase this to max 26 steps. Uses cmds 'a' to 'z'
near the top of the sketch to increase the number of positions to 26.
At any time you can press RUN to start the arm moving through the stored positions. Pressing any button will stop the arm at its current position.
You can also click any stored position button to have the arm move to that position following your stored path.
Once there you can manually move the arm using the sliders and then store the updated position using the “Store Point” button.
That's it for running the arm. You can create complex paths and have the arm continually run from the first to the last position and back again.
Step 3: Extensions and Conclusions
As presented here the programmed path is lost when the power is removed. So one possible extension to this project would be to store the path in EEPROM so that it is maintained through power cycling.
Also, in this sketch, the menu shows the current position in the prompt text at the bottom of the screen. E.g. Position 3 of 10. Another extension would be to change to background colour of the current position from green, <bg g> to some other colour, e.g. Yellow <gb y> , as the arm moves through that position.
Use of isRefresh()
This is the first project to use the new isRefresh() feature of pfod.
From the first release, pfod had a menu refresh facility built in. When a pfodDevice, like this robotic arm, sends a menu to the pfodApp it can include a re-request interval. The pfodApp will then re-request the menu at this interval to get the latest updates. In versions of pfodApp prior to V1.2.84, there was no way for the pfodDevice to know if the request for the menu was the first request or a re-request. So the pfodDevice had to send back the entire menu every time.
For long menus and slow baud rates this can take a noticeable amount of time. For example in this project the main menu has about 540 bytes which takes more than half a second to send at 9600baud. Because Arduino uses blocking serial connections, this means the main loop() seems to stop work every second or so while the menu refresh is being sent.
This is noticeable when, the arm is running, as a pause in the arm's motion each second. The isRefresh() feature overcomes this problem. If the pfodDevice sends the re-request interval as a negative number, then the pfodApp uses the new refresh message, {:<cmd>} , to re-request the menu and pfodParser sets the isRefresh() flag before passing on the command to request the menu be resent. The pfodDevice's code can now check this flag by calling isRefresh() and if it is set, send back just the menu updates rather than the full menu. The menu updates are much shorter, about 100 bytes, and do not result in any noticeable pause of arm's movement.
This isRefresh() feature is an optimization and as such should not be used unless the normal refresh is causing noticeable problems.
Conclusion
The project provides a simple way to program complex paths for your robotic arm. The MeArm was used as the example but the same approach can be applied to other robotic arms.