Forum

Welcome Guest 

Show/Hide Header

Welcome Guest, posting in this forum requires registration.





Pages: [1]
Author Topic: Y -axis direction reversed
wandrson
Newbie
Posts: 23
Permalink
Post Y -axis direction reversed
on: July 10, 2014, 23:25
Quote

Well I have finally got some time to work on getting the machine configured properly, and have encountered an obstacle.

If I tell it to move to a point, I am getting some strange behavior on the "Y" axis.

If I pick a point on the left, it moves left. If I pick a point on the right it moves right...

However, If I pick a point toward the bottom, it moves up (toward the top) and vice versa. Clearly I wired something backward, but I am at a loss, why it only affects the Y-axis.

Any ideas?

sandy
Administrator
Posts: 1317
Permalink
sandy
Post Re: Y -axis direction reversed
on: July 11, 2014, 00:00
Quote

Ha ha this is a puzzle I often find myself in, and I really laugh to make sense of it.. It seems like it should be so logical and easy, but I always end up scratching my head.

There's two things that can go wrong in the wiring:
1) Wires of each motor in wrong sequence.
2) Switched the left and right motors.
3-8) Other combinations of the above

Normal operation looks like this:
Command left motor direction right motor direction what happens
-------------------------------------------------------------------------------------------
Move up CCW CW pen moves up
Move down CW CCW pen moves down
Move left CCW CCW pen moves left
Move right CW CW pen moves right

If you had wired the four wires of each motor in the wrong order, then the motor directions would be reversed, and you'd get something like:
Command left motor direction right motor direction what happens
--------------------------------------------------------------------------------------------
Move up CW CCW pen moves DOWN!
Move down CCW CW pen moves UP!
Move left CW CW pen moves RIGHT!
Move right CCW CCW pen moves LEFT

So every axis would be swapped.

So the other option is that you just swapped the right and left motors, and get:
Command left motor direction right motor direction what happens
--------------------------------------------------------------------------------------------
Move up CW CCW pen moves DOWN!
Move down CCW CW pen moves UP!
Move left CCW CCW pen moves left
Move right CW CW pen moves right

And that describes, I think, the behaviour you're seeing.

The weird thing is that this is dead simple when it's down in a table like that, but it stumps me every time and I've got to start drawing diagrams and things 🙂

Of course, the other possibilities in this problem domain, like any other combination of motors swapped AND wiring swapped, or one set of wiring swapped and not the other. To diagnose, I usually try to execute a series of moves (move to point) that drives just one motor back and forth, and keep an eye on the movement of the actual cord, or the sprocket itself. Rather than getting distracted by the position or the movement of the gondola which is the product to two (possibly erroneous) vectors.

sn

wandrson
Newbie
Posts: 23
Permalink
Post Re: Y -axis direction reversed
on: July 11, 2014, 01:26
Quote

Thanks Sandy,

Turns out I had two problems... The wiring was reversed and the left and right were reversed. Got that fixed, and can move the pen and raise and lower it with no problem.

However, When I start it drawing (either raster or vector) I can see a stream of commands being sent to the queue and get processed; however, the only commands that the machine responds to are the pen up and the pen down...

I am using the Adafruit v2 shield with your software for that shield.

Any ideas?

sandy
Administrator
Posts: 1317
Permalink
sandy
Post Re: Y -axis direction reversed
on: July 11, 2014, 18:50
Quote

Hello you'll have to refresh my memory about if this is an UNO or MEGA based build.

Remember that the UNO firmware for adafruit v2 is configured at build-time to do either raster or vector drawing, not both.

At any rate, you should open the debug console in the controller with ctrl+C and look to see what the messages are coming back from the machine. Usually this is an issue with not having sent the machine spec, or something like that. Also I am assuming that you are doing a "set home" to engage the motor to begin with.

sn

wandrson
Newbie
Posts: 23
Permalink
Post Re: Y -axis direction reversed
on: July 11, 2014, 19:26
Quote

I am using the code for the Adafruit on a Mega R3 with both raster and vector options enabled (I have tried enabling only one at a time with no change in behavior).

Here is a sample of the debug console output

ncoming: C17,1320,1215,2,END not recognised.
incoming: READY
incoming: READY
Dispatching command: C17,1318,1214,2,END
Last command:C17,1318,1214,2,END:1576516028
regenerating preview queue.
incoming: C17,1318,1214,2,END not recognised.
incoming: READY
incoming: READY
Dispatching command: C14,END
Last command:C14,END:4042703483
regenerating preview queue.
incoming: READY
Dispatching command: C17,1620,2149,2,END
Last command:C17,1620,2149,2,END:2568955267
regenerating preview queue.
incoming: C17,1620,2149,2,END not recognised.
incoming: READY
incoming: READY
Dispatching command: C13,END
Last command:C13,END:1121328747
regenerating preview queue.
incoming: READY
Dispatching command: C17,1681,2032,2,END
Last command:C17,1681,2032,2,END:660358762
regenerating preview queue.
incoming: C17,1681,2032,2,END not recognised.
incoming: READY
incoming: READY
Dispatching command: C17,1843,2168,2,END
Last command:C17,1843,2168,2,END:1638756839
regenerating preview queue.
incoming: C17,1843,2168,2,END not recognised.
incoming: READY
incoming: READY
Dispatching command: C17,1788,2279,2,END
Last command:C17,1788,2279,2,END:2403462923
regenerating preview queue.
incoming: C17,1788,2279,2,END not recognised.
incoming: READY
incoming: READY
Dispatching command: C17,1620,2149,2,END
Last command:C17,1620,2149,2,END:2568955267
regenerating preview queue.
incoming: C17,1620,2149,2,END not recognised.
sandy
Administrator
Posts: 1317
Permalink
sandy
Post Re: Y -axis direction reversed
on: July 11, 2014, 19:42
Quote

