I am thinking of activating the distance laser sensor to search for points. The sensor is placed on the robot and it is supposed to find the elevation of the scanned surface when the robot passes. I go to a given point and the robot advances in the direction of e.g. the X axis, the sensor sees the value 0, after hovering the sensor and showing the value, e.g. 5 mm, the robot stops, saves the point and goes to the next point that must be measured. There will be 8 measuring points. I'm curious how you would do it. I am only interested in looking for these points, stopping, restarting to the next point, recording these points. Laser sensor annalog output from 0 to 5 V, learning function, searching for points, learning up to 3 points. KSS control kr4 8.2.
Finding points
- Martin84
- Thread is Unresolved
-
-
i am more interested to see your attempt...
but since robot stops at each point, this would do:
PTP P1
value[1]=$ANIN[1]
PTP P2
value[2]=$ANIN[1]
PTP P3
value[3]=$ANIN[1]
PTP P4
value[4]=$ANIN[1]
etc.
-
Code
Display MoreDEF Pomiar_bazy( ) DECL REAL Y1[4] DECL REAL X1[4] DECL INT P DECL REAL X[4] DECL REAL Y[4] DECL REAL A[2] DECL REAL B[2] DECL REAL WYNIK_Y DECL REAL WYNIK_X DECL FRAME POS_1 GLOBAL INTERRUPT DECL 1 WHEN $IN[22]==TRUE DO STOP_SZUKANIE() ;FOLD INI ;FOLD BASISTECH INI GLOBAL INTERRUPT DECL 3 WHEN $STOPMESS==TRUE DO IR_STOPM ( ) INTERRUPT ON 3 BAS (#INITMOV,0 ) ;ENDFOLD (BASISTECH INI) ;FOLD USER INI ;Make your modifications here ;ENDFOLD (USER INI) ;ENDFOLD (INI) $ADVANCE=5 ;FOLD PTP HOME Vel=100 % PDAT1;%{PE}%R 8.2.19,%MKUKATPBASIS,%CMOVE,%VPTP,%P 1:PTP, 2:HOME, 3:, 5:100, 7:PDAT1 P=TOOL(0) $TOOL=TOOL_DATA[17] ;starting the laser sensor $OUT[2]=FALSE ;FOLD LIN PUNKT1 Vel=2 m/s CPDAT1 Tool[17]:LASER 50 Base[0];%{PE}%R 8.2.19,%MKUKATPBASIS,%CMOVE,%VLIN,%P 1:LIN, 2:PUNKT1, 3:, 5:2, 7:CPDAT1 ;POINT SEARCH SUB-PROGRAM SZUKANIE_1() ; COLLECTING POINTS X[1]=$POS_ACT.X Y[1]=$POS_ACT.Y ;FOLD LIN PUNKT2 Vel=2 m/s CPDAT2 Tool[17]:LASER 50 Base[0];%{PE}%R 8.2.19,%MKUKATPBASIS,%CMOVE,%VLIN,%P 1:LIN, 2:PUNKT2, 3:, 5:2, 7:CPDAT2 ;POINT SEARCH SUB-PROGRAM SZUKANIE_1() ; COLLECTING POINTS X[2]=$POS_ACT.X Y[2]=$POS_ACT.Y $OUT[2]=TRUE ;FOLD PTP HOME Vel=100 % PDAT2;%{PE}%R 8.2.19,%MKUKATPBASIS,%CMOVE,%VPTP,%P 1:PTP, 2:HOME, 3:, 5:100, 7:PDAT2 END DEF STOP_SZUKANIE() INTERRUPT OFF BRAKE PTP $POS_ACT RESUME END DEF SZUKANIE_1() DECL FRAME POS_1 INTERRUPT ON $OV_PRO=1 POS_1.Y=$POS_ACT.Y+40 LIN POS_1 $OV_PRO=30 END
-
The search_1 subroutine is designed to add 40mm from the actual position in the specified direction and move towards that point. In the time of displacement, the laser sensor is to detect a fault, if the base value increases by 4 mm, it is to give true to $ in [22] and call the program to stop the run, exit from the program, stop and save points X and Y to real variables. Unfortunately, after giving the signal by the sensor, the program moves to the set value of $ pos_act +40 and after reaching the value of +40, the stop program is started.
SHOULD THE "INTERRUPT" FUNCTION NOT PERFORM THE INTERRUPTION OF THE COURSE OF THE PRESENT POINT AND START THE STOP PROGRAM?
FOR SURE I HAVE TO CHANGE
$ POS_ACT
ON
$ POS_INT
MOMENTLY THIS IS A RAW CODE FOR THE TEST, MEASUREMENT POINTS WILL BE MORE.
-
so your distance sensor has discrete output that is wired to $IN[22]?
5mm is not much of a 'distance'...
actually distance is not too important, but the repeatability is. you do not want sensor to turn on at 5mm in one pass, but then does the same at 3.5mm in next pass. that would be 30% change.
Few comments if i may:
i would avoid using interrupts that have top priority. when robot encounters a problem interrupt 3 is called. do you really think your interrupt recording position or whatever should be more important than that?
i would propose declaring (and initializing) variables in DAT file rather than SRC. that way you can easily monitor them and see results after program ends. also that would allow you to use such variables inside the interrupt routine, instead of moving to $POS_ACT then checking what the current robot position is after return from ISR.
also i strongly suggest to NOT use $OV_PRO as a substitute for programmed velocity. your search motion used programmed velocity of 2m/s (instead of something like 0.05 m/s). problem is that if anyone touches teach pendant controls and change the OV_PRO, robot would very likely crash at high speed.
programs should always be written to move while $OV_PRO is at 100.
then there is a problem with search motion - you send robot to $POS_ACT in line 95 instead of $POS_INT. if you are going to use interrupt to do something with position, do not use $POS_ACT, use $POS_INT. they are NOT the same and difference could be significant, specially when your distance sensor is set to 5mm instead of 500mm.
and sorry for modifying formatting of your post, tried to make it "CODE" instead of "QUOTE"
-
i used a lot of lasers and even ones with shortest range were something like 16..120mm. usually 50..650mm or more (sometimes much more). what kind of laser distance sensor has setpoint of only 5mm?
-
Yes, the sensor has a digital output connected to $ in [22].
Laser sensor from -80 to 80 mm. Discrete output triggering is 4 mm from the base value. So the base value is 20 mm, if it increases by 4 mm, then with the value of 24 mm $ w [22] = true.
The priority 1 of the interrupt is the result of the test, so the interrupt does not start while running to the point LIN POS_1 in the program search_1, but only after its completion, i.e. after reaching the end of LIN POS_1, it goes to STOP_Search ().
I declare in .dat but I didn't want to move the .dat file in the forum.
Right now I'm using $ ov_pro for trying.
-
The priority 1 of the interrupt is the result of the test, so the interrupt does not start while running to the point LIN POS_1 in the program search_1, but only after its completion, i.e. after reaching the end of LIN POS_1, it goes to STOP_Search ().
What? The Priority setting has no effect on when the Interrupt fires.
-
Laser sensor from -80 to 80 mm.
How in the world does a laser work from -80mm to 80mm? I am thinking the beam is emitted from the sensor in only one direction and would function only in the positive distance range.
-
How in the world does a laser work from -80mm to 80mm? I am thinking the beam is emitted from the sensor in only one direction and would function only in the positive distance range.
HG-C1200-P PANASONIC the display shows -80 to 80 .
-
Co? Ustawienie Priorytet nie ma wpływu na uruchomienie przerwania.
You got me wrong, that's not what I meant. Of course is affected by priority setting.
-
How in the world does a laser work from -80mm to 80mm? I am thinking the beam is emitted from the sensor in only one direction and would function only in the positive distance range.
I would assume the laser is an analog device back to its controller, with a "zero" set somewhere in the middle of its detection range. Most devices like this can have the zero range, and the overall +/- range, configured.
You got me wrong, that's not what I meant. Of course is affected by priority setting.
No, it's really not. The Interrupt will fire when the Input event happens. PRIO 1 or PRIO 10 won't have any effect, unless you have multiple Interrupts firing at the same time. And even then, unless those different Interrupts have lots of processing going on, the "noise" caused by the 12ms I/O refresh timing is is probably going to be bigger than the variation between different PRIO settings.
-
well it turns out that this product is not the conventional "laser distance sensor". functionally is an optical sensor with background suppression. output is digital, not analog.Just checked the datasheet. it does have analog output too. but in this application it is apparently not used.
-
Basically, the topic is finished, I wrote the support for searching and calculating the base, at the moment I am in the testing phase and adding a safety function. Panic mode has an analog output and one digital input and an output.
-
Not me... The sensor does.
I am all analog
-
the datasheets tells everything.
range is not +/-80mm, it is 200mm +/- 80mm, or 120..280mm
-
Yes, the sensors have has analog output.
Create an account or sign in to comment
You need to be a member in order to leave a comment