Changing Operating Parameters at Runtime

12 years 7 months ago #23803399 by gregs
Hi there,<BR>I have a AX3500 sw rev v1.9d 10/23/07 hw code 0-3-3 encoder id v1.7 02/01/05 and refering to manual ax3500man19b-060107.<BR><BR>After reading the important notice on page 149 regarding the limited number of times I can write configuration parameters to flash memory I made some changes to my mcu code to write configuration parameters at runtime as described on page 155.<BR><BR>First lets make sure I understand this correctly; I can read flash configuration parameters as often as I like, but there are limited amounts of writes before the flash memory will fail, about 1000 . The write to flash occurs on the ^FF command, is this all correct?<BR><BR>Now the main problem; I have a rotary actuator and have the controller configured in flash to start up in analog position mode, then change to closed loop seperate speed mode with encoder feedback, then change to position mode with encoder feedback. This was all working fairly well when changing the operationg mode parameters in flash. When trying to change from ^01 03 (analog position) to ^80 05 (encoder speed seperate), I get some sort of encoder position mode, but different from ^80 03 (encoder position), different in that it appears that a different distance divider is used, this is well after the next 16ms iteration loop. Now the command ^80 05 receives an '+' and responds to the ^80 query normally with 05, though sometimes 0D. Is there something I am doing wrong here?<BR><BR>I have not tried this but I may be able to configure the controller in flash for closed loop seperate speed mode with encoder feedback and then change the operating mode to analog position mode or encoder position mode on the fly from there, do you think this could work?<BR><BR>I need the closed loop seperate speed mode with encoder feedback to find the limit switches. The analog position mode I can do without though it will slow down the home sequence, the position mode with encoder feedback I need for positioning accuracy.<BR><BR>Thanks for your support<BR>gregs<BR>

Please Log in or Create an account to join the conversation.

12 years 7 months ago #23843608 by cosma
You should be able to change the controller from closed to open loop and back at runtime. This is a seldom used feature, and it may be that it is buggy.

If so, configuring the controller in open loop to start and changing after, would not make a difference, but you are welcome to try.

We will take a closer look at the firmware and confirm.

Please Log in or Create an account to join the conversation.

12 years 7 months ago #23847364 by gregs
What I would like to acheive is start up from closed loop position mode with analog feedback, then change to closed loop speed mode with encoder feedback, then change to closed loop position mode with encoder feedback.

The problem seems to be in changing at runtime from closed loop position mode to closed loop speed mode or vica versa. It is attainable via the flash cofiguration i.e ^01 03, ^01 C4, ^01 C3, this acheives the desired operation, however I am trying to avoid too many writes to the flash.

Doing it at runtime does not achive the correct operating mode i.e ^01 03(read only), ^80 05, ^81 05, ^80 03, ^81 03 - that is when in mode ^80 05 it appears to act like in position mode. If I start with ^01 C4 and then try to change to ^80 03, I get a runaway speed result.

Please Log in or Create an account to join the conversation.

12 years 7 months ago #24174383 by gregs

Has anybody had a chance to look at the controller firmware to confirm if it is possible to change from closed loop position mode to closed loop speed mode and back at runtime?

Please Log in or Create an account to join the conversation.

11 years 4 months ago #29524996 by gregs
Does the Updated Controller Software, version 1.9e
fix this issue? Mainly, changing from encoder based closed loop position mode to encoder based closed loop speed mode using the RAM configuration parameters?

Please Log in or Create an account to join the conversation.

10 years 10 months ago #29525112 by Kieran
Hi there,

I\'m also working with an AX3500 (firmware 1.9g) and am trying to achieve a similar thing. The ability to change the motor control mode at runtime just isn\'t working unless we write to the flash.

My scenario is that I have a set of wheels operating like car steering that I want to control in position mode. The initial problem is that the wheel positions at startup wont always be where they\'re supposed to be (yet that will be the zero position to the AX3500), and therefore I want to use my software to move it under closed loop speed control until it is at the actual zero position before cycling power and resuming position control.

