Open mshaub opened 4 years ago
Great to hear of your progress.
You said you installed pySerial library. Can you verify that you have the numpy and scipy libraries also? My hypothesis is that the code uses the dot product function from numpy/scipy and uses another version of the dot function if you don't have those libraries.
On Fri, Jun 12, 2020 at 3:14 AM mshaub notifications@github.com wrote:
I've finally gotten a working board assembled, tested, and working (sending serial signals out with ball bounces!) and a projector setup.
I'm running python 2.7.10 and installed the pySerial library and hoped that was all I needed to proceed. I can get through all the training bounces for one side, but then get the following error.
Traceback (most recent call last): File "training.py", line 433, in [xCoeff1, xCoeff2, xCoeff3, xCoeff4, yCoeff1, yCoeff2, yCoeff3, yCoeff4] = train(arduino_serial, False) File "training.py", line 274, in train xCoeff1 = M1inv x File "/System/Library/Frameworks/Python.framework/Versions/2.7/Extras/lib/python/numpy/matrixlib/defmatrix.py", line 347, in rmul* return N.dot(other, self) ValueError: matrices are not aligned
I printed the matrices (x and M1inv) and they do look quite different. I would love any help with matrix math and code that's over my head. Thanks!
— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub https://github.com/xiaosquared/PingPongPlusPlus/issues/2, or unsubscribe https://github.com/notifications/unsubscribe-auth/AADCMBTW2YG6XFFSWLQRXHTRWFQONANCNFSM4N32UMAA .
-- Xiao Xiao, Ph.D. Postdoctoral Researcher Laboratoire de Phonétique et Phonologie Université Sorbonne Nouvelle - Paris 3
Research Affiliate MIT Media Lab http://xiaosquared.com
I did verify that I have those libraries Python Version: 2.7.10 Numpy version: 1.8.0rc1 Scipy version: 0.13.0b1 Any other theories about this issue? Would it help if I posted how the matrices are formatted? like I said they look quite different to me. Thank you!!
Right, I see now the original error message already refers to numpy.
FYI, in matrix multiplication, it is not necessary for two matrices to be exactly the same. As long as the # of columns in the first one is the same as the # of rows in the second one, it's ok.
You said you were able to do the bounces for one side. Have you tried running the training for just one side at a time? Instead of pressing 'b', running the training code twice, once for each side. Maybe it already generated the coefficients for the side you already did, so maybe just try running it again and specifying the other side?
On Fri, Jun 12, 2020 at 4:38 PM mshaub notifications@github.com wrote:
I did verify that I have those libraries Python Version: 2.7.10 Numpy version: 1.8.0rc1 Scipy version: 0.13.0b1 Any other theories about this issue? Would it help if I posted how the matrices are formatted? like I said they look quite different to me. Thank you!!
— You are receiving this because you commented. Reply to this email directly, view it on GitHub https://github.com/xiaosquared/PingPongPlusPlus/issues/2#issuecomment-643248589, or unsubscribe https://github.com/notifications/unsubscribe-auth/AADCMBU6BPBTRW5IXLX2SNDRWIOV3ANCNFSM4N32UMAA .
-- Xiao Xiao, Ph.D. Postdoctoral Researcher Laboratoire de Phonétique et Phonologie Université Sorbonne Nouvelle - Paris 3
Research Affiliate MIT Media Lab http://xiaosquared.com
I tried your suggestion, had to switch to a Windows computer but saw a very similar issue. I tried the training on both sides, then each side separately as you suggested. Please see the errors posted about the "misalignment" of dot products. interesting that it's slightly different between the left and right sides. I really appreciate your help trying to make this work! I have several updates/improvements to share when I'm sure I've got things working, a circuit board design and a processing sketch with the "Corner Pin" library allowing easy alignment of projected image and table.
Training Both Sides (b):
(10L, 53L)
(100L, 1L)
Traceback (most recent call last):
File "training-win10.py", line 438, in
Training Sides Separately
Training 1 Side (l):
(10L, 43L)
(100L, 1L)
Traceback (most recent call last):
File "training-win10.py", line 438, in
Right Side Only (r):
(10L, 51L)
(100L, 1L)
Traceback (most recent call last):
File "training-win10.py", line 442, in
@mshaub, are you getting an intermediate file hitdata-left.txt and hitdata-right.txt in the directory where you're running the training? If so, can you share them here? I can't promise a solution, but I think debugging this would require seeing what's getting recorded there.
hitdata-right.txt hitdata-left.txt Thanks for your reply @mbernst ! I did get some files when running the training. I did both sides separately just to be sure I got a file for each, please see the attached. I didn't follow the projected pattern when running the training this time, it didn't seem to matter if the data was "real" so I went quickly dropping the ball close to where I was sitting. Do let me know if that's a problem, I can certainly run this again the "right way." I don't know if it matters, but on both sides today I got this error:
ValueError: shapes (10,48) and (100,1) not aligned: 48 (dim 1) != 100 (dim 0)
whereas in the last run the error was:
ValueError: shapes (10,51) and (100,1) not aligned: 51 (dim 1) != 100 (dim 0)
I greatly appreciate any thoughts you have on how I can make this work. I feel like I'm so close!
Just for due diligence, can you try doing hits the "right way" if you haven't done so already.
On Mon, Jun 29, 2020 at 6:01 AM mshaub notifications@github.com wrote:
hitdata-right.txt https://github.com/xiaosquared/PingPongPlusPlus/files/4843374/hitdata-right.txt hitdata-left.txt https://github.com/xiaosquared/PingPongPlusPlus/files/4843375/hitdata-left.txt Thanks for your reply @mbernst https://github.com/mbernst ! I did get some files when running the training. I did both sides separately just to be sure I got a file for each, please see the attached. I didn't follow the projected pattern when running the training this time, it didn't seem to matter if the data was "real" so I went quickly dropping the ball close to where I was sitting. Do let me know if that's a problem, I can certainly run this again the "right way." I don't know if it matters, but on both sides today I got this error:
ValueError: shapes (10,48) and (100,1) not aligned: 48 (dim 1) != 100 (dim 0)
whereas in the last run the error was:
ValueError: shapes (10,51) and (100,1) not aligned: 51 (dim 1) != 100 (dim 0)
I greatly appreciate any thoughts you have on how I can make this work. I feel like I'm so close!
— You are receiving this because you commented. Reply to this email directly, view it on GitHub https://github.com/xiaosquared/PingPongPlusPlus/issues/2#issuecomment-650862229, or unsubscribe https://github.com/notifications/unsubscribe-auth/AADCMBQNUOFUYJ54K7I7I7DRY7YV3ANCNFSM4N32UMAA .
-- Xiao Xiao, Ph.D. Postdoctoral Researcher Laboratoire de Phonétique et Phonologie Université Sorbonne Nouvelle - Paris 3
Research Affiliate MIT Media Lab http://xiaosquared.com
hello! I've finally gotten my projector setup again and rerun the calibration program the "right way." I'm still getting the same errors but with the "real" data maybe you are more able to see the issues. on the left side the error this time was: return N.dot(other, self) ValueError: shapes (10,55) and (100,1) not aligned: 55 (dim 1) != 100 (dim 0) on the right side the error was: return N.dot(other, self) ValueError: shapes (10,53) and (100,1) not aligned: 53 (dim 1) != 100 (dim 0)
please see the attached txt files generated despite the errors (I had to do the 2 sides separately). I'm very hopeful you have some suggestions of what I might try next! Thank you so much for your help with this. hitdata-left.txt hitdata-right.txt
Here is what I think is going on, without having access to a table myself. Looking at training.py, it's clear that you're supposed to get 100 training points out of the exercise, but you're getting fewer, like in the range of 45-55 each time — that's why the shape is, for example, around (10,55) instead of (10,100). It looks like for each of the 20 training points, you do five repetitions (5*20=100). Notice that it calls parse_hit
on each of the examples to generate diffs
, but then asks if diffs is not None
and only adds to the list of 100 hits if so. So if diffs
is None
, you'd be getting fewer than 100 points in your array.
Then I notice that parse_hit
returns None if one of the sensors isn't returning a good output. You'd notice if you're seeing it print "none"
to the console when you're dropping the training points instead of the hit data "one" "two" "three" "four".
The most likely cause of all this is that one of your sensors is intermittently malfunctioning. You'd be able to tell if you look at your console the line above any time it prints "none" to the console to see what the raw sensor inputs show. I'm looking at the top of the parse_hit
function where it prints its raw sensor input before attempting to parse it: https://github.com/xiaosquared/PingPongPlusPlus/blob/117f4c166e6c5a8435f2d50405f81eaf036eae55/training.py#L98
Awesome! I hope you’re right and it’s just a loose connection or something. I’m away from my ping pong table at the moment but I’ll test and see if any of the sensors are returning “none” as soon as I can. I’ll certainly report back. Thanks for your help and detective work!
You were right, 2 of my 8 sensors aren’t reporting anything. I swapped the cables with ones that were working and have established that the piezos and wiring is fine so it’s something in the circuit. I can’t see any issue with them, but will try to figure out how to repair them and try this again!
I've finally gotten a working board assembled, tested, and working (sending serial signals out with ball bounces!) and a projector setup.
I'm running python 2.7.10 and installed the pySerial library and hoped that was all I needed to proceed. I can get through all the training bounces for one side, but then get the following error.
Traceback (most recent call last): File "training.py", line 433, in
[xCoeff1, xCoeff2, xCoeff3, xCoeff4, yCoeff1, yCoeff2, yCoeff3, yCoeff4] = train(arduino_serial, False)
File "training.py", line 274, in train
xCoeff1 = M1inv * x
File "/System/Library/Frameworks/Python.framework/Versions/2.7/Extras/lib/python/numpy/matrixlib/defmatrix.py", line 347, in rmul
return N.dot(other, self)
ValueError: matrices are not aligned
I printed the matrices (x and M1inv) and they do look quite different. I would love any help with matrix math and code that's over my head. Thanks!