intergrate computed torque control (dynamic control) for linuxcnc

More
30 Sep 2017 16:24 #99686 by thang
Hi,

i having a project about control arm robot, and i'm research dynamic control ( computed torque control PD). If any projects used to do it in linuxcnc? One thing i can do is write a C code to calculate Torque of joints. I dont know how to intergrate them into linuxcnc. It's great if there are some examples for reference because i'm still quite new in linuxcnc and embedded.

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

More
30 Sep 2017 16:39 - 30 Sep 2017 16:49 #99687 by PCW
Many linuxCNC configurations control torque mode drives

If you mean to do PID gain scheduling based on the variable joint
inertia, this should be possible by connecting the PID gain and feedforward
setting pins to appropriate values based on the joint inertias (via hal net commands)
Last edit: 30 Sep 2017 16:49 by PCW.
The following user(s) said Thank You: thang

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

More
03 Oct 2017 10:08 #99805 by thang
can u give me more detail? i still dont know how to do it?

τ = M(θ)(θ¨ − Kve˙ − Kpe) + C(θ, θ˙)θ˙ + n(θ)

from this equation: the inputs are error of velocity and position, acceleration. the output is analog signal voltage (+/-10v) for control torque .

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

More
03 Oct 2017 12:24 #99806 by andypugh
Without describing the symbols the equation means nothing to me, and probably nothing to anyone else.

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

More
03 Oct 2017 13:45 #99813 by thang
sorry about that.

τ = M(θ)(θ¨ − Kve˙ − Kpe) + C(θ, θ˙)θ˙ + n(θ)

T is torque of joint.
M:is inertial matrix.
θ: is joint variable
Kv,Kp : is constant of KD controller
C: is coriolis/Centripetal vector
n: is gravity gravity

the inputs of this equation is acceleration, error of velocity and position ( compare velocity and postion i need and the velocity and position feedback)
The output of this equation is torque(T) then convert analog voltage to control motor

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

More
03 Oct 2017 22:58 #99878 by andypugh
OK, so that isn't a standard PID or even anything like one.
Where does your inertial matrix come from? Is it constant or does it vary with robot pose?

Writing HAL components isn't very hard.
linuxcnc.org/docs/2.7/html/hal/comp.html

Coding the maths might be.

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

More
04 Oct 2017 02:11 #99887 by thang
Yes,
the inertia M(θ), it's a matrix nxn ( n is number of joint) depend on joint variable θ.
the coriolis/Centripetal vectorC(θ, θ˙), it's matrix (nx1) depend on joint and speed variable
the gravity vector n(θ), it's a matrix nx1 depend on joint variable
e and e˙ are error of position and speed.
I can take joint postion value from the "joint"of AXISGUI. now i need to find the way to get speed, acceleration, read the encoder data to get error of position and speed. Then write a hal component to calculate the torque, and finally convert it to analog output

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

More
04 Oct 2017 10:33 - 04 Oct 2017 10:36 #99911 by thang
after reading some documents of linuxcnc, i have some questions.

what language should i use to write new hal component, python or C?

From "Python interface" i can get position, speed, acceleration of joints.might can get the position and velocity feed back from "encoder" module . Because this dynamic formula is quite complex and very long but this task must be fast, not sure if python is match. after that, i need to creat a userspace to use it. Is it right?

If i use C, how can i get speed, acceleration ( with position variable it's maybe like kinematic joint)? Then i need to get the position and velocity feedback from " encoder" module too. Finally, Using halcompile to install this module and convert to analog output by an ADC converter.
Last edit: 04 Oct 2017 10:36 by thang.

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

More
04 Oct 2017 11:04 #99912 by andypugh
For real-time computation it has to be C.
A realtime HAL component typically gets all its inputs from HAL pins.
Commanded position and velocity are available from the motion module for each joint:
linuxcnc.org/docs/devel/html/man/man9/motion.9.html (velocity appears in the "debugging" pins section, we should probably move it to be permanent)
Feedback of position and velocity is available from the encoder and resolver modules, for example:
linuxcnc.org/docs/devel/html/man/man9/hostmot2.9.html#resolver
I think that in both cases if you want acceleration you will have to do your own ddt on the input value.
The following user(s) said Thank You: thang

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

More
20 Oct 2017 04:22 - 20 Oct 2017 04:24 #100569 by thang
there are 2 ways to write a new realtime component that are using C or comp. Using .comp is much easier. I want to write a module have many functions to calculate components of above equation, i wonder if with comp i can do it like C?
Last edit: 20 Oct 2017 04:24 by thang.

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

Time to create page: 0.293 seconds
Powered by Kunena Forum