Jump to content
OMRON Forums

AbsPosSf power on problems


george.kontogiorgos
 Share

Recommended Posts

Hi all!

 

I am working on a project that should take the mean value of two 26 bits absolute renishaw encoders. I get some power-on postion problems with this mean operation, scale factors and etc. I will separate it into topics:

 

1. Incorrect sum when try to get the raw serial registers into EncTable

 

I had an incorrect value of the sum when I point to serial encoder raw register. The register values are:

 

Acc84B[0].Chan[3].SerialEncDataA=3510848

Acc84B[0].Chan[3].SerialEncDataB=196609

Acc84B[1].Chan[0].SerialEncDataA=10368788

Acc84B[1].Chan[0].SerialEncDataB=196608

 

Doing the correct calculations, we have to do SerialEncDataA+(SerialEncDataB & 3)(remember that it is a 26 bit encoder) and I shoud get 20288064 on Acc84B[0].Chan[3] and 10368788 on Acc84B[1].Chan[0]. My EncTable:

 

//****************************************************************************************

// Serial encoder settings

Acc84B[0].Chan[3].SerialEncCmd = $21149A

Acc84B[1].Chan[0].SerialEncCmd = $21149A

 

//Average

EncTable[17].type = 8

EncTable[17].pEnc = Acc84B[0].Chan[3].SerialEncDataA.a

EncTable[17].pEnc1 = Acc84B[1].Chan[0].SerialEncDataA.a

EncTable[17].index1 = 0

EncTable[17].index2 = 8

EncTable[17].index3 = 0

EncTable[17].index4 = 0

EncTable[17].MaxDelta = 0

EncTable[17].ScaleFactor = 1

 

Should give me the sum 30656852. First strange thing is that my EncTable[17].PrevEnc return me -2897581 on watch window (Disconsider eventually LSB variations, my encoder has 1 nm resolution and it is very sensible). This value is negative, which makes me think that ther is an representation issue.

 

The power-on position has problems to, here is the code snippet fo power-on:

 

//****************************************************************************************

// PowerOn Position

Motor[7].PowerOnMode = 6

Motor[7].pAbsPos = EncTable[17].PrevEnc.a

Motor[7].pAbsPos2 = Sys.Pushm

Motor[7].AbsPosFormat = $00001A00

Motor[7].AbsPosSF = 1

 

And the position on position window is 64211285 (Disconsider eventually LSB variations, my encoder has 1 nm resolution and it is very sensible). I did save and $$$ to get the power-on position.

 

2. Most significant register does not read by EncTable

 

I tryed change the bits operation, set index2 as 0 and put the bit displacement on scale factor as 1/256, as follows:

 

//****************************************************************************************

// Serial encoder settings

Acc84B[0].Chan[3].SerialEncCmd = $21149A

Acc84B[1].Chan[0].SerialEncCmd = $21149A

 

//Average

EncTable[17].type = 8

EncTable[17].pEnc = Acc84B[0].Chan[3].SerialEncDataA.a

EncTable[17].pEnc1 = Acc84B[1].Chan[0].SerialEncDataA.a

EncTable[17].index1 = 0

EncTable[17].index2 = 0

EncTable[17].index3 = 0

EncTable[17].index4 = 0

EncTable[17].MaxDelta = 0

EncTable[17].ScaleFactor = 1/256

 

The power-on position settings should now point to start bit 8, as follows:

 

//****************************************************************************************

// PowerOn Position

Motor[7].PowerOnMode = 6

Motor[7].pAbsPos = EncTable[17].PrevEnc.a

Motor[7].pAbsPos2 = Sys.Pushm

Motor[7].AbsPosFormat = $00001A08

Motor[7].AbsPosSF = 1

 

Doing save and $$$ with those settings I get 13879645 (Disconsider eventually LSB variations, my encoder has 1 nm resolution and it is very sensible), which is the sum of Acc84B[0].Chan[3].SerialEncDataA with Acc84B[1].Chan[0].SerialEncDataA (the less significant ones). This makes me think that this summation is ignoring the most significant registers SerialEncDataB.

 

