Modeling the response of the angular position.
10 years 11 months ago #29527493
by amag10
Modeling the response of the angular position. was created by amag10
Hello everyone, I am working with an autonomous car project, I will use a Roboteq motor controller to do the steering of the car steering wheel in relative position mode. So I need to model the response of the angular position to a known input signal.
Then I want to know how I can acquire the input and output(angular position) signals to model this dynamic system in MATLAB. I think i can write a code in MicroBasic language to acquire these two informations, maybe I can write a code that send a command to the motor gear the steering wheel from a reference position to a desired position, and in every period of time measure the two signals and send it in serial communication to a PC that will save the data, I need to send the data instantaneously to a computer with serial communication, because the memory of the controller isn\'t enough to save the size of data that I need to acquire. My final goal is to model a PID controller in MATLAB and after implement his parameters in the Roboteq controller to get a great dynamic response.
What\'s a good way to solve this problem? How can I prepare the PC serial comunication to receive the data from the controller and save this data in a file? I never used a Roboteq in my life, so I don\'t know so much. Sorry for the bad english too, I\'m a brazilian.
Thank you very much.
Then I want to know how I can acquire the input and output(angular position) signals to model this dynamic system in MATLAB. I think i can write a code in MicroBasic language to acquire these two informations, maybe I can write a code that send a command to the motor gear the steering wheel from a reference position to a desired position, and in every period of time measure the two signals and send it in serial communication to a PC that will save the data, I need to send the data instantaneously to a computer with serial communication, because the memory of the controller isn\'t enough to save the size of data that I need to acquire. My final goal is to model a PID controller in MATLAB and after implement his parameters in the Roboteq controller to get a great dynamic response.
What\'s a good way to solve this problem? How can I prepare the PC serial comunication to receive the data from the controller and save this data in a file? I never used a Roboteq in my life, so I don\'t know so much. Sorry for the bad english too, I\'m a brazilian.
Thank you very much.
Please Log in or Create an account to join the conversation.
- roboteq
10 years 11 months ago #29527495
by roboteq
Replied by roboteq on topic Re:Modeling the response of the angular position.
You can write a small script to output the data you want.
For example, the following untested script will send the value of the analog input 1 every 5 ms:
top:
AnalogInput = getvalue(_AI, 1)
print(AnalogInput,\"\\r\")
wait(5)
goto top
You can run this script and capture the data as it sent on the serial port.
You can also run the script from the Console tab of Roborun. Then click on \"Copy Log\" button, and paste in excel or a notepad file.
For example, the following untested script will send the value of the analog input 1 every 5 ms:
top:
AnalogInput = getvalue(_AI, 1)
print(AnalogInput,\"\\r\")
wait(5)
goto top
You can run this script and capture the data as it sent on the serial port.
You can also run the script from the Console tab of Roborun. Then click on \"Copy Log\" button, and paste in excel or a notepad file.
Please Log in or Create an account to join the conversation.
10 years 10 months ago #29527501
by amag10
Replied by amag10 on topic Re:Modeling the response of the angular position.
Thanks, your answer helped me, at the moment my program is like this. I will work in Position Relative Mode. And I have more doubts here described in the program comments. Are there errors in this code?
Dim input As Integer
Dim output As Integer
Dim aux As Integer
aux = 5000 \' I will get 5000 samples of data in every 1ms
setconfig(?) \' Must I set some configure here? For example
\' to the desired velocity and acceleration or
\' some kind of inicialization of the position
\' relative mode?
setcommand(_MPOSREL or _MOTPOS ??, ) \' To order the axle to
\'a reference position
wait(10000) \' Here is a time to wait the axle go to a
\' reference position.
setcommand( ) \' To order the axle to a desired position.
While aux > 0
input = GetValue(_ANAIN,1)
print(input,\"\\n\\r\")
output = GetValue(_DIGOUT,1)
print(\"s\",output,\"\\n\\r\")
aux--
wait(1) \' Acquire data in periods of 1 ms
End While
What\'s the difference between these two comands found in the manual:
Command | Short | Arguments | Description
_MOTPOS | _P Channel | Position Abs | Set Position
_MPOSREL | _PR Channel | Position Rel | Go to Relative Desired Position
??
Thanks again
Dim input As Integer
Dim output As Integer
Dim aux As Integer
aux = 5000 \' I will get 5000 samples of data in every 1ms
setconfig(?) \' Must I set some configure here? For example
\' to the desired velocity and acceleration or
\' some kind of inicialization of the position
\' relative mode?
setcommand(_MPOSREL or _MOTPOS ??, ) \' To order the axle to
\'a reference position
wait(10000) \' Here is a time to wait the axle go to a
\' reference position.
setcommand( ) \' To order the axle to a desired position.
While aux > 0
input = GetValue(_ANAIN,1)
print(input,\"\\n\\r\")
output = GetValue(_DIGOUT,1)
print(\"s\",output,\"\\n\\r\")
aux--
wait(1) \' Acquire data in periods of 1 ms
End While
What\'s the difference between these two comands found in the manual:
Command | Short | Arguments | Description
_MOTPOS | _P Channel | Position Abs | Set Position
_MPOSREL | _PR Channel | Position Rel | Go to Relative Desired Position
??
Thanks again
Please Log in or Create an account to join the conversation.
Moderators: tonysantoni
Time to create page: 0.053 seconds