Five Axis Psuedo Controller - Looking for feedback

Anobium

Senior Member
Latest status @ http://www.picaxeforum.co.uk/showpost.php?p=167297&postcount=8

Latest video of ... @ http://www.picaxeforum.co.uk/showpost.php?p=167325&postcount=9

Video of Manual Wired controller interfaced into the solution http://www.youtube.com/watch?v=DIaQ-o8hPXE

I am in the process of modifying a 5 Axis Toy Robot for education use. This requires a language to control the five axis.

My design goal is to provide a simple but really understandable method of using a five axis robot that can simulate real life and be used from the output of a CADCAM modeller.

I am sharing the concept and examples of the inputs and outputs to gather some feedback.

A little history. CNC controllers like the Siemens Sinumeric, FANUC, Heidenhain, Mazak generally use one international standard - ISO 6983.
This standard uses G-codes as the common method to control computer numerical control (CNC) machines, G-Codes has many implementations. Used mainly in automation, G-Codes are part of computer-aided engineering. This general sense of the term, referring to the language overall (using the mass sense of "code"), is imprecise, because it comes metonymically from the literal sense of the term, referring to one letter address among many in the language (G address, for preparatory commands) and to the specific codes (count sense) that can be formed with it (for example, G00, G01, G28).

For this implementation I have limited the implementation to the following codes:
G00 - Set rapid movement of axis(s)
G91 - Incremental movement of axis(s)
G04 - Dwell
G95 - Set feedrate of axis(s)
G29 - Check for home position (I made this one up!)
G10 - Repeat total operation a number of times
G90 - Not yet implemented
and some M codes
M30 - Repeat all code decrementing G10 value until 0
M00 - Stop program

This evening I have written the specification mainly from memory and Wiki as I was the Program Manager for an 11 axis CNC machine in the 1980s. I was also a Product Manager for some CNC software, and other stuff related to some this (a long time ago).

For your review and feedback, my current state of play.

The source code - this example checks the position of the robot and then moves the A axis.
# G29 check all axis are at home
G29ABCDE
# G00 Set all axis to rapid
G00
# G91 Incremental move axis 1024 units of travel
G91A1024
# G04 Dwell
G04T4
# G91 Incremental move axis -2048 units
G91A-2048
# G04 Dwell
G04T4
# G91 Incremental move axis back to start!
G91A1024
# G95 Set axis movement speed (actually a PWM value)
G95A500
G95B600
G95C700
G95D800
G95E900
# N4 Repeat Number of times
# G10N5
# M30 Loop to top decrementing counter G10
# M30
# M00 Stop
# M00


The post process then converts this into the code that will be passed to the Picaxe for handling via Serial In, the Picaxe responds via the Serial Out.

This is a man readable version of the Picaxe code. The first and last line simple instructs the Picaxe where the start and end of the code stream is.

Each G code is converted to the Picaxe control string, as series of 'L'oad commands and action. These are specified in pairs,as shown below:

The L command, lowers an Axis logic flag within the Picaxe controlling the axis ad the second parameter which follows the L is the specific axis, as follows:
1 = A axis
2 = B axis
3 = C axis
4 = D axis
5 = E axis (actually the jaws).

The C (G29) command, check an axis is physically positioned over a reference point (this means an axis sensor set a channel in a 74xx165).

The X (Xexecute) command is the expected return value from the 74xx165.

The R (G00) command set the axis transversal speed.

The A (G91) command moves the A axis an increment of 1024 gearbox pulse. All positive movement are specified above 32768 and all negative less than 32768.

The T (G02) command is the dwell.

See this example. Output from the post processor this evening.

V,1;
L,1;C,1;L,2;C,2;L,3;C,3;L,4;C,4;L,5;C,5;X,31;
L,1;R,9999;L,2;R,9999;L,3;R,9999;L,4;R,9999;L,5;R,9999;X,31;
L,1;A,33792;X,1;
L,4;L,5;L,1;L,2;L,3;X,31;T,4;
L,1;A,30720;X,1;
L,4;L,5;L,1;L,2;L,3;X,31;T,4;
L,1;A,33792;X,1;
L,1;A,500;X,1;
L,2;B,600;X,2;
L,3;C,700;X,4;
L,4;D,800;X,8;
L,5;E,900;X,16;
V,0;


What is the overall architecture? Via a terminal session program on the PC, I to pass each pair to the axis controlling Picaxe, this Picaxe then lowering a control flag, then the controller Picaxe passes the data, the axis controller then executes the command and when it completes the command it raises the control flag and then the controller Picaxe inspects a 74xx165 which passes the result back to the PC which in then enables the move onto the next set of instructions.

Now, before you all say this will not work because we have to use the serial in commands with sync.... I have the man unreadable code that will be actually passed to the controlling Picaxe from the PC terminal. See below, this code differs as the code contains markers to ensure receipt by the controlling Picaxe.