3. Type 2 EncTables and scale factor problem

 

Due to those problems I tried to use type 2 EncTable to automatic concatenate the both SerialEncData registers into a 32 bit register. So, my EncTable now looks like that:

 

//****************************************************************************************

// Serial encoder settings

Acc84B[0].Chan[3].SerialEncCmd = $21149A

Acc84B[1].Chan[0].SerialEncCmd = $21149A

 

EncTable[27].type = 2

EncTable[27].pEnc = Acc84B[0].Chan[3].SerialEncDataA.a

EncTable[27].pEnc1 = Acc84B[0].Chan[3].SerialEncDataB.a

EncTable[27].index1 = 0

EncTable[27].index2 = 0

EncTable[27].index3 = 0

EncTable[27].index4 = 0

EncTable[27].MaxDelta = 0

EncTable[27].ScaleFactor = 1

 

 

EncTable[37].type = 2

EncTable[37].pEnc = Acc84B[1].Chan[0].SerialEncDataA.a

EncTable[37].pEnc1 = Acc84B[1].Chan[0].SerialEncDataB.a

EncTable[37].index1 = 0

EncTable[37].index2 = 0

EncTable[37].index3 = 0

EncTable[37].index4 = 0

EncTable[37].MaxDelta = 0

EncTable[37].ScaleFactor = 1

 

//Average

EncTable[17].type = 8

EncTable[17].pEnc = EncTable[27].PrevEnc.a

EncTable[17].pEnc1 = EncTable[37].PrevEnc.a

EncTable[17].index1 = 0

EncTable[17].index2 = 0

EncTable[17].index3 = 0

EncTable[17].index4 = 0

EncTable[17].MaxDelta = 0

EncTable[17].ScaleFactor = 1

 

and my power-on position settings are:

 

//****************************************************************************************

// PowerOn Position

Motor[PIEZO_MOTOR].PowerOnMode = 6

Motor[PIEZO_MOTOR].pAbsPos = EncTable[17].PrevEnc.a

Motor[PIEZO_MOTOR].pAbsPos2 = Sys.Pushm

Motor[PIEZO_MOTOR].AbsPosFormat = $00002000

Motor[PIEZO_MOTOR].AbsPosSF = 1

 

Now I get the correct answer for summation. Since I have to take the average between those two encoders, I did, on EncTable settings:

 

EncTable[17].ScaleFactor = 1/2

 

and on Power-on settings:

 

Motor[7].AbsPosSF = 1/2

 

Indeed, I get 15328431.5. But things get weired when I try to manipulate scale factors. If I set EncTable scale factor as

 

EncTable[17].ScaleFactor = 1

 

The result return to 30656852 as power-on position. The software manual says:

 

"It is a 32-bit integer value that has not been multiplied by the saved setup element EncTable[n].ScaleFactor."

 

About EncTable[n].PrevEnc. So modifying EncTable scale factor should not affect power-on position, in theory. But it is changing. Other problem is that the AbsPosSf does not affect the power-on position, only EncTable scale factor. If I set

 

EncTable[17].ScaleFactor = 1/2

 

and

 

Motor[7].AbsPosSF = 2 or 3 or 100

 

The result after save and $$$ is always the same: 15328431.5.

 

I am using firmware 2.5.0.4, but this happens to 2.4.0.180 too. I did the same tests downgrading the firmware and the results were always the same.

 

Thank you

George

Link to comment
Share on other sites

  • Replies 3
  • Created
  • Last Reply

Top Posters In This Topic

1. Incorrect sum when try to get the raw serial registers into EncTable.

 

Acc84B[0].Chan[3].SerialEncDataA=3510848

Acc84B[0].Chan[3].SerialEncDataB=196609

Acc84B[1].Chan[0].SerialEncDataA=10368788

Acc84B[1].Chan[0].SerialEncDataB=196608

 

