apockill / uArmCreatorStudio

uArm Creator Studio is a Visual Programming Language for robot arms, with a heavy emphasis on computer vision and usability for both low experience and high experience programmers. It's written entirely in Python, and supports python scripting within the application.
82 stars 39 forks source link

Exception Robot Not Responding while connecting to port /dev/cu.usbserial-AI04I0QM #13

Closed wisechengyi closed 7 years ago

wisechengyi commented 7 years ago
(venv)[tw-mbp-yic uArmCreatorStudio (master)]$ PYTHONPATH=/opt/twitter/Cellar/opencv3/3.1.0_4/lib/python3.5/site-packages:$PYTHONPATH python3 MainGUI.py 
Environment    Loading Settings
Resources/Objects/
Video          Starting videoStream thread.
Video          Setting camera to cameraID 0
libpng warning: iCCP: known incorrect sRGB profile
libpng warning: iCCP: cHRM chunk does not match sRGB
GUI            No events selected
GUI            No events selected
GUI            No event selected. Hiding buttons.
Video          SUCCESS: Camera is connected to camera 0
GUI            Opening Devices Window
GUI            Apply clicked, applying settings...
Environment    Saving setting: robotID
Video          Tried to create mainThread, but mainThread already existed.
Robot          Setting uArm to /dev/cu.usbserial-AI04I0QM
Robot          Thread Created
Video          Setting camera to cameraID 0
Cleaned up camera.
Video          SUCCESS: Camera is connected to camera 0
Communication  ERROR: Exception Robot Not Responding while connecting to port /dev/cu.usbserial-AI04I0QM
Robot          FAILURE: uArm was unable to connect!
Environment    Saving setting: robotID

The firmware is 1.7.4. It let me select the usb port, and uarm started moving a bit, but after a few seconds the exception popped out. Not sure how I can proceed there.

apockill commented 7 years ago

Hi wisechengyi, thank you for raising an issue. I appreciate it- I don't personally have a mac (that's what you're running on, right?) so it helps me a ton to debug possibly platform specific issues.

I have some questions: 1) When you "Scan for Robots", are there multiple ports? Have you tried the others?

2) Could you try the firmware inside of the following zip? That's the last confirmed firmware to work on UCS that I've personally tested on my machine. https://github.com/uArm-Developer/UArmForArduino/archive/2.0.zip On an aside, you should know that currently there are two versions of firmware floating around as uFactory migrates soley to this new communication protocol. Sorry for the confusion!

3) Have you encountered any other issues on Mac? I'm particularly curious about computer vision- have you plugged in a camera and tracked an object using the vision system?

Cheers, Alex Thiel

wisechengyi commented 7 years ago

1) there were 2 options: usbserial and bluetooth, so no doubt it had to be usbserial.

2) will try that and let you know

3) the opencv is package is a bit tricky to install, but essentially I did:

brew install python3
brew install opencv3 --with-python3

then have to manually find where the cv2.cpython-35m-darwin.so for python3 (cv2.so for python2.7, doesn't apply here but just for reference), hence I am tweaking PYTHONPATH in order to launch the main gui: PYTHONPATH=/opt/twitter/Cellar/opencv3/3.1.0_4/lib/python3.5/site-packages:$PYTHONPATH python3 MainGUI.py

Will try the tracking part.

apockill commented 7 years ago

With regards to 3), I think you'll run into a problem when you try to track an object using vision, if you don't compile OpenCV from scratch. That's because the latest release of OpenCV has a bug in it. Instead, you need to compile the dev version straight from https://github.com/opencv/opencv, in order to guarantee that bug is gone. I'm hoping OpenCV fixes this soon.

wisechengyi commented 7 years ago

It hangs when I do Add Event -> Recognized -> Face Detected

Robot          Robot not avaliable, canceling servo change
GUI            Event Type <class 'EventsGUI.RecognizeCascadeEvent'>selected
2016-11-03 22:25:44.114 python3[67375:2032213] modalSession has been exited prematurely - check for a reentrant call to endModalSession:
Traceback (most recent call last):
  File "/Users/yic/workspace/uArmCreatorStudio/ControlPanelGUI.py", line 358, in promptUser
    self.addEvent(eventPrompt.chosenEvent, parameters=eventPrompt.chosenParameters)
  File "/Users/yic/workspace/uArmCreatorStudio/ControlPanelGUI.py", line 386, in addEvent
    eventWidget = newEvent.dressWidget(blankWidget)
  File "/Users/yic/workspace/uArmCreatorStudio/EventsGUI.py", line 418, in dressWidget
    + self.parameters["objectID"] + QtCore.QCoreApplication.translate("EventsGUI", "' Recognized")
TypeError: bad operand type for unary +: 'str'