I\'ve been running it in A speed, B position mode and the serial commands being sent to alter channel B are ^81 01 (open loop speed), ^81 05 (closed loop speed with encoder), ^81 03 (position with encoder). When doing that I can change into open loop speed and back again and it works as expected, however closed loop speed control never works. It reports strange values of actual power output, that i\'ve noticed decrease with an increased desired output.

So when output command is 5, actual output is 16 (0.5 amps) and the feedback value is 0 because 16 isn\'t large enough to rotate the wheels. I would have expected 16 to rise to 25 or so to make the feedback equal 5 but it wont, despite having the PID set to 1,0,0.

When output command is 50, actual output is 10 (0.0 amps) and the feedback is still 0 because the output is even lower than it was last time and thus no movement. Increasing the output command apparently decreases the actual output, while doubling the P gain halves it.

Also, it seems the only reason position mode works properly is because it was already like that in flash. Starting out in A,B open loop speed then changing B into position encoder apparently results in open loop speed. However I should also mention that the actual power when it does that is slightly lower than it is during actual open loop speed (output 40 gives actual output 40 in open loop speed, but in this mode it drops the actual output to 32 and keeps rotating).

Can you guys please check out the firmware for us? I think its strange that more people haven\'t run into this issue...

Thanks

Please Log in or Create an account to join the conversation.

10 years 10 months ago #29525113 by cosma
to switch to position mode you need to enter ^81 07.

Position mode is a closed loop mode, so you must set the closed loop bit. Then the other bit is used to select if it is position or speed closed loop.

Please Log in or Create an account to join the conversation.

10 years 10 months ago #29525114 by Kieran
Ok, that change has been made. Not sure what difference its made but I\'ve got a new set of observations about the problem.

I\'ve isolated it from my software and can now see it happening within Roborun. If the device is setup in flash to operate as A and B separate speed open loop, changing A into closed loop using ^80 05 within the console window is working as expected (same with changing back, using ^80 01). However changing A from separate speed open loop into position mode with encoder (using ^80 07) results in some strange variation of speed mode, where the PID control is wacky. Essentially on my motor setting the command to 1 makes it oscillate heavily on the spot, while setting command to 127 does the same while managing to rotate forwards at a medium pace. This motor has a pretty light load and the PID is set to 1,0,0.

Alternatively if the device is setup in flash to operate under A and B position mode with encoder, changing A into separate speed open loop using ^80 01 functions as expected. Changing A back to position mode using ^80 07 works properly as well. However if changing A into closed loop speed with encoder it sort of functions like a slower version of position mode...

I\'m also reseting the counts register using !Q0, because I noticed it may have been influencing testing. In particular if starting out in position mode, changing to open loop speed and moving for a bit before moving back, the motor would spin at full speed until presumably the counts went back to zero.

Any thoughts? :/

Please Log in or Create an account to join the conversation.

10 years 10 months ago #29525116 by cosma
Looking at the firmware source code. There is nothing that suggest it would behave differently if the parameters are changed via flash or at runtime.

There may be a possiblity that the upper bits are set internally by the controller and then set to 0 when you force the mode change. This should have no effect but try the following:

Before writing, read the configuration byte with ^80. Mark down what you read. When you write to change the mode, repeat the left digit from the earlier read and put 1 or 5 as the next digit.

Let me know if you come up with more clues so that we can narrow our search in the firmware.

Please Log in or Create an account to join the conversation.

10 years 10 months ago #29525118 by Kieran
Hmmm... The left digit is set to 1 for channel 2 only, while channel 1 is 0. That is the case regardless of the mode stored in flash.

For whatever reason if we change the mode in flash and then straight after read ^80 ^81 they\'ll both have the left digit set to 0 but upon cycling power channel 2 goes back to having 1 as the left digit.

Maintaining the left digit as 1 for channel 2 doesn\'t appear to have any effect. Unfortunately I don\'t have any more clues at this stage but I\'m sure the scenario described in my previous post could be quickly reproduced with another board.

Please Log in or Create an account to join the conversation.

Moderators: tonysantoni
Time to create page: 0.172 seconds