Doing the correct calculations, we have to do SerialEncDataA+(SerialEncDataB & 3)(remember that it is a 26 bit encoder) and I shoud get 20288064 on Acc84B[0].Chan[3] and 10368788 on Acc84B[1].Chan[0]. My EncTable:

I am a bit confused here. The first 24 bits of your position are in SerialEncDataA with the remaining 2 bits in SerialEncDataB. This means calculating your total position would be require left shifting SerialEncDataB like:

SerialEncDataA+(SerialEncDataB & $3) << 24

 

EncTable[17].type = 8

EncTable[17].pEnc = Acc84B[0].Chan[3].SerialEncDataA.a

EncTable[17].pEnc1 = Acc84B[1].Chan[0].SerialEncDataA.a

EncTable[17].index1 = 0

EncTable[17].index2 = 8

EncTable[17].index3 = 0

EncTable[17].index4 = 0

EncTable[17].MaxDelta = 0

EncTable[17].ScaleFactor = 1

 

I see a couple issues with shifting here.

Symmetry: The way index 1 and 2 work for the first source is how index 3 and 4 work for the second source. So you will need to shift both numbers the same amount.

MSB: To handle roll over correctly, the most significant bit of your position should be bit number 31.

SerialEncDataA has values in the high 24 bits of a 32 bit register when viewed by the firmware or in C (the low 24 bits when viewed in script). This means if we right shift 8 bits to clear any garbage data, we will want to left shift afterwards.

 

EncTable[17].type = 8
EncTable[17].pEnc = Acc84B[0].Chan[3].SerialEncDataA.a
EncTable[17].pEnc1 = Acc84B[1].Chan[0].SerialEncDataA.a
EncTable[17].index1 = 8
EncTable[17].index2 = 8
EncTable[17].index3 = 8
EncTable[17].index4 = 8
EncTable[17].MaxDelta = 0
EncTable[17].ScaleFactor = 1/256

Alternatively, index 1-4 can all be left at 0 as there is no garbage data to remove.

 

The power-on position has problems to, here is the code snippet fo power-on:

Motor[7].PowerOnMode = 6

Motor[7].pAbsPos = EncTable[17].PrevEnc.a

Motor[7].pAbsPos2 = Sys.Pushm

Motor[7].AbsPosFormat = $00001A00

Motor[7].AbsPosSF = 1

Try Motor[7].AbsPosFormat = $00001A08

I'm not sure going through the encoder conversion table and using power on mode is a good idea to read initial position, but nothing is going wrong with using the method for me.

 

I can take a look at the rest of the question later, hoping this is a good start for you.

Link to comment
Share on other sites

2. Most significant register does not read by EncTable

This makes me think that this summation is ignoring the most significant registers SerialEncDataB.

 

Yes, 100%. The encoder table is only reading SerialEncDataA

 

3. Type 2 EncTables and scale factor problem

 

EncTable[27].type = 2

EncTable[37].type = 2

EncTable[17].type = 8

Not a big deal, but I believe the ECT entry that is type 8 should be the highest index. When enctable 17 runs, 27 and 37 have not yet run that cycle and must use positions from last servo period.

 

About EncTable[n].PrevEnc. So modifying EncTable scale factor should not affect power-on position, in theory. But it is changing. Other problem is that the AbsPosSf does not affect the power-on position, only EncTable scale factor. If I set

 

EncTable[17].ScaleFactor = 1/2

 

and

 

Motor[7].AbsPosSF = 2 or 3 or 100

 

The result after save and $$$ is always the same: 15328431.5.

I can't replicate this result. Can you check the value of Motor[7].AbsPosSF in the terminal after save and $$$? It may be reverting back to the value in global includes files that run at boot.

Link to comment
Share on other sites

  • 3 weeks later...

Hi, Eric!

 

Thank you for replying!

 

I am a bit confused here. The first 24 bits of your position are in SerialEncDataA with the remaining 2 bits in SerialEncDataB. This means calculating your total position would be require left shifting SerialEncDataB like:

SerialEncDataA+(SerialEncDataB & $3) << 24

 

