Problems Running uArmForROS on Raspberry Pi 2

Hi there, I’m new to uArm and Linux and so please forgive me if these questions are rather basic, I’ll try to keep this post as consice as I can!.

I’m using uArm for an engineering project and I’m hoping to use ROS to control the robot. I’ve been following the uArmForROS tutorial and have ran into a couple of problems, regarding the installation of uArmForPython.

First I should explain what has been installed: On a 32GB SD card I have installed an image of Ubuntu 14.04 (which runs on the Raspberry Pi 2) using this tutorial.

I’ve also overclocked the RasPi using these settings:

arm_freq=1000
core_freq=500
sdram_freq=500
over_voltage=2

I’ve then installed ROS Indigo onto the RasPi using this method.

Next is where I in run into problems, when following the ROS developer tutorial and trying to connect uArm to the RasPi I get an error about uArmForPython not being found, I’ll attach a screenshot at the bottom of this post.

I’ve tried installing pyFirmata and uArmForPython several times but can’t seem to do it successfully.

Can anyone point me in the right direction? Has anyone successfully run uArmForROS from a Raspberry Pi? Perhaps someone could provide step by step instructions for installing pyFirmata and uArmForPython, or indicate which directory / repositories they should be installed to?

Any help is greatly appreciated.

Cheers,
C.


1 Like

Hi Caspa, We have fixed the email verification, Sorry for the inconvenient.

Hi, Caspa,

This is Joey from software team.

Thanks for your question and sorry for these kind of problems.

Actually there are 3 main documents/parts needed to run before uarmForRos and you have ran 2 of them and it seems you had not calibrate uarm (missed one of the main procedures).

Please check quick starter page in developer.ufactory.cc for calibration.

The three main steps are:

  1. Calibrate UArm by using UArmForArduino. (Will use calibration.ino). Because this is made for developer and will only take you up to 2 minutes. Follow the instruction in QuickStart page in our developer website.

  2. Use UarmForPyhon library, which will allow you to communicate with uarm and remember to download uarm for firmata(seems you have done that and don’t forget to do this again after you calibrate uarm by using calibration.ino)

  3. Run UarmForRos. Connect Uarm in right serial port and I am not sure whether your ttyUSB0 is the one.

But before running uarmForRos. You can control uarm through Python first.

Again, remember to calibrate uarm in case you have not done that.

If you have any other problem, just write it here or send it to me and I will answer it ASAP.

Hi,
Thanks for your reply.

I’ve managed to calibrate uArm successfully using the calibrate.ino and tutorial steps outlined on your developer page. I did this using my laptop running on Windows 10.

I’ve tried then controlling uArm via Python (On windows 10) and I believe I’ve installed everything correctly but when trying to use the test scripts I get “tab and space errors”.

Am I using uArmForPython incorrectly? - What release of Python should I be using?

When going back to the RasperryPi 2, I get the same error as above when attempting to use ROS and Python to control uARm.

  • Do you have a video tutorial on how to use / install uArmForPython correctly?

Thanks for all your help.
C

Hi Caspa,

I think the problem is you have not installed uarmForPython successfully. For this case, I have rewrite the library in our UArmForPython github and webpage you can follow:

1, Re-download the UArmForPython library from GitHub - uArm-Developer/pyuarm: uArm python library (uArm Metal only)

2, cd to this path and use python setup.py install to install library ( I just add this file in case you cannot install)

3, in python command line console, use from UArmForPython.uarm_python import Uarm as the library directory to include path.

4, if you successfully include UarmForPython library, then, you can use the follow the code below to test:

uarm = Uarm(‘COMx’) # COMx is the COM pin your Uarm connects
uarm.pumpOn()

if pump works, you can use UarmForRos then…

5, I have just tested this method in a new Win 10 system and this works fine :slight_smile:

Thanks again for your speedy reply! It means a lot.

I previously installed both pyFirmata and uArmForPython using the method you explained above, it turns out I was using python 3.5 which was not compatible. I then tried releases 3.4 and 2.7 and found 2.7 was the one that works best.

