This is the INIT ROBOT setup text, INITRBT.TXT, provided with the G15RBT.ZIP package from g15pmn.com, also norskesites.org/fic5 written by Aristo Tacoma [[[PROJECT IN DEVELOPMENT RIGHT NOW AND OFTEN UPDATED]]] UPDATE DATE: July 4 2024 [[[ALL FIELDS FROM B13 TO B20 ACCEPTS ANGLE/DISTANCE AND SPEED PARAMETERS, AND COL 2 MOVES ROBOT AT COMMAND CHARACTER 'M'; 'G' FOR GETPOS, 'B' AND 'U' FOR SWIFT ANGLE SHIFT ENABLED; RESTPOS COMMAND GOOD; THE COMPLEMENT PACKAGE g15rcam HAS FUNCTIONALITY FOR SEVERAL CAMERAS AND VARIATION OF THRESHOLD VALUES; THE 14 CORE PATTERN MATCH GEOMETRY IMAGES ARE IN PLACE AT F10000 & NOW: FULL SET OF MATCHNUMBERS ARE SHOWN.]]] =========================== Note: this initrbt.txt has a focus on g15rbt.zip, but the other development packages on the ../fic5 page are setup exactly as this one--including making the 'xarm' subfolder in each. g15rcam involves camera input and matching. In the production G15 PMN app for this [[[to come]]], all these program features work together, naturally. The G15BG package (for Ubuntu and Android) with 'batch graphics' can be used here rather directly. =========================== FCM = First-hand Computerized Mentality, our concept; see explanation at yoga6d.org/library. FCM is the real stuff (wholly other the lack of intelligence encapsulated in the algorithms loadly pronounced to be 'AI', in one or the other of the fancy permutations of that word. AI = "fAIk", that's all.). This bridges the platform for programming of which we are so proud, the G15 PMN, with: An absolutely astonishing, groundbreaking work on making real-life non-toy industrial robots of a seriously open source kind available at not very far from cost price of production, by the famous Chinese company https://www.ufactory.cc In this case, their xArm7: It costs about the price of a new car but their most obvious competitors are typically worse in price while not making up for it in terms of open source. We have here used the newest long-term support version of Ubuntu as unifying factor between G15 PMN and Xarm7. I take it that the "U" in "Ufactory" is an abbreviation for "You" as in the "I-You" book (Ich und Du) by Martin Buber. Indeed, there is a sense of "me and you" running through all their works--it is personal and good and direct and uncluttered. ========================= IMPORTANT NOTICE: ALL THESE ROBOTIC PROGRAMS ARE PRESENTLY IN DEVELOPMENT AND IN A VERY EARLY STAGE; CHECK BACK FOR UPDATES IN COMING MONTHS AND READ ON g15pmn.com FOR PLANNED EXTENSION OF THIS AND/OR PARALLEL PACKAGES FOR G15 PMN ROBOTS ======================== For the update date of the program, see inside the package itself, in the start G15 PMN cards of its source components. This text, as also the H33 docs inside this package indicates, provides, for the advanced programmer, installation instructions to get the XArm7 with gripper, after it has been taken out of the box, to work with such as a powerful Asus laptop which has been equipped with Ubuntu 22.04.4 LTS or compatible, the standard desktop version from www.ubuntu.com. If there are questions that arise on your particular installation, there are some more setup instructions here and there in the associated packages and these may provide useful extra hints. Honestly written warnings: =================================== Keep kids out of the area with heavy and potentially falling robotic arms or robot structures unless the robotic structures have been tested for years to be safe. Keep everyone who is not aware of the precautions one must take out of the area of the robot. Keep all cables going between a robot and other parts of a room as much as possible out of people's way and let them be very clearly visible and also something pointed out to be an area of caution eg for those who assist with cleanliness etc. =================================== =================================== HEAT CONSIDERATION The Asus laptops are at present considered by many the best laptops, but even the most expensive of them have potential heat issues. Install and always run eg PSensor for a running check of temperature which must never exceed about 97 degrees celcius for any part of it; add as many laptop fans and table-fans as required. Even ten seconds on three-digit celcius temperature amounts to boiling the fine silicone structure and is enough to make the laptop practically worthless. =================================== =================================== ROBOT SAFETY Before switching on the robot, check that everything that ought to be screwed tight, and which contributes to ensure safety, balance and stability for robotic operation, is indeed screwed tight. If there is any element of pattern matching involved, both physical light and software parameters for cameras and such should be tuned and carefully checked. No robot should be left to its own devices for more than minutes a time, unless months of experience with just this robot in just this context proves that one can leave it to itself for longer durations. A robot which for any reason whatsoever--such as a glitch in electricity which leads to a comm err state--gets into a jerking self-colliding movement may trash itself and this is independent on its initial cost. During operation, check for heat and switch off before over-heat. =================================== =================================== ROBOT ENTRAINING AND SAFETY Always have a finger ready to press the Red Button that every robot must have before entrainment of motors does damage to anyone or anything. The more powers given to a robot, and the more movement capabilities, the more important. =================================== =================================== TURNING ON A ROBOT: Follow the steps of checking all cables--all should be plugged in, and that includes camera--then powering up computer first and [usually only after this] the controller box, then, after a pause and before the software for the robot starts sending control, of course also the physical power for the robotic motors and such. [Starting PC before controller box is usually a good idea to let the PC first connect to Internet, then, as box is turned on, also to the controller box, so one does not exclude the other. Plugging in cameras before the PC is turned on gives them priority in numbering before any inbuilt camera. The numbers of the cameas may be eg, the first is 'cam1', the second you plug in is 'cam7'; this is dependent on many factors and you may have to change the cam-scripts if the camera number gets too high; but that's straight-forward to do.] BEFORE THE ROBOT IS MEANT TO DO ANY TASK WHICH DEPENDS ON CAMERA INPUT, ADJUST THE LIGHT AS PERFECTLY AS YOU CAN, AND ADJUST ANY SOFTWARE PARAMETERS INVOLVING CAMERAS ALSO ACCORDING TO THE PARTICULAR ROBOT PROGRAM. Keep finger ready to press the Red Button, or buttons, to switch off all physical power to the robot in case of non-predicted jerking motions. Check always regularly for overheating and don't park the robot in a strained position. =================================== =================================== TURNING OFF A ROBOT When the robot has been turned off by a click of the Red Button and it is not in a natural rest position, it should--given that it is in order--be turned on again and rest position should be returned to. Click on the red button, or buttons, to switch off the physical power to the robot. Wait a little, and click on the little soft power switch on the controller box or boxes. After a pause, turn off the physical power to the controller box or boxes by its larger switches. =================================== GETTING YOUR UBUNTU UP TO SPEED ******************************* Pls read this paragraph carefully no matter what Linux you are using, because, among other things, the scripts included in this package, only works given some correctly set aliases and such Start with: Update to newest packages throughout. Always a good idea to install the newest VirtualBox from Oracle, as it puts your Ubuntu to a lot of good pressure in terms of its packages. Make your Linux comm-friendly: Suppose your username is 'princess'. Press eg CTR-ALT-T and in a terminal check whether 'dialout' is there-- this is giving a wide range of core communication privileges to a user: groups princess If the word 'dialout' doesn't appear, write sudo gpasswd --add princess dialout And you can check again and it should be there. To enable it, however, you must reboot. Alias-work: Now it is a principle which some people but not all is aware of, which is this, when you make a name for something, it is rarely a good idea that the name is a joke because once the name is old the joke isn't funny anymore. We prefer to call python scripts for .th scripts to make them less annoying in their naming and this is how to prep the .th scripts. Ubuntu comes with Python3 installed. The best approach is to enable the word 'python' without the '3' as requirement. If this is not done already do this: Open a terminal and run: sudo apt install python-is-python3 [[[An alternative approach involves something like alias python=python3 but consult eg askubuntu.com in case there are questions here. Any use of alias has to be repeated over and over again or added to a startup file by a cluttered command that can easily lead to contradictions and confusions later, eg along the lines of echo "alias python=python3" >> ~/.bashrc. Because of the real and actual experience that this is cluttered, and because this writer believes in power-to-the-programmer and let go of false 'policies', we do something else here when it comes to socalled 'alias'.]]] Power your Linux with a useful abbreviatations in /usr/bin: [[[For each of the following commands do a command like 'whereis th' to check that nothing is already called, in this case, 'th'. The sought-for response is this: th: In case it is already defined, you must either uninstall that or have some rewriting to do of each occurrence of names in scripts and commandline-calls from G15 PMN.]]] Become an administrator for a moment: sudo -i Go to the power source folder: cd /usr/bin Get going with some abbreviations, without which this whole package won't start: ln -s python th ln -s printf p ln -s echo h ln -s cat t At least these. Type exit to return to normal user mode. Note that we are NOT configuring the Linux with a ton of overhead, neither usual nor unusual. But we DO want a very effortless, uncluttered working environment for the total robotic operating system. [[[Note: if you use a Linux in which /usr/bin is not the holder of these worthy commands, the quick workaround, at least for one-parameter inputs, is to make a text file like "printf $1" called, in this case, 'p', and do a chmod 755 p there in /usr/bin. In general, 'snap' packages start in a cluttered way so for instance gimp installed by the snap pathway cannot be so elegantly addressed as 'ln' provides above.]]] The .th scripts in this G15 PMN robotics package use #!/usr/bin/th in the beginning so that after chmod 755 *.th they can be performed by ./script.th as a command. They have been found to work well with P. version 3.10.12. Be sure you also have editors gedit and micro installed. In addition, I would recommend you install a script to stop battery charging for the laptop above around 60% and occasionally unplug it for half an hour if it is in practise used mostly as a desktop computer and a robotic controller PC. Every Ubuntu with respect for itself ought to have the full power of the 'convert' command available at the Terminal, not just a cropped version of it. 'Convert', in its full version, refers to ImageMagick. Consult the net for how to install the full version. This is an example that may work: In a terminal, get some packages it uses: sudo apt install libpng-dev libjpeg-dev libtiff-dev And then just sudo apt install imagemagick The full 'convert' is assumed to be available through the cam*.sh scripts. This one is also used by the scripts to read the cams for the robots: sudo apt install streamer and this one is good to have as well sudo apt install fswebcam Note that which camera image snatch program that works best may require, some year, some experimentation. Some are superfast and others surprisingly slow. In case of any issue, the scripts which have the word 'cam' in them, and which completes with .sh, in this package, can be edited. The approach taken by the G15 PMN pattern matching is to get as much as necessary AND as little as possible as bits from the robotic cameras into the G15 PMN. This approach makes fast programs of a first-hand type possible but on the condition on making the pattern matching exceedingly context-dependent -- and that includes dependency on exact conditions of light. However it works coherently. ****> ALSO BE SURE YOU HAVE SDL2 Try something like, in a terminal, sdl2-config --version and you should get a message like 2.0.20 or the like. If SDL2 appears not to be installed, a way that gives you not just the normal SDL2 functions but also the development libraries, and which tends to automatically get the newest version as well, is this sort of command [but check with askubuntu if it doesn't work]: sudo apt-get install libsdl2-dev SDL2 is necessary for G15 PMN to start. INSTALL G15 PMN PROPERLY IN YOUR UBUNTU ======================================= You have now g15rbt.zip. This is ideal to be unzipped 'on top of' a normal G15 PMN installation. In the case of Ubuntu: Get two files from g15pmn.com -- you find links from norskesites.org/fic3 to these, namely neong15ways.zip and g15rwx.zip The neong15ways.zip contains a lot that isn't necessary, but it has the core .g15 files, the core .dat and some .bmp files, and the g15rwx.zip has the startup suitable for a normal desktop Ubuntu (the other startup files are for different sort of Linuxes and there are still). Let us assume you have all the 3 .zip files in ~/Downloads. Open a terminal eg by a click of CTR-ALT-T and unzip those files in this sequence, and in this way. This will make a folder called g15rbt but you can call it anything you like and it contains all: 1. cd ~ 2. cp ~/*ads/neong15ways.zip . unzip neong15ways.zip This will create the folder 'neong15ways'. (If you already have it, temporarily rename it when you do this.) 3. mv neong15ways g15rbt Now you are going to transform this standard core package into the robot package: 4. cd g15rbt cp ~/*ads/g15rwx.zip unzip g15rwx.zip Zip-files may come along with the proper setting, ie, '755' is a code in Linux to tell Linux that a file is runnable. But just in case, let's ensure ./g15rwx is set as 'program': chmod 755 g15rwx 5. cp ~/*ads/g15rbt.zip . unzip g15rbt.zip Confirm overwrite 'A' for All for the .g15 files. Only the relevant .g15 files are overwritten--all the core G15 PMN programs are untouched. Let's also affirm that the scripts are programs, namely the .th and .sh chmod 755 *.sh chmod 755 *.th The .th scripts are snappy and quick to fix--these are just interaction points between the electronics of robot controller and the main G15 PMN program--and those included clears, then writes to, prt1.txt to show state of robot after completion of this action. The G15 PMN program, at production time, is set up to do other things such as pattern matching while a robot performs change from one position to another a part of it. With possibly more than one controller boxes, and at least more than one units of a larger robot eg with one much more powerful robotarm and one auxillary robot arm, and wheels, it is of more obvious great value to have parallel servo activations and here prt2.txt, prt3.txt can be used. In the last unzip of the series above, the unzip of THIS package, g15rbt.zip, over a rather standard G15 PMN folder, it is as said correct to confirm overwrite A)ll by a click on letter A. Now this means that the .g15 files--which appear as disks inside G15 PMN--with programs for the robot are replaced. This is done this way here instead of as an app since it is for developers; but in the future there is also an app doing the similar job, as well as a production version of the app which is much quicker to start up, of course. 6. Soon we'll start it up. Just a note: There is further documentation inside the H33 page listed at the H:1 menu, meant to be read within the B9edit editor, inside G15 PMN, about installation. However there is one more thing the Ubuntu has got to have to start the ./g15rwx which starts G15 PMN and with expanded RAM use and command line availability for just this sort of use, and that is the graphical standard library SDL2. Just want to mention it in case you skipped the paragrapher higher up in this install text. The SDL2 tends to be available automatically at least after normal extra Ubuntu packages are installed, so wait trying the cd ~/g15rbt ./g15rwx command until you have done the points in the paragraph further up here entitled Getting Your Ubuntu up to Speed. And also wait until you have adjusted the motorsip.txt in the next paragraph. But after all this, you try it. Do you get G15 PMN up? Congratulations. Now let's tune all the rest and roll up sleeves and that sort of stuff to get on with real robotic work. IMPORTANT, Adjust this file: motorsip.txt ========================================= Open the text file motorssip.txt as included with this package in gedit or micro editor, in the folder you prepared in the paragraph above. This is perhaps g15rbt so open a terminal by CTR-ALT-T and type cd ~/g15rbt On the controller box, there is a number like 192.168.1.223 written. Typically, the '223' will be different from box to box, can be anything up to 8 bits. This is the IP. The little text file motorsip.txt, ie, the IP of the motors, should have just one line, this line, with the number of the controller box. So open an editor like micro or gedit with this file motorsip.txt and adjust it to the right number, and save it back. It doesn't need any lineshift after it. The three dots between these 8-bit whole numbers should be included. When you configure G15 for more controller IPs, they will be called mtsip2.txt, mtsip3.txt and up. The motorsip.txt is being read by the motor .th scripts included, which again are called on by G15 PMN. But first, we have some more work to do with Ubuntu settings. REBOOT ALL AND SWITCH PC THEN ROBOT =================================== Put the xArm7 with its gripper and camera together carefully and slowly according to instructions. Plug it in only when everything, both controller box and robot power and PC are turned off. Tip of the day: Avoid hotplugging stuff that costs the price of a car. It's like running the engine when it doesn't have oil in it. Turn on computer and, with suitable care, also the controller box. The Ethernet cable should fit in your PC. Ignore initial messages by the Linux that it couldn't connect. We'll fix that, NOW. UBUNTU DESKTOP NETWORK SETTINGS FOR ROBOT ========================================= Search up, under 'Advanced settings', NETWORK CONNECTIONS, and select the Ethernet connection. Let all settings be as they are by default values except those that are listed under the tab header of IPV4. These you edit with great attention and self-confidence: 1. Set to 'manual' and switch off everything that says 'Automatic' in the IPV4 frame. 2. Locate the poetic phrase "Address Netmask Gateway" and carefully type in, under each of these three headings, 192.168.1.12 255.255.255.0 192.168.1.1 3. Locate the term DNS and there type in: 192.168.1.1 4. Check again your motorsip.txt which has the IP you found on the controller box. In the case it says 192.168.1.12 you need to put in another number under the word "Address", eg 191.168.1.14. This ensures tha the network identity number via software given to the PC is another one than the factory-supplied network identity number given to the controller box. 5. Click Apply and OK and such to assert your belief in these settings. 6. Turn off PC and robot, take a coffee break. 7. Boot up and give it a first check, whether there is any connection at all between the PC and the robot controller box. Using the IP you have in motorsip.txt, open a terminal and write the classical test ping 192.168.1.223 And click CTR-C after some seconds to break off the ping. If you see this sort of stuff at the completing line there is success 64 bytes from 192.168.1.223: icmp_seq=4 ttl=64 time=0.138 ms 64 bytes from 192.168.1.223: icmp_seq=5 ttl=64 time=0.192 ms ^C --- 192.168.1.223 ping statistics --- 5 packets transmitted, 5 received, 0% packet loss, time 4080ms The clue here is '0% packet loss'. A test via Ufactory's own studio--which is a free package, elementary but exceedingly useful in getting a feedback that all physical control is in order--AND which enables the gripper. [[[The following 7 points is, I believe, redundant relative to getting the entire package to work, but it is a useful exercise.]]] 1. Get the studio .zip and unzip into a folder. The locations of the .zip may vary so best to search it up by Google or Duckduckgo; the version I found was UfactoryStudio-client-linux-1.0.1.zip and inside is this: UfactoryStudio-client-linux-1.0.1.AppImage 2. Open a terminal CTR-ALT-T and cd into the folder containing the studio. At this point, be sure all is powered on properly. Always keep finger ready to click on red button. 3. Type there chmod 755 *AppImage 4. And start it eg by ./*AppImage 5. It asks for IP. Type in the 192.168.1.223 or whatever it is. You can control it? Congratulations. You may have to click 'Enable' an extra time. 6. Next time you start up ./*AppImage, add the magical number :18333 to your IP, ie, 192.168.1.223:18333 And in a corner a new option to select extenders should arise and you can select 'Gripper' among the Vacuum and so on and get a little extra control for this. Does it work? Congratulations. EXTRA role for the Studio, beyond checking that the stuff in the box works: if ever the servos get stuck and a deeper software init is needed (and you want to not do it by power-off-on) the Studio contains some pretty smart coding to do this init and get servos unstuck. 7. Next time you try the studio it is usually not necessary to write more than the IP, in other words, the :18333 can be dropped. Also, the :18333 is not necessary for G15 PMN calls to the gripper, which there is called Shand. READYING THE UBUNTU DIRECT CONTROL OVER xARM7 ============================================= Getting the www.ufactory.cc library to enable our script with power to steer through the controller box: Before doing this, you could search on the keywords in the rest of this paragraph to see if there are any changes. The Ufactory has kindly and expertly provided excellent open source, with suitable open source licenses--pls confer these--as befits an open source Industrial Robotic Arm, with scripts to control it directly and with full documentation. 1. Open a terminal, CTR-ALT-T, and make a folder called eg temporarygit: mkdir temporarygit cd temporarygit 2. Fetch some files into that folder. This is how [the location may be different in the future, check with searches]: git clone https://github.com/xArm-Developer/xArm-Python-SDK.git and you can usually copy such long lines directly from info-texts like these from an editor in Linux with CTR-C and paste on the terminal with CTR-SHIFT-V. The 'git clone' command is, in simple cases, almost exactly identical to fetching a zip from the net, unzipping it in present folder, and deleting the zip. 3. Supposing that the 'git clone' command got hold of the scripts, go and get them and we'll put them in good place to be used. Presently, this is the correct way to do this, given the structure of them: Still in that folder, type cd xArm* dir and you should see, among other things, the new folder 'xarm'. (If not, navigate around with cd and hopefully it is there.) This is tight and well-written, exactly what is needed to steer the electronics. Fetch it: zip -r modules.zip xarm mv modules.zip .. [[[If in the future it is named something else, the .th scripts have to be updated where they say eg from xarm.wrapper import XArmAPI. Let us hope they don't do needless renamings.]]] 4. Go into your G15 PMN robotics folder, whatever you named it. If you followed exactly the instructions above, it is called g15rbt and that's where you want the 'xarm' library to go. cd ~/g15rbt and fetch and unzip the zip, mv ../temporarygit/modules.zip . unzip modules.zip All the acknowledgements and open source licenses from Ufactory.cc for their brilliantly done work is included in the package which in full is now at temporarygit. But for the performance of G15RBT we do not need more from temporarygit but the main xarm branch and it is supposed to be directly underneath the G15RBT folder during performance of the .th scripts which are called from inside of G15 PMN in its FCM-founded and newly expanded G15 PMN Spreadsheet, or GPS as also call it. ============================================== APPENDIX: NOTES ON BEGINNING TO USE ANDROID PHONES PHONES FOR CONTROLLING ROBOTS VIA ETHERNET CABLE There are some beginnings here but there is no working solution implemented to get the full two-way connectivity between phone and controller box via an Ethernet cable. The scripts will tell that connections via sockets to the Ethernet won't take place and so the typical scripts, in unchanged form, doesn't start; though you can get as far as to ping the controller box in robot and run the graphics and interactivity of the controller programs. [A slightly similar setup, though not as stable as a cable-only approach can be, is to use a Raspberry PI cabled with the controller box; the PI being two-way receptive over Wifi with a PC in the same room doing the actual calculations behind the motions the robot is supposed to do.] In general, the approach of using an Android Phone or similar will have to be given extraordinary deep checks for stability before putting it into production. To do some initial experiments towards pinging a robot control box via an Ethernet cable connected to an Android phone, you will want a phone Usb-c to Ethernet adapter with an extra Usb-c outlet into it, into which you can plug the phone power supply. En Ethernet adapter for a phone may not work unless the power of the phone is also plugged in, and indeed has been plugged in for some seconds; also, while we must take care to avoid any 'hotplugging', it seems that the Ethernet connection option arises when Ethernet is plugged into the Ethernet-to-USB adapter after startup of the controller box. But remember that the smaller electronics devices you are dealing with, the greater care must be taken both physically as regards plugs, and electrically as regards not wrongly flashing anything. Experiment on your own responsibility. 1. Install the g15bg package as it explains, in its own folder. Follow every bit of installation instructions. Test that the g15bg --batch graphics--works well. 2. Install this, the g15rbt, and such, on another folder in termuxmonet, including the git with the python scripts -- indeed all your working Ubuntu robotics programs with G15 PMN. You can also learn to start them with G15BG at Ubuntu before using a small phone terminal and a minimal bluetooth keyboard there. 2. Copy over all the g15bg scripts and binaries except the .g15 files/disks to the robotics folder, which has the .g15 files/disks to run the robot. 4. Go into settings of the phone and, while first enabling Ethernet under something like 'More connections', then toggle it off to get into settings and click around until you get to set the following--'Static IP' (not DHCP), tap on that text, and these should pop up: IP Address: 192.168.1.12 [or whatever your ctr box says] Netmask: 255.255.255.0 DNS Adress: 192.168.1.1 Default Gateway: 192.168.1.1 [proxy none] 5. Restart gently and ping as described above should work, at least the second time you try it. When you get 0% package loss, you have got at least something here. See www.aristotacoma.com for how to prepare the 32-bit g15 pmn compiled for Raspberry so that a 64-bit linux on a phone is ready to perform it, including load the right SDL graphics. On an X11 app called on from a linux installation inside the TermuxMonet terminal many things will not work but the desktop called Enlightement has a remarkable stability, in our experience, which makes it uniquely useful here. When Ubuntu in its basic form is installed, this is started within a dbus-launch script with the command enlightement_start ============================================== GOOD LUCK!!!