net, J0Pos, stepper generator and HAL in general.

More
12 Jun 2019 03:25 #136689 by felixcnc
Hello,

I am doing a robotics investigation for my university and trying to "decode" (understand / explain) how the PUMA HAL works. So I picked up the puma_sim_6.hal and I'm trying to explain in Spanish how it works.

However there are a few things that I have googled and couldn't find any "relation" or "explanation". The first one is:
  • J0pos, J0acc, J0vel
  • : It's quite clear that this holds the position, acceleration and velocity from the first joint (Joint.0). However I couldn't find any explanation where is this coming from. So for example if I do this "/halcmd show |grep joint.0.pos" I see the position, but if I do this: "/halcmd show |grep J0pos", there's no output. Therefore,
how can I know the information available?, I mean is there any list of data I can read?
  • net
  • : I looked at net documentation and everything is clear except for sending output to the parallel port. Of course it depends on the hardware. Is there any tiny example where I can see how to send a movement for just ONE joint to a step motor in the parallel port? (Please forgive me if I said something silly, I am stilly trying to figure out the right terminology)
  • real examples
  • : I installed myself LinuxCNC from sources to a debian linux in a VM because it's just for research for now, so I don't really need to plug anything to the LinuxCNC. I am reading the code, kinematic library, and configurations. However when I try to open any examples outside the SIM folder, they don't work. Basically the behavior is like the LinuxCNC shows in the console a few dots "....." and says waiting for component until it dies. (For example "waiting for component 'inhal' to be ready"). Is it because of my custom installation? or perhaps do I need to run in a machine with a real parallel port?
    [/ul]

    I know I asked a lot of things. I'm sorry, but I've googled for a very long time (and probably wrong), but couldn't find these answers easily.

    I really appreciate your help on this.

    Kind regards.

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

    More
    12 Jun 2019 05:52 - 12 Jun 2019 05:54 #136693 by pl7i92
    hi and welcome
    J0pos, J0acc, J0vel Internal variables comming from the Trectionary planer Interpreter via MOTION from the HAL component
    pinnames of motion linuxcnc.org/docs/html/man/man9/motion.9.html
    BE aware as of 2.8 lots of changes

    NET is General and stands for wire You load a wire equal to Signal with a STATE from a pin
    then as in the real world you can direct the signal to many outs
    in one line // or better in redbelly multi lines // even output in other file loaded after HAL called postgui

    there are multiple configuration files in the configuration tread
    you simply can start a linucnc live cd secion and look at the pins
    linuxcnc.org/docs/html/man/man1/
    all components
    linuxcnc.org/docs/html/man/man9/


    Is it because of my custom installation? or perhaps do I need to run in a machine with a real parallel port?
    YOU need a Realtime Kernal to run Linuxcnc
    and ofcause a REAL parport
    dmesg | grep parpo* in a terminal will tell you the adress of the parport and if there is one

    you may have a look here
    Last edit: 12 Jun 2019 05:54 by pl7i92. Reason: more info

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

    More
    12 Jun 2019 16:13 #136751 by andypugh

    felixcnc wrote:

  • J0pos, J0acc, J0vel
  • : It's quite clear that this holds the position, acceleration and velocity from the first joint (Joint.0). However I couldn't find any explanation where is this coming from.


    The J0pos, J1pos etc are the jpint position commands, calculated by the motion module and the kinematics module.

    In this case the vel and acceleration numbers are computed in the HAL file by ddt modules (and as far as I can see are never used for anything)
    github.com/LinuxCNC/linuxcnc/blob/master.../puma/puma_sim_6.hal

    So for example if I do this "/halcmd show |grep joint.0.pos"


    No need for grep. halcmd show accepts wildcards. so "halcmd show j*0*" will work.

    If you use halcmd -kf to open a halcmd prompt than you don't need "halcmd" and you also get scroll-back and tab completion.

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

    More
    14 Jun 2019 21:15 #136912 by felixcnc
    Thank you very much. This was REALLY helpful.

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

    More
    14 Jun 2019 21:24 #136913 by felixcnc
    Oh thanks. And Now I just realized something.

    Which basically was in front of my eyes, but your comment explained a lot to me.

    net J0pos <= joint.0.motor-pos-cmd

    This is basically the "definition" of that J0pos, and afterwards:

    net J0pos => ddt.0.in
    net J0vel <= ddt.0.out
    net J0vel => ddt.1.in
    net J0acc <= ddt.1.out

    Basically ddt.0.in inputs the position and outputs the derivative of the position, which is velocity.

    So then ddt.1.in ingests the velocity and outputs the derivative of the velocity, which is acceleration.

    Is this correct?


    (Sorry that I make this very trivial questions, but it's clear that I am not an expert in robotics or physics)

    Thanks again for your help guys.

    Cheers.

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

    More
    14 Jun 2019 21:35 #136915 by andypugh

    felixcnc wrote: So then ddt.1.in ingests the velocity and outputs the derivative of the velocity, which is acceleration.
    Is this correct?


    Yes, that is all correct.

    A HAL "Net" needs a name ( called the "signal") and then can have zero to many HAL "pins" connected to it.
    Only one pin in a net can be an output (ie, one that provides a number to HAL)
    There can be as many "reader" pins as you want.

    In the "net" command the first term is the signal name (and that can be anything) and the the other items are HAL pins (which must exist at the point that the net command is read)

    HAL isn't a program as such, it is a net-list that runs once at config time. Then all the components execute once every thread period (servo-thread or base-thread), at which point they read their inputs and write to their outputs.

    Note that you can net and un-net and read and set values of pins at the halcmd prompt. If you wanted to, you could do this (with LinuxCNC not running)
    halrun
    loadrt threads
    start
    loadrt ddt
    addf ddt.0 thread1
    start
    setp ddt.0.in 100
    setp ddt.0.in 1000
    show pin ddt.0.out
    (and so on) 

    You are actually unlikely to see anything as the output of ddt, though, you can't type "show pin ddt.0.out" in less that 1mS :-)

    Here are all the other HAL components:
    linuxcnc.org/docs/2.7/html/
    (scroll down to "Realtime components and kernel modules" (you might need to expand it)

    I so this a _lot_ when debugging HAL components, it saves the complecity of interaction with the rest of LinuxCNC. Though I do spend a lot of time typing "loadusr halmeter pin ddt.0.out" (etc)

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

    More
    14 Jun 2019 21:41 #136918 by felixcnc
    Wow, this is really good stuff. Thank you very much.

    Hopefully next week I'll have a real computer (not just a VM), to install LinuxCNC from CD + try all this in real life.

    Thanks again!

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

    Time to create page: 0.090 seconds
    Powered by Kunena Forum