Ah well "C17 ... not recognised" is exactly what it says - C17 command (which is 'draw direct') isn't recognised, and that means that VECTOR_LINES is not enabled. If you've had it disabled at some point, I think it hasn't been updated since. Double check that you have

// Program features
// ================
#define PIXEL_DRAWING
#define PENLIFT
#define VECTOR_LINES

in your polargraph_server_a1.ino file.

sn

wandrson
Newbie
Posts: 23
Permalink
Post Re: Y -axis direction reversed
on: July 11, 2014, 20:31
Quote

Okay, you were right, my last attempt had commented out the #define VECTOR_LINES

So I have has a success; https://plus.google.com/u/0/106723361717771603874/posts

Now I can't get the raster plotting to respond. I have tried it with and with #define VECTOR_LINES uncommented, in addition to having the #define PIXEL_DRAWING uncommented.

The debug console is reporting that the C07 commands are not being recognized.

From, my perusal of the code, it appears that there are several different pixel drawing commands, notably C05, and C06, but I can't figure out how to send a plot that uses those commands.

sandy
Administrator
Posts: 1317
Permalink
sandy
Post Re: Y -axis direction reversed
on: July 11, 2014, 20:50
Quote

Good stuff, the pixel commands are

C05 - square wave pixel
C06 - scribble pixel

C07 isn't used any more, it was a command to take two pairs of coordinate and draw a rectangle in the native space. Almost never used except in debugging, so it had to be expelled for the hard-pressed _a1 branch of the code!

To draw using pixels, you select an area on your image, then "render pixels" will pop up a smaller window with a choice of options. http://www.instructables.com/id/Polargraph-Drawing-Machine/step21/Work-with-images/

Also read http://www.instructables.com/id/Polargraph-Drawing-Machine/step25/Pen-thickness/

happy scribbling 🙂
sn

wandrson
Newbie
Posts: 23
Permalink
Post Re: Y -axis direction reversed
on: July 11, 2014, 21:20
Quote

Thanks Sandy!

I have read the instructable, but it doesn't help. I can't find a 'Render' button.

Here is a screen capture of what I see when I click the "Render Pixels".
It opens a dialog box called "drawPixelWindow" and I select one of the upper left option and one of the upper right. But nothing happens. I suspect I should be seeing a button on this dialog, but I am not.

https://drive.google.com/file/d/0B-kiKiYKrSl9ZGhHYkl5NHlDNlU/edit?usp=sharing

sandy
Administrator
Posts: 1317
Permalink
sandy
Post Re: Y -axis direction reversed
on: July 11, 2014, 21:47
Quote

Oh no! Thanks for the pic - yes I think your button is off the right-hand-side of the little pop up somewhere. This is what it is meant to look like

Image

If you're compiling and running the controller from source, have a look in controlsActionsWindows.pde, line 229 for

this.dialogWindow = cp5.addControlWindow("drawPixelsWindow",100,100,450,150);

And those numbers control the position and size of the pop up. Changing to 0, 0, 600, 250 should give you a bit extra space to move around.

sn

wandrson
Newbie
Posts: 23
Permalink
Post Re: Y -axis direction reversed
on: July 11, 2014, 23:37
Quote

Thanks Sandy!

I had to remove all of the processing libraries and code from my computer and reinstall from the downloaded zip files, including the patches I downloaded. Somwhere along the lines, it must have corrupted the source code.

With it reinstalled, and the patch you provided for the screen size, it is now currently drawing the "Hello World" of the Polargraph community (A Mona Lisa)...

I am completely unfamiliar with Processing, though I have a fair bit of experience with Java and C++, is it possible to easily modify the controller application to use a larger font?

Anyway, thanks for the assistance!

I plan on disassembling my polargraph tomorrow and start sanding/painting the board and building a free standing feet for the board. I plan on painting the drawing area with chalkboard paint and seeing how the bot handles drawing with chalk!

sandy
Administrator
Posts: 1317
Permalink
sandy
Post Re: Y -axis direction reversed
on: July 12, 2014, 00:05
Quote

That's good news. Processing is really just a nice library for java, with a horrible IDE. It's really just java, so anything you're used to doing there you can still do, imports whathaveyou. There is a global scope, which is a bit weird, and leads to bad design (guilty as charged m'lud), and it doesn't get compiled down in exactly the way you might expect, but it's just java 1.6 (I think). Also the IDE really punishes larger projects, so it gets a bit hard work if you're used to real IDEs.

The UI stuff in the app is all courtesy of CP5 (controlp5), which is pretty nice, but also quite distinctive and idiosyncratic. I am sure it is possible to change the fonts, but as you can see it uses a kind of bitmap fonts rather than vectors, so it's not as straightforward as it could be. I suspect there's a lot of improvements have come into the library since the version I'm using in the app, but I've never found the time to port it to use the newer version, so unless you want to do that (:)) you might have to wade a bit to get anywhere.

sn

Pages: [1]
Mingle Forum by cartpauj
Version: 1.0.34 ; Page loaded in: 0.026 seconds.