V,1;ABCL,1;ABCC,1;ABCL,2;ABCC,2;ABCL,3;ABCC,3;ABCL,4;ABCC,4;ABCL,5;ABCC,5;ABCX,31;ABCL,1;ABCR,9999;ABCL,2;ABCR,9999;ABCL,3;ABCR,9999;ABCL,4;ABCR,9999;ABCL,5;ABCR,9999;ABCX,31;ABCL,1;ABCA,33792;ABCX,1;ABCL,4;ABCL,5;ABCL,1;ABCL,2;ABCL,3;ABCX,31;ABCT,4;ABCL,1;ABCA,30720;ABCX,1;ABCL,4;ABCL,5;ABCL,1;ABCL,2;ABCL,3;ABCX,31;ABCT,4;ABCL,1;ABCA,33792;ABCX,1;ABCL,1;ABCA,500;ABCX,1;ABCL,2;ABCB,600;ABCX,2;ABCL,3;ABCC,700;ABCX,4;ABCL,4;ABCD,800;ABCX,8;ABCL,5;ABCE,900;ABCX,16;V,0;


This is the same instruction set except it is harder to read! I expect this instruction set is to become very large for a real program of five axis movement.

So, from this note. What have I missed in this overall approach? I have one axis moving.... the method works. Is there anyone interested in re-use/developing the concept further? Any value is this?

Anobium
 
Last edited:

Anobium

Senior Member
Sorry, I should not. My apologies, I posted my draft document by mistake. I have edited and reposted.

I am looking for feedback on the concept of using G codes which are interpreted via a post processor into a command set that can control a series of Picaxes. If the coding of the post processor does not work I will find out very quickly as the robot crashing into its surrounding objects.
 
Last edited:

slurp

Senior Member
Rather than "check for home" why not start with "home"?

That way you can avoid making something and use an existing code (G28 typically FANUC).

Best regards,
colin
 

Anobium

Senior Member
Thank you.

I have change the post processor to G28. I was not aware of this one.

:)

I have the G10 (repeat cycles) and G04 (dwell) working tonite, sample outputs and as I result I have the axis swinging backwards and forwards as many times as required.

Samples below.

# G28 check all axis are at home
G28ABCDE
# G00 Set all axis to rapid
G00A1024

# G91 Incremental move axis
G91A1024B1024C0D-512E0



# G91 Incremental move axis
G91A1024
# G04 Dwell
G04T4
G91A-2048
# G91 Incremental move axis
# G04 Dwell
G04T4
# G91 Incremental move axis
G91A1024
# G95 Axis speed
G95A500
G95B600
G95C700
G95D800
G95E900
# N4 Repeat Number of times
G10N4
# M30 Loop to top decrementing counter G10
M30
# M01 Optional Stop
# M01
# M00
M00

