- Forum
- Roboteq Motor Controllers
- Controller Configuration & Operation
- Using analog input for position feedback
Using analog input for position feedback
6 years 4 months ago #29532606
by bigBadger
Using analog input for position feedback was created by bigBadger
Hello,
In my application, a laser sensor is providing a 0-5V analog signal to ANA4. We want that input to act as the position feedback for linear motion produced by a threaded rod driven by a brushless motor in closed loop position control mode. The drive is an MBL1660.
This is a script fragment to configure the drive:
'Input: ANA4 (pin 11)
setconfig(_BLFB,0)
'Capture mode: Absolute (External voltage source)
setconfig(_AMOD,4,1)
'Input use: Feedback
setconfig(_AINA,4,2)
'Input polarity. 0 is not inverted, 1 is inverted
setconfig(_APOL,4,0)
'max/min/centre, in mV
setconfig(_AMAX,4,5000)
setconfig(_AMIN,4,0)
setconfig(_ACTR,4,2500)
'Deadband: 0 deadband (Units in %)
setconfig(_ADB,4,0)
'Exponent: Linear (0 is linear)
setconfig(_ALIN,4,0)
Will this provide the desired feedback controlled functionality? Does DIN4 have to be specifically disabled as a feedback input in EMOD for this to work?
I am purposefully neglecting to include the configuration of over/undervoltage protection, over/under current protection etc in this sample.
Thanks in advance.
In my application, a laser sensor is providing a 0-5V analog signal to ANA4. We want that input to act as the position feedback for linear motion produced by a threaded rod driven by a brushless motor in closed loop position control mode. The drive is an MBL1660.
This is a script fragment to configure the drive:
'Input: ANA4 (pin 11)
setconfig(_BLFB,0)
'Capture mode: Absolute (External voltage source)
setconfig(_AMOD,4,1)
'Input use: Feedback
setconfig(_AINA,4,2)
'Input polarity. 0 is not inverted, 1 is inverted
setconfig(_APOL,4,0)
'max/min/centre, in mV
setconfig(_AMAX,4,5000)
setconfig(_AMIN,4,0)
setconfig(_ACTR,4,2500)
'Deadband: 0 deadband (Units in %)
setconfig(_ADB,4,0)
'Exponent: Linear (0 is linear)
setconfig(_ALIN,4,0)
Will this provide the desired feedback controlled functionality? Does DIN4 have to be specifically disabled as a feedback input in EMOD for this to work?
I am purposefully neglecting to include the configuration of over/undervoltage protection, over/under current protection etc in this sample.
Thanks in advance.
Please Log in or Create an account to join the conversation.
6 years 4 months ago #29532607
by blake
Replied by blake on topic Using analog input for position feedback
Yes the script you wrote would set the controller to accept Analog input 4 as feedback. However, doing this all via script isn't necessary, you can do it much quicker by simply configuring these settings from the Configuration Tab of Roborun+. Essentially what you are trying to do is of the same principal as described in our
Closed Loop Position Tracking Video
. In that video the feedback source is a pot on a linear actuator, but essentially all of the settings would be the same.
It is not necessary to disable digital input 4 but you will need to make sure that Pulse Input 4 is disabled (it should be already by default).
It is not necessary to disable digital input 4 but you will need to make sure that Pulse Input 4 is disabled (it should be already by default).
Please Log in or Create an account to join the conversation.
6 years 4 months ago #29532610
by bigBadger
Replied by bigBadger on topic Using analog input for position feedback
Thanks Blake. I know we can configure these settings via Roborun+, but our current application has multiple roboteq drives on the same canbus network that operate different motors and feedback sensors. We are using the same script for all of them, so it has to be set up so that the parameters can be changed using canbus messages.
I watched the video you mentioned, and it was helpful. I realized I needed to include the setconfig(_MXTRN,1, ###) command as well.
I have one more question though; Why does setconfig(_AINA,4,2) not have an option to select the motor channel when Serial version of the command does?
I watched the video you mentioned, and it was helpful. I realized I needed to include the setconfig(_MXTRN,1, ###) command as well.
I have one more question though; Why does setconfig(_AINA,4,2) not have an option to select the motor channel when Serial version of the command does?
Please Log in or Create an account to join the conversation.
6 years 4 months ago #29532611
by blake
Replied by blake on topic Using analog input for position feedback
The syntax to select the motor channel will be the same for your script as it is for the serial command. Sorry this isn't clear in the manual.
setconfig(_aina, 1, 17) will be the same as ^aina 1 17, both set analog input 1 as motor command for motor channel 1.
setconfig(_aina, 1, 17) will be the same as ^aina 1 17, both set analog input 1 as motor command for motor channel 1.
Please Log in or Create an account to join the conversation.
6 years 4 months ago #29532614
by bigBadger
Replied by bigBadger on topic Using analog input for position feedback
Thanks, I'll keep that in mind when I see other commands like that.
If I want to get position feedback on the linear motion, would I use:
getvalue(_ANAIN, 4)
Or is there a better function to use to get position feedback data besides the raw sensor value?
If I want to get position feedback on the linear motion, would I use:
getvalue(_ANAIN, 4)
Or is there a better function to use to get position feedback data besides the raw sensor value?
Please Log in or Create an account to join the conversation.
6 years 4 months ago #29532615
by blake
Replied by blake on topic Using analog input for position feedback
Take a look at the ?AIC function (page 231). This will return the converted feedback value that is within our +/-1000 range. This or the raw query (?AI) are your two options
Please Log in or Create an account to join the conversation.
6 years 4 months ago #29532616
by bigBadger
Replied by bigBadger on topic Using analog input for position feedback
Ah, perfect.
Thanks a lot!
Thanks a lot!
Please Log in or Create an account to join the conversation.
Moderators: tonysantoni
- Forum
- Roboteq Motor Controllers
- Controller Configuration & Operation
- Using analog input for position feedback
Time to create page: 0.100 seconds