6 axes robotic arm - rc servos - raspberry pi 4

More
27 Sep 2021 21:00 - 27 Sep 2021 21:02 #221716 by Alex784
Hi !

I would like to make a 6 axes robotic arm with rc servos (mg995 and sg90). I would like to use LinuxCNC to be able to move the robot end-effector in the "world mode". (as in moving the end-effector in the x, y, z, directions and a, b, c, angles).

This is will be just for demonstration, since the robot won't really have a purpose, just a toy. I don't really care about precision or tolerances, I know RC servos won't be really precise.

I saw this video on youtube : 

His robot has 5 dof, but this is exactly what I want to reach, except that my robot has 6 dof. Unfortunately I don't understand german and there isn't much info about how he obtained this result.

I have read that LinuxCNC is using a realtime operating system, so I should be able to plug the signal pin of the rc servos directly on the Rpi, right ? Or will I have some jitter problems as shown in this video (at 4:35)  : 
?

How do I assign a pin on the rapberry pi to control the signal pin of a rc servo ?
I found this : wiki.linuxcnc.org/cgi-bin/wiki.pl?RC_Servo_Test but this isn't for a Rpi.

Also I learned about rcpwmgen. But it looks like it's only made for mesa boards.

I am looking for documentation about using rc servos with LinuxCNC on a Raspberry Pi but can't seem to find much. 

I hope I am not asking questions that are too simple, but I am having trouble finding information about what i'd like to do.

Thank you
Last edit: 27 Sep 2021 21:02 by Alex784. Reason: changed timestamp

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

More
01 Oct 2021 14:11 #221957 by andypugh
It will be difficult to use the RPI GPIO via bit-bashing as I don't think that the update rate would be fast enough.

The hal_pi_gpio driver is included with LinuxCNC 2.8 bit for some reason it does not appear in the documentation. Possibly because the closest thing that it has to documentation is this sample HAL file:

github.com/LinuxCNC/linuxcnc/blob/e0dc3a...hal_pi_gpio_demo.hal

However, I don't think that GPIO updating every 1ms will be usable for RCPWM which expects a new frame every 20ms.

A better solution islikely to be a serially-controlled servo (www.amazon.co.uk/LewanSoul-LX-16A-Real-T...earing/dp/B073WR3SK9 for example) which I have used in ESP32 projects.

You would still need a HAL driver to send the serial commands, but that is more manageable.

If you want an off-the-shelf solution then one of the Mesa cards might be the only answer.

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

More
02 Oct 2021 14:19 #222018 by tjtr33
Hi Andy,
sorry for noc documentation. I tried to write a man page but dont know how! Is a man page wanted? Where do i read about how to write it? Then, what files are submitted and how is 'it' submitted? ( i dont get notifications -- long story -- ask JT -- so i will try to monitor this thread )
tomp

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

More
03 Oct 2021 10:23 #222092 by andypugh

Hi Andy,
sorry for noc documentation. I tried to write a man page but dont know how! Is a man page wanted? Where do i read about how to write it? 

I would suggest writing the docs using asciidoc, as it is so much less painful than troff. 

There is only one HAL component currently documented that way, but you can basically keep that formatting and just alter the content. 
See streamer.9.txt
github.com/LinuxCNC/linuxcnc/tree/master/docs/src/man/man9

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

More
03 Oct 2021 15:15 - 04 Oct 2021 06:59 #222112 by tjtr33
Thx Andy will read now
tomp

update: the attached text file produced the attached manpage .
I used a text editor, the manpage source from streamer, then
a2x --doctype manpage --format manpage hal_pi_gpio.9.txt
then gzip hal_pi_gpio.9 to get the format i see in /usr/share/man/man9
hth
tomp
 
Attachments:
Last edit: 04 Oct 2021 06:59 by tjtr33. Reason: update

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

More
05 Oct 2021 17:03 - 05 Oct 2021 17:15 #222291 by elovalvo
I have never used the pwgen with servo directly into LinuxCNC.

However I tried to use HAL with two Hitec Hs-422 servos to manage the pan-tilt movement with hal_pi_gpio and the Raspberry pi 4.
The two motors are powered by 5V with an external power unit.
The control pin instead is connected directly on pins 33 and 35 of the Raspberry

Attached you will find a .hal file with commands and a file .xml for the graphical interface in PyVCP.

By copying these files to the Raspberry where the LinuxCNC is already installed, the test starts with the command:

halrun -I -f servopwm.hal

By moving the two sliders you can move the motors.

In this link there is an explanatory video:
drive.google.com/file/d/1-3U6u_qYzBzSIDH...hyN/view?usp=sharing
Attachments:
Last edit: 05 Oct 2021 17:15 by elovalvo.

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

More
05 Oct 2021 21:54 #222311 by rollfree
A little calculations.
The standard RC servo uses pulse length control. 1.5ms is the middle position, about 0.5ms and 2.5ms are the extreme positions of the 180 degree deflection.
So 90 degrees corresponds to 1ms.
The base-thread jitter on RPi4 is around 30us. This corresponds to a deviation of about +-2.7 degrees. So the position of the servo will shake in a range of about 5 degrees.

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

Time to create page: 0.120 seconds
Powered by Kunena Forum