Output reads (this includes all the optional stops, and the repeat operations. A bug exists at the moment with the G91 command. Hence the missing set of instructions.

V,1;
L,1;C,1;L,2;C,2;L,3;C,3;L,4;C,4;L,5;C,5;X,31;
L,4;R,9999;L,5;R,9999;L,1;R,9999;L,2;R,9999;L,3;R,9999;X,31;
L,1;A,33792;X,1;
L,4;D,32256;L,5;E,32768;L,1;A,33792;L,2;B,33792;L,3;C,32768;X,31;
L,1;A,33792;X,1;
L,4;L,5;L,1;L,2;L,3;X,31;T,4;
L,1;A,30720;X,1;
L,4;L,5;L,1;L,2;L,3;X,31;T,4;
L,1;A,33792;X,1;
L,1;A,500;X,1;
L,2;B,600;X,2;
L,3;C,700;X,4;
L,4;D,800;X,8;
L,5;E,900;X,16;
#1,0;
P,0;X,31;
P,3;X,0;
L,1;C,1;L,2;C,2;L,3;C,3;L,4;C,4;L,5;C,5;X,31;
L,1;A,33792;X,1;
L,4;D,32256;L,5;E,32768;L,1;A,33792;L,2;B,33792;L,3;C,32768;X,31;
L,1;A,33792;X,1;
L,4;L,5;L,1;L,2;L,3;X,31;T,4;
L,1;A,30720;X,1;
L,4;L,5;L,1;L,2;L,3;X,31;T,4;
L,1;A,33792;X,1;
L,1;A,500;X,1;
L,2;B,600;X,2;
L,3;C,700;X,4;
L,4;D,800;X,8;
L,5;E,900;X,16;
#2,0;
P,0;X,31;
P,3;X,0;
L,1;C,1;L,2;C,2;L,3;C,3;L,4;C,4;L,5;C,5;X,31;
L,1;A,33792;X,1;
L,4;D,32256;L,5;E,32768;L,1;A,33792;L,2;B,33792;L,3;C,32768;X,31;
L,1;A,33792;X,1;
L,4;L,5;L,1;L,2;L,3;X,31;T,4;
L,1;A,30720;X,1;
L,4;L,5;L,1;L,2;L,3;X,31;T,4;
L,1;A,33792;X,1;
L,1;A,500;X,1;
L,2;B,600;X,2;
L,3;C,700;X,4;
L,4;D,800;X,8;
L,5;E,900;X,16;
#3,0;
P,0;X,31;
P,3;X,0;
L,1;C,1;L,2;C,2;L,3;C,3;L,4;C,4;L,5;C,5;X,31;
L,1;A,33792;X,1;
L,4;D,32256;L,5;E,32768;L,1;A,33792;L,2;B,33792;L,3;C,32768;X,31;
L,1;A,33792;X,1;
L,4;L,5;L,1;L,2;L,3;X,31;T,4;
L,1;A,30720;X,1;
L,4;L,5;L,1;L,2;L,3;X,31;T,4;
L,1;A,33792;X,1;
L,1;A,500;X,1;
L,2;B,600;X,2;
L,3;C,700;X,4;
L,4;D,800;X,8;
L,5;E,900;X,16;
#4,0;
P,0;X,31;
P,3;X,0;
L,1;C,1;L,2;C,2;L,3;C,3;L,4;C,4;L,5;C,5;X,31;
L,1;A,33792;X,1;
L,4;D,32256;L,5;E,32768;L,1;A,33792;L,2;B,33792;L,3;C,32768;X,31;
L,1;A,33792;X,1;
L,4;L,5;L,1;L,2;L,3;X,31;T,4;
L,1;A,30720;X,1;
L,4;L,5;L,1;L,2;L,3;X,31;T,4;
L,1;A,33792;X,1;
L,1;A,500;X,1;
L,2;B,600;X,2;
L,3;C,700;X,4;
L,4;D,800;X,8;
L,5;E,900;X,16;
P,0;X,31;
P,1;X,0;
V,0;

:)
 

Anobium

Senior Member
Can anyone help?

What is the M code to repeat a complete program?

And, what is the method to repeat a section of code?

Current I have G10N4 repeating all the code from the top to the instance of M30. I know this is incorrect but I cannot remember or find research that helps. I think I need someone with operational experience today!

:)
 

slurp

Senior Member
It's a very long time since I used the code and that was only for educational purposes.

We didn't get into repeating the program for multiple component production, I thought that the repeat of the the code for multiple parts was a seperate feature of the machine but have discovered the M47 code for repeat from first line.

There are a number of references here that might help:

http://en.wikipedia.org/wiki/G-code

This should lead you to the M codes for subroutines, I'm sure there are others for repeating rough and fine cut cycles.

Best regards,
Colin
 

Anobium

Senior Member
Latest news

I have uploaded a few videos of progress to YouTube. I will re-post links to videos with voice over in a later post.

The original video, with no voice over, is here http://www.youtube.com/watch?v=dT_CmfUc_Tk, with voice over http://www.youtube.com/watch?v=CtJfNL1futA

Progress so far:

  1. Robot Program Control (RPC)
    • GCodes defined for scope, see previous messages. I have all codes tested apart from the G90 which is the code for absolute positioning. I have 75% of the 18m2 program space left - so, I should be able to use this space.
    • Pre-Processor completed - this transforms the GCodes into the RPC codes for actioning my the Picaxes controlling each axis
  2. Communications
    • Communications toolkit - controls comms between PC and Picaxe(s). Send and receives information, GCodes and confirmation codes respectively
    • Picaxe axis - all the 18m2's are very similar for each axis, the only minor change to each program is the axis identifier (this could be completed externally).
    • MoDCom demonstrator using RPC codes interfaced to robot
    • Inter Picaxe comms - this ensures devices 'consume' the instructions for a specific axis (as defined in the RPC codes) and to ensure devices do talk across one another - all axis Picaxes are essentially listen only as the Interlock ensure all Picaxes have completed the instructions.
    • Interlock - this leverages a parallel to serial IC to ensure completeness of the instructions.

I have completed tests on the A axis as shown in the video. On the bench I have another three motor sets ready to go in. I just need 3 more Picaxes (on order!).
 
Last edited:

Anobium

Senior Member
Video of Wired Controller interfaced into solution

See http://www.youtube.com/watch?v=DIaQ-o8hPXE

This video shows the interfacing of the wired control box to the five axis robot. Currently, the video shows only one axis but the same principle will work for the remaining four axis.

The wired control box is interfaced via a Picaxe which reads the ADC value and then sends Robot Program Control (RPC) codes to the specific axis, which in this case is the A Axis.

Thanks to all who are helping.

Anobium
 
Top