which doesn't look like a opencv issue.

If this is not the right way to do tracking. Could you clarify how to do so or link some doc?

wisechengyi commented 7 years ago

also newbie question. https://github.com/uArm-Developer/UArmForArduino/archive/2.0.zip doesn't appear to contain firmware.hex, or should I try to compile it?

wisechengyi commented 7 years ago

ok I was able to use https://github.com/uArm-Developer/uArmCreatorStudio/tree/master/Robot_Firmware/FlashFirmware to get it connected to the studio.

from the look of it, their fork starts to divert now. Which one should I stick to?

wisechengyi commented 7 years ago

It's pretty lit! screen shot 2016-11-03 at 11 34 46 pm

Turns out the Qt exception I saw was because of a sloppy language translation job from their fork. I reset to your master and it works great now!

Thanks a lot! -Yi

apockill commented 7 years ago

Hi Yi, I'm glad the tracking is working for you! I'm a bit surprised, since I usually have to compile the latest openCV version for it to work. I suppose we'll find out when you make a Vision object and try to track it.

As for the firmware- you have to upload it to your robot through the arduino IDE. If you download the release for windows (https://github.com/apockill/uArmCreatorStudio/releases/download/v1.1-beta/uArm.Creator.Studio.zip) there is a ReadMe that explains exactly how to do that. It's pretty simple, but it goes over each step.

I'm hoping you'll be connected and running in no time.

wisechengyi commented 7 years ago

it is rolling pretty well now. thanks! lastly I was wondering if you have any camera recommendation for these purposes as posted on https://forum.ufactory.cc/t/camera-recommendation/440, feel free to reply there so other folks will benefit as well.

apockill commented 7 years ago

Glad to hear it's working, Yi! Please keep in touch and send any cool projects you might make with UCS.

I'll post on that thread- I definitely can help with choosing cameras :)

wisechengyi commented 7 years ago
Resources/Objects/TrackableObject Robot Marker/
OpenCV Error: Assertion failed (The data should normally be NULL!) in allocate, file /tmp/opencv320161102-17299-15gmmk8/opencv-3.1.0/modules/python/src2/cv2.cpp, line 163
Traceback (most recent call last):
  File "/Users/yic/workspace/uArmCreatorStudio/CalibrationsGUI.py", line 697, in objectSelected
    self.vision.addTarget(self.newRobotMrkr)
  File "/Users/yic/workspace/uArmCreatorStudio/Logic/Vision.py", line 103, in addTarget
    self.planeTracker.addView(view)
  File "/Users/yic/workspace/uArmCreatorStudio/Logic/Vision.py", line 544, in addView
    self.matcher.add([descrs])
cv2.error: /tmp/opencv320161102-17299-15gmmk8/opencv-3.1.0/modules/python/src2/cv2.cpp:163: error: (-215) The data should normally be NULL! in function allocate

@apockill is this the error you were referring to? I encountered it at step 4 of robot/camera calibration.

apockill commented 7 years ago

This happens when you compile OpenCV3.1 and not OpenCv 3.1-dev

It's currently a known issue with OpenCV, so you have to compile the dev version to get the patch.

On Sun, Nov 20, 2016, 7:51 PM Yi Cheng notifications@github.com wrote:

@apockill https://github.com/apockill ```ObjectManager Deleting Robot Marker permanently Resources/Objects/TrackableObject Robot Marker/ OpenCV Error: Assertion failed (The data should normally be NULL!) in allocate, file /tmp/opencv320161102-17299-15gmmk8/opencv-3.1.0/modules/python/src2/cv2.cpp, line 163

Traceback (most recent call last):

File "/Users/yic/workspace/uArmCreatorStudio/CalibrationsGUI.py", line 697, in objectSelected self.vision.addTarget(self.newRobotMrkr) File "/Users/yic/workspace/uArmCreatorStudio/Logic/Vision.py", line 103, in addTarget self.planeTracker.addView(view) File "/Users/yic/workspace/uArmCreatorStudio/Logic/Vision.py", line 544, in addView self.matcher.add([descrs]) cv2.error: /tmp/opencv320161102-17299-15gmmk8/opencv-3.1.0/modules/python/src2/cv2.cpp:163: error: (-215) The data should normally be NULL! in function allocate

I encountered it at step 4 of robot/camera calibration.

— You are receiving this because you were mentioned.

Reply to this email directly, view it on GitHub https://github.com/apockill/uArmCreatorStudio/issues/13#issuecomment-261830395, or mute the thread https://github.com/notifications/unsubscribe-auth/ABqOfMZLCZKpDERam0bO2NPwch55cltEks5rAQcigaJpZM4KoCVA .

wisechengyi commented 7 years ago

thanks!