ROS LinuxCNC Link

More
24 Mar 2021 10:12 #203500 by thefabricator03
Hi All,

I am trying to get my head around what a ROS ( Robot Operating System) and LinuxCNC link would look like.

I know Machinekit has a HAL interface that works with ROS, github.com/machinekoder/hal_ros_control , but due to MachineKit not being well maintained I want to do something similar with LinuxCNC.

Reading this article, medium.com/@slaterobotics/how-to-impleme...m-robot-748b52751f2e , it goes into detail how to set up ROS control to work with a lower level control software.

Now my question, how would LinuxCNC go about taking incoming ros_control commands, carry out the required action and then reporting commands back to ros_control?

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

More
24 Mar 2021 16:26 #203518 by Grotius
Replied by Grotius on topic ROS LinuxCNC Link
Hi,

The github code show's how to do the hal io. This code looks familiar to me.

The second article is more c++ code. This can be used to send command to the hal layer.

Now my question, how would LinuxCNC go about taking incoming ros_control commands, carry out the required action and then reporting commands back to ros_control?

If the ros controller does the motion, the only thing the hal layer has to do is follow the pid commands.
I think you have too chuck up linuxcnc into linuxcnc and hal. Then you use only the hal side of linuxcnc.
The following user(s) said Thank You: thefabricator03, DPFlex

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

More
24 Mar 2021 21:35 #203544 by tommylight
Replied by tommylight on topic ROS LinuxCNC Link
Just bumped into this:

Not sure how useful it is.
The following user(s) said Thank You: thefabricator03

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

More
24 Mar 2021 22:49 #203555 by thefabricator03
Replied by thefabricator03 on topic ROS LinuxCNC Link
Silly question but when you say only use the HAL of LinuxCNC, does that mean I dont use a INI file? Where would I setup my joint limits and such?

Also I would like to make a GUI that is robot specific, How does a GUI interface with the LinuxCNC code?

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

More
25 Mar 2021 04:32 #203575 by thefabricator03
Replied by thefabricator03 on topic ROS LinuxCNC Link
I have spent a bit of time reading the docs and from what I can tell LinuxCNC is controlled via NML messages, is that correct?

So if I were to create a new GUI I would use the Python NML API to talk to the LinuxCNC components?

linuxcnc.org/docs/html/config/python-interface.html

Also can someone explain what a Hal Thread is? And if I were to have ROS talk to the HAL, how does the INI file come into the system?

The way I see it in my head at the moment is that ROS will control the trajectory of my robot, handle the kinematics and output data to LinuxCNC which will then control the motors and handle I/O, LinuxCNC will then send data back to ROS and the loop will continue.

Now I dont think ROS can handle a G-Code file ( I might be wrong), so I was thinking LinuxCNC will have to have a part in processing the G-Code and sending it back to ROS for processing, is that possible?

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

More
27 Mar 2021 01:27 - 27 Mar 2021 01:27 #203762 by andypugh
Replied by andypugh on topic ROS LinuxCNC Link

I have spent a bit of time reading the docs and from what I can tell LinuxCNC is controlled via NML messages, is that correct?

At a certain level, yes. You might well not want to be on that level.

So if I were to create a new GUI I would use the Python NML API to talk to the LinuxCNC components?

If you are writing a GUI I would expect to be a layer above NML.

If ROS sends actual joint positions I would expect to be a layer below NML.

Also can someone explain what a Hal Thread is?


A HAL thread is a list of functions (in the software sense) that are called in a fixed sequence on a fixed schedule.

You can run HAL standalone.

Assuming that you have a LinuxCNC installation on a PC, the following example will load a HAL thread, load a simple "add" component, a (userspace, non realtime) GUI monitor and should create an accurate millisecond clock.

Open a teminal:
halrun
loadrt threads name1=mS_thread period1=1000000
loadrt sum2
addf sum2.0 mS_thread
setp sum2.0.in0 1
net loopback sum2.0.out sum2.0.in1
start
loadusr halmeter pin sum2.0.out


linuxcnc.org/docs/2.8/html/man/man9/threads.9.html
linuxcnc.org/docs/2.8/html/man/man9/sum2.9.html
linuxcnc.org/docs/2.8/html/man/man1/halmeter.1.html
Last edit: 27 Mar 2021 01:27 by andypugh.
The following user(s) said Thank You: thefabricator03, DPFlex

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

More
27 Mar 2021 02:22 #203767 by thefabricator03
Replied by thefabricator03 on topic ROS LinuxCNC Link
Thanks Andy, I appreciate the reply.

In your opinion, what advantages do you see in how MachineKit has its own HAL only program and running LinuxCNC with HAL standalone?

ROS would be commanding joint positions and controlling the motion planing and LinuxCNC would be used for controlling the hardware and I would need a GUI connecting everything together.

I would like to create a Python based programming language for controlling the robots rather than G-Code. Tormach are doing this with their new robot. Would I have to write a new interpreter for this?

Sorry for all the basic questions but I am a non programmer trying to work out what is needed to make something like this work.

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

More
27 Mar 2021 11:06 #203792 by andypugh
Replied by andypugh on topic ROS LinuxCNC Link

Thanks Andy, I appreciate the reply.

In your opinion, what advantages do you see in how MachineKit has its own HAL only program and running LinuxCNC with HAL standalone?


I am not an expert on Machinekit, but I think that their change was purely packaging, making it possible to install HAL without the rest of LinuxCNC. Otherwise the function is the same.
The following user(s) said Thank You: thefabricator03

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

More
27 Mar 2021 11:33 - 27 Mar 2021 11:36 #203794 by Grotius
Replied by Grotius on topic ROS LinuxCNC Link
Hi,

I would like to create a Python based programming language for controlling the robots rather than G-Code
This is ok.

The most easy way to start is run Linucnc. Sent some python coded joint position's to the nml interface.
You can do for example, sent joint positions trough halcommand or halui. Halui is very close to nml.
Halui command's are very usefull.

Imagine linuxcnc as a pid controller.
And see what happens. I worked kind of this way to get a gremlin preview in axis that the command's works.

Step 2 would be connect the Ros output command's to nml or your custom python program.

Step 3 would be use ros & hal only. etc.

So step by step you will get it running.
Last edit: 27 Mar 2021 11:36 by Grotius.
The following user(s) said Thank You: thefabricator03

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

More
27 Mar 2021 11:35 #203795 by thefabricator03
Replied by thefabricator03 on topic ROS LinuxCNC Link
Thank you Grotius, That has answered all my questions. Now its time to get to work!

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

Time to create page: 0.199 seconds
Powered by Kunena Forum