I thought right and wrote it wrong. But the result values are correct, I just forget the 24 bit shift on equation.

 

Symmetry: The way index 1 and 2 work for the first source is how index 3 and 4 work for the second source. So you will need to shift both numbers the same amount.

 

Software manual says that index 3 and 4 acts on ECT type 8 and 9 as the same way on ECT type 1, and they are not related to other register sources.

 

SerialEncDataA has values in the high 24 bits of a 32 bit register when viewed by the firmware or in C (the low 24 bits when viewed in script). This means if we right shift 8 bits to clear any garbage data, we will want to left shift afterwards.

 

I saw about garbage data on manual, but what does it really mean? Garbage is some stuff pre-allocated on registers during start up or the status bits of the encoder?

 

I'm not sure going through the encoder conversion table and using power on mode is a good idea to read initial position, but nothing is going wrong with using the method for me.

 

I decided to use PrevEnc based on PowerPMAC User's Manual (page 165 for example). It is working fine for me!

 

Yes, 100%. The encoder table is only reading SerialEncDataA

 

So I used type 2.

 

Not a big deal, but I believe the ECT entry that is type 8 should be the highest index. When enctable 17 runs, 27 and 37 have not yet run that cycle and must use positions from last servo period.

 

It solved my problem!

 

I thought that PrevEnc was the actual values of EncTables (all EncTables run their calculations in parallel or they do it in sequence?) because software manual (page 840) says:

 

EncTable[n].PrevEnc is the processed source position for the most recent servo cycle, stored by Power PMAC for use in the next servo cycle.

 

I think this test is no longer needed:

 

I can't replicate this result. Can you check the value of Motor[7].AbsPosSF in the terminal after save and $$$? It may be reverting back to the value in global includes files that run at boot.

 

Now Motor[7].AbsPosSF is working.

 

The final solution:

 

Encoder file

 

//****************************************************************************************

// Serial encoder settings

Acc84B[0].Chan[3].SerialEncCmd = $21149A

Acc84B[1].Chan[0].SerialEncCmd = $21149A

 

//****************************************************************************************

// First term of average enctable 17

EncTable[17].type = 2

EncTable[17].pEnc = Acc84B[0].Chan[3].SerialEncDataA.a

EncTable[17].pEnc1 = Acc84B[0].Chan[3].SerialEncDataB.a

EncTable[17].index1 = 0

EncTable[17].index2 = 0

EncTable[17].index3 = 0

EncTable[17].index4 = 0

EncTable[17].MaxDelta = 0

EncTable[17].ScaleFactor = 1

 

//****************************************************************************************

// First term of average enctable 17

EncTable[27].type = 2

EncTable[27].pEnc = Acc84B[1].Chan[0].SerialEncDataA.a

EncTable[27].pEnc1 = Acc84B[1].Chan[0].SerialEncDataB.a

EncTable[27].index1 = 0

EncTable[27].index2 = 0

EncTable[27].index3 = 0

EncTable[27].index4 = 0

EncTable[27].MaxDelta = 0

EncTable[27].ScaleFactor = 1

 

//****************************************************************************************

// Closed loop encoder settings

EncTable[37].type = 8

EncTable[37].pEnc = EncTable[17].PrevEnc.a

EncTable[37].pEnc1 = EncTable[27].PrevEnc.a

EncTable[37].index1 = 0

EncTable[37].index2 = 0

EncTable[37].index3 = 0

EncTable[37].index4 = 0

EncTable[37].MaxDelta = 0

EncTable[37].ScaleFactor = 1/2

 

Motor file snippet of poweron settings:

 

//****************************************************************************************

// PowerOn Position

Motor[7].PowerOnMode = 6

Motor[7].pAbsPos = EncTable[37].PrevEnc.a

Motor[7].pAbsPos2 = Sys.Pushm

Motor[7].AbsPosFormat = $00002000

Motor[7].AbsPosSf = 1/2

 

Thank you!

Link to comment
Share on other sites

Guest
This topic is now closed to further replies.
 Share


×
×
  • Create New...