One Error I’ve noticed in uArmForPython is the inverse kinematic function, the command line states a math error. Perhaps I’m using the commands incorrectly, I’ll post the error below.

I’ve not managed to get uArmForROS working on the RasPi - I will try again tomorrow and get back to you. Thanks again for your help!

Hi, caspa,

Glad to hear you have successfully installed this library. And sorry for inconvenience usage of this library. I will keep working on this

The problem you met here is because the unit in uarm working-space is in CM (centimeter). I mentioned this in http://developer.ufactory.cc/images/dimensions.jpg (cm) check http://developer.ufactory.cc/hardware/

Apparently, uarm can not moveto the point (30,40,60)cm, Try (0, 12 ,22)… And you can use currentCoord api to see what area uarm can moveTo.

So for insKine function, this is for calculating inverse kinematics and the point (30,40,60) is not a solution for this function, its like you will not calculate arcsin(2) : sin(x) will only give solution in [-1,1]

If you meet any problem in ROS just let me know

Hi Junyi_Song,

I’ve tried re-installing everything on linux and when using >python setup.py install

I get this error: “ValueError: ZIP does not support timestamps before 1980”.

Do you have any ideas how to fix this?

Hi, Caspa

This error is caused by your linux system and you may need to google it first and I do not quite know the answer.

But for this setup.py install step, it is used for installing packages to your python directory, you can manually unzip the documents and copy them to this DIR. This should absolutely solve this problem. The path MAY BE ONE OF THEM:
/usr/local/lib/python2.7/dist-packages/
OR
/usr/lib/python2.7/dist-packages

copy the folder named pyfirmata and uarmforpython into this path. And try to invoke uarmforpython library in python again

Joey

Hi Joey,

Thanks again for all your help. I’ve managed to get ROS running with the uArm! The only part I can’t get working is rviz. I’ve been searching through various Ubuntu / ROS forums and all suggested fixes aren’t working.

the error I get in the terminal is:
:~/Desktop$ rosrun rviz rviz
Segmentation fault(core dumped)

Do you have any ideas how to fix this?

Hi, Caspa

Glad to hear you can use UarmForRos. Congrats.

For the rviz bug. The answer below may help you.

However, apparently, I am not the developer of rviz and there may be a number reasons can cause this error. I never used rviz in RB pi before. And Arm-based CPU like PI may be not capable to smoothly run Rviz.

Once you can open Rviz, uarm simulation would be fine for you to run.

Joey

Hi Joey,

I have some more troubleshooting questions about Rviz and UArmForROS if you don’t mind.

I’ve reinstalled ROS and uArmForROS on a laptop running ROS Indigo on Xubuntu 14.04. I’m having some trouble with the display and control nodes of uArmForROS.

The display node works and when I physically move the robot the robot also moves. However this is inconsistent and sometimes the uArm Robot model doesn’t open correctly in Rviz. This happens maybe 50% of the time, I’ll post the screen shot below. The arms base link appears to be magnitudes larger than the other links of the arm. See below in the next forum post.

With regards to the control node, a similar problem appears - I’ve never had the control aspect working. I’ll post the screen grab below. Do you have any suggestions on how to fix?

Thanks for all your help!

Display error screen grab:

Hi, Caspa

For your problems, first please let me know more details

1, in display mode, you mean there is 50% possibility that UArm can move correctly.(do you mean it can move totally right - the model can move when you manually move it) And the rest 50% can not - the wrong effect is some parts may get super large. But the model in uarm can always move(eve through it is wrong movement)

Or in display mode, uarm can not display correctly all the time. (No matter what kind of reasons)

2, In control mode, you should add the interactive marker module first, that you will see the arrows. Use arrows to control uarm end-effector.

Here is a simple solution

It is obvious that, there are data communications between uarm and model in rviz. The problem is the data are not transferring correctly.

So try to make display mode right first.

Before all rviz module, make sure uarm_core is running(in listening or monitoring mode). And test the readAngles node. Just make sure the uarm can report angles correctly. If you can display right angles. Then in rviz, test different link as the fixed frame.

