verser писал(а):Сделал вариант файла управления джойстиком для 4х осей:
Молодец ,если я такой новичок справился так бьйстро с жойстика ,думаю будет полезно и другим
verser писал(а):Сделал вариант файла управления джойстиком для 4х осей:
Это действительно проще.Nick писал(а):А не проще гашетку привязать к axis...jog-enable?
Нужен АЦП, с драйвером. Можно, например, через ардуину.-Serj- писал(а):Как я могу завести аналоговые сигналы в LinuxCNC?
или да-Serj- писал(а):Или проще выковырять контроллер из какого-нибудь донора?
А нам подскажите где они и как пользуете ?UAVpilot писал(а):На платах 7i76 и 7i77 есть по 4 аналоговых входа.
http://www.cnc-club.ru/forum/viewtopic. ... 480#p45689dinkata писал(а):А нам подскажите где они и как пользуете ?
и ето :nkp писал(а):http://www.cnc-club.ru/forum/viewtopic. ... 480#p45689
Код: Выделить всё
$ halcmd loadrt hm2_pci config="sserial_port_0=20xxxxxx"
$ halcmd show pin *.analogin*
Component Pins:
Owner   Type  Dir         Value  Name
     7  float OUT             0  hm2_5i25.0.7i77.0.0.analogin0
     7  float OUT             0  hm2_5i25.0.7i77.0.0.analogin1
     7  float OUT             0  hm2_5i25.0.7i77.0.0.analogin2
     7  float OUT             0  hm2_5i25.0.7i77.0.0.analogin3
Код: Выделить всё
 loadusr hal_input -W -KRAL +THRUSTMASTER Top Gun Afterburner
    # включаем управление от джойстика
    #net joystick_enable <= input.0.btn-joystick => axis.0.jog-enable
    #net joystick_enable => axis.1.jog-enable
    #net joystick_enable => axis.2.jog-enable
   поскипано...
    # устанавливаем скорость
    #net jog_scale <= input.0.abs-throttle-position => axis.0.jog-scale
    #net jog_scale => axis.1.jog-scale
    #net jog_scale => axis.2.jog-scaleКод: Выделить всё
Loaded HAL Components:
ID      Type  Name                                      PID   State
    20  User  halcmd6957                                 6957 ready
    18  User  halcmd6944                                 6944 ready
    16  User  axisui                                     6938 ready
    14  User  inihal                                     6937 ready
     3  User  hal_input                                  6931 ready
    11  RT    pwmgen                                          ready
    10  RT    stepgen                                         ready
     9  RT    hal_parport                                     ready
     8  RT    probe_parport                                   ready
     7  RT    motmod                                          ready
     6  RT    trivkins                                        ready
     5  User  iocontrol                                  6914 ready
.... поскипано...
     3  bit   OUT          TRUE  input.0.btn-joystick
     3  bit   OUT         FALSE  input.0.btn-joystick-not
     3  bit   OUT         FALSE  input.0.btn-pinkie
     3  bit   OUT          TRUE  input.0.btn-pinkie-not
     3  bit   OUT          TRUE  input.0.btn-thumb
     3  bit   OUT         FALSE  input.0.btn-thumb-not
     3  bit   OUT         FALSE  input.0.btn-thumb2
     3  bit   OUT          TRUE  input.0.btn-thumb2-not
     3  bit   OUT          TRUE  input.0.btn-top
     3  bit   OUT         FALSE  input.0.btn-top-not
     3  bit   OUT         FALSE  input.0.btn-top2
Код: Выделить всё
loadusr hal_input -W -KRAL +THRUSTMASTER Top Gun AfterburnerКод: Выделить всё
loadusr hal_input -Wn input   (....)посмотри какие потенциометры-Serj- писал(а):Прошу прощения, я новичёк, станок пока в мыслях. Потихоньку собираю деталюхи да обдумываю разные моменты. Вот попался мне хороший промышленный джойстик, в нём нет контроллера, только три потенциомметра. Как я могу завести аналоговые сигналы в LinuxCNC? Или проще выковырять контроллер из какого-нибудь донора?
Код: Выделить всё
loadusr -W hal_input -KRAL DragonRise Inc.   Generic   USB  Joystick
#loadusr hal_joystick -d /dev/input/js0 -p joypad
#net joystick_enable <= input.0.btn-trigger => axis.0.jog-enable
setp axis.0.jog-vel-mode 1
setp axis.1.jog-vel-mode 1
setp axis.2.jog-vel-mode 1
setp halui.jog-speed 500
#net joispid1 input.0.btn-base halui.jog-speed 500
#net joispid2 input.0.btn-base2 halui.mdi-command-10
net jog_scale input.0.abs-x-position => halui.jog.0.analog
net jog_scale1 input.0.abs-y-position => halui.jog.1.analog
net jog_scale2 input.0.abs-z-position => halui.jog.2.analog
 