Test different frame rate 1, 5, 10, 20, 30, 40, 50.

If the display mode is still incorrect. You could send the code you are running to me(I kow you download it from git, but you can still send yours to me)

For control mode, you should add interactive marker in rviz, then it will show 3 pairs of arrows. Set the pub right. Then you can control arrows to control uarm

If you have any question, just let me know.

Joey

Hi Joey,

So it seems that display mode will work if I try and run it without doing anything else in RVIZ. For example, start laptop > start roscore, start, connect uArm in listenmode > start display node > Rviz with display works.

But if I then close Rviz and try and run it a second time, it will not work unless I restart my system. The same happens if I try and use Control mode first.

The main problem seems that the base link is always too large, the rest of the uArm will move when I move the robot with my hands but there is a degree of error. For example if I do not tough the robot, the model in Rviz vibrates slightly, or moves back and forth very quickly.

2) Control Mode

I tried your advice of adding the interactive markers first and this did not work - furthermore I should also add that when I try and set the fixed fame as "base, there is no drop down menu showing all the links (like Display node). I have to physically type “base”.

I tested the readAngles node like you suggested and there seemed to be a +/- 1.5 - 2 degrees of error.

How would you like me to send my code and what files do you want in particular?

Thanks for your help.
Caspa

Hi Caspa,

Could you send your code under the directory /home/catkin_ws/src/uarm.

Zip the uarm folder and send to joey@ufactory.cc

I will check your code and compare to my worked code and then run in my laptop. After that, I will give you a full procedure of what I have done with your code.

The model vibrates slightly is fine for uarm because uarm uses rotary resister as the angular sensor. So this may cause analog input error.

If the appendix is too large to send (mine is around 25MB), you can put it in any Dropbox and send the link to me and I will download.

Joey
Joey@ufactory.cc

Hi Joey,

Sorry for taking so long to reply, zipping and attempting to email my code now. Its 10MB in size.

Hi Caspa,

I have tested the code you on my computer, the result is: It works fine. So I will tell you how did I test it.

Firstly, the code you send to me (the RVIZ part) is 100% same to my code.

For testing, I removed all the libraries I wrote before and put your code in the directory /catkin_ws. And then use catkin_make to install your library.

If you can control uarm through ROS (control servo angles and moveto), then ignore the steps in following step


uarm side:
1, calibrate uarm
2, then I download the firmataEEPROM into uarm
https://github.com/uArm-Developer/FirmataEEPROM

Ros side
1, install pythonForArduino


If you can control uarm through ROS, then we can get into the next section:

Please follow this step by step!

STEP 1: Run roscore firstly. (Frist terminal)
roscore

STEP 2: Run this code to connect uarm (second terminal)
rosrun uarm uarm_core.py connect /dev/ttyUSB0
Then type e to the listener mode
e

STEP 3: Open another terminal (Third terminal)
Type roslaunch to launch the display mode first – DO NOT RUN display mode and control mode in the same time
roslaunch uarm display.launch

STEP 4: Then open another (Forth) terminal, run rviz
rosrun rviz rviz


STEP 5: Then, in rviz,
Add -> RobotModel
set Fixed Frame -> base
That you can use display mode.


AFTER THIS, you can try control mode,

Firstly, stop the display mode:
STEP 6: in the third terminal, press ctrl + c to stop display.launch
ctrl + c
STEP 7: then start control mode (in the third terminal)
roslaunch uarm control.launch


Then in RVIZ, add interactive marker
STEP 8: Before this, you have already put the uarm model inside rviz in STEP 5
Add → InteractiveMarker
Update Topic → /uarm_controller/update

Once you set the update topic to uarm_ctontroller/update, you will see 3 pairs of arrows. Drag arrows to control uarm.

So test these steps and give me feedback~

Joey

Hi Joey and Caspa,

Could you let me know where to download uArmForROS for uArm Metal? Many thanks!

Hi Joey and Caspa,

Could you let me know where to download uArmForROS for uArm Metal? Many thanks!