Вот пример как у меня (кнопки и скорости чуть другие)solo писал(а): а как это сделать в хел файле
Код: Выделить всё
#----------------------------------------------------------------------------------------------------------
# Scale button - Set jog speed
#----------------------------------------------------------------------------------------------------------
# Painted button	function		mapping
#	5		set jog scale: 1/1000	input.0.btn-thumb2
#	7		set jog scale: 4/10000	input.0.btn-top
# First, we select the two buttons for speed selection. We'll use 5 and 7 for 1/1000 and 4/10000, respectively.
net button5 input.0.btn-thumb2 => flipflop.0.reset
net button7 input.0.btn-top => flipflop.0.set
net button5 input.0.btn-thumb2 => flipflop.1.reset
net button7 input.0.btn-top => flipflop.1.set
#Add the control for the mux by mapping it to the flip-flop. Thus, it will stay in the last state until it is 
#changed.
net chosenJogSpeed flipflop.0.out => mux2.6.sel
net chosenJogDuration flipflop.1.out => mux2.7.sel
#Now, map the jog scale values to the axes.
net jogscale mux2.6.out => axis.0.jog-scale
net jogscale mux2.6.out => axis.1.jog-scale
net jogscale mux2.6.out => axis.2.jog-scale
net jogscale mux2.6.out => axis.4.jog-scale
# Set parameters values 3750 3609
setp flipflop.0.tmax          	3750
setp mux2.6.tmax         	3609
# Set the two scale values. The output will equal in0 when FALSE and in1 when TRUE.
setp mux2.6.in0          	0.1
setp mux2.6.in1          	0.01
...
# Now we can update the speed values. They aren't that critical in terms of calculation order, since the user will have to 
# look down, press the button, then resume. The computer will react millions of times faster than even the twitchiest 
# gamer / machinist.
addf flipflop.0 servo-thread
addf mux2.6 servo-thread
addf flipflop.1 servo-thread
addf mux2.7 servo-thread
Если не изменяет память, то то что тебе надо тут Re: JoyHandle - компонент для построения нелинейного джойсти #5solo писал(а):пытаю реализовать в джойстике следующее
при нажатии кнопки пин (input.0.btn-base) хочу чтобы оси перемешались с скорость 300
а при нажатии кнопки с пином (input.0.btn-base2) оси должны ехать с скорость 900
torvn77 писал(а):П.С. Хорошо бы чтобы кто ни будь хотя бы демультиплексор на С оформил.
Код: Выделить всё
component demux2 "A demultiplexer to select from one of two outputs to connect to the input";
description " This component allows you to connect a single input to one of several outputs. \
This version will connect only one of two outputs." ; 
author "Marius D. Liebenberg";
//option singleton yes;
//option default_count = 1;
//option userspace yes;
// Input Pins
pin in bit in0  "Any float input value";
pin in bit sel  "If HIGH the out1 will be connect to in0, else the out 0 will be connected ";
// Output Pins
pin out bit out0  "Follows the value of in0 if sel is FALSE";
pin out bit out1  "Follows the value of in0 if sel is TRUE";
// Parameters
// Global Variables
function _;
license "GPL";
;;
#include "rtapi_math.h"
FUNCTION(_) {
if(sel) out1 = in0;
else out0 = in0;
}Код: Выделить всё
#----------------Логика блокировки и переключения analog/continue режима кнопок
# Задание клавиш выбора через подключение к соответствующему сигналу
net gamepad.analog_jog-enable   <= input.0.btn-base2
net gamepad.continue_jog-enable <= input.0.btn-pinkie
net gamepad.analog_jog-enable       => not.0.in
net gamepad.analog_jog-enable-not   <= not.0.out
net gamepad.continue_jog-enable     => not.1.in
net gamepad.continue_jog-enable-not <= not.1.out
# Если не нажата ни одна клавиша выбора или нажаты обе клавиши,то выполняется блокировка кнопок
# Если нажата только одна из клавиша выбора то выбирается соответствующий режим 
net gamepad.analog_jog-enable        => and2.0.in0
net gamepad.continue_jog-enable-not  => and2.0.in1
net gamepad.sel_button_mode_analog   <= and2.0.out
net gamepad.continue_jog-enable      => and2.25.in0
net gamepad.analog_jog-enable-not    => and2.25.in1
net gamepad.sel_button_mode_continue <= and2.25.outКод: Выделить всё
#----------------Button 1-------
net gamepad.func_button_1 => and2.1.in0
net gamepad.sel_button_mode_analog => and2.1.in1
net gamepad.func_button_1-analog-mode <= and2.1.out
net gamepad.func_button_1 => and2.2.in0
net gamepad.sel_button_mode_continue => and2.2.in1
net gamepad.func_button_1-continue_mode <= and2.2.out