Home Programming

Discussion

Left ArrowBack to discussions page
agiakosagiakos Posts: 15 Apprentice
edited February 2018 in Programming
Hello community,

I am trying to calibrate a sensor, the first step is to find the pin hole(there is a screw attached to the sensor). The second step is start rotating the wrist 3 and stop it when I am receiving a signal(notify me that I am at the far right or left point) and the 3rd step to make the Wrist 3 rotate at the other direction 270 degrees(distance between far left and far right) and receive kind of similar message. 

The 1st step I did it using the linear search and rotational search. The 2nd step I was able to introduce an event that pop ups a message and pause the program. My problem is with the 3rd step,because the Wrist 3 position is different every time(detects the screw head at different degrees) I would like to have a variable waypoint and that waypoint should be the robot position when the event occurs. I will try to use something like WaypointEvent=get_target_joint_positions(), but I would like your suggestions.

I hope I was clear enough
Tagged:

Best Answer

  • matthewd92matthewd92 Founding Pro, Tactile Sensor Beta Testers Posts: 1,267 Handy
    Answer ✓
    @agiakos tonget the motion to stop properly when the signal is reached place the waypoint inside an if statement, on the setup screen use the signal is low as the condition and check the box for monitoring continuously. This will cause the motion to exit as soon as the signal is reached. You may want to place a stopj(8) command right after the if statement just to make sure motion stops correctly. 

    Then you can use a pose_trans() function to calculate waypoint 3. You will use the pose Tool from the pose drop down list in the formula editor. 

    waypoint3=pose_trans(Tool,p[0,0,0,0,0,-d2r(270)])

    this assumes that you you want to rotate around the Z axis of the tool. If you need a different axis place the rotation in the correct axis as well as use the correct sign to change the rotation direction. The d2r() function allows the system to convert degrees to radians as the function needs the new angle in radians and any linear move in meters if there were a linear component. 

    What this function will will do is take where you currently are situated and calculate a new waypoint based on the changes desired to the existing point. 

Comments

  • agiakosagiakos Posts: 15 Apprentice
    edited February 2018
    Thank you very much @matthewd92 , I used relative position waypoints and the if statements as you said and it works. I will try your way also.
  • matthewd92matthewd92 Founding Pro, Tactile Sensor Beta Testers Posts: 1,267 Handy
    Glad it was helpful.   Relative position achieves the same thing as what I recommended.  I just generally do not use them as I do not like how they are taught in most of our applications and prefer the control that I get writing out the position formulas myself.
  • agiakosagiakos Posts: 15 Apprentice
    edited February 2018
    Hello @matthewd92
     I don't know how to define the waypoint_3  and I am getting an error can you guide me?Inside the if statement I would like to start the rotation of Wrist 3
  • matthewd92matthewd92 Founding Pro, Tactile Sensor Beta Testers Posts: 1,267 Handy
    The issue is your “=“ sign. You have to use the one on the text keyboard, not the one on the formula builder screen. The one on the builder screen has a small question mark over it if you look closely. This is the logical equality sign “==“ which means is the left side the same as the right side. 

    The easiest away around this is instead of using a script line is to use the assignment line. Click assignment, rename your variable to waypoint_3 and then place your formula in the assignment screen. It will use the correct equal sign automatically. I would place that line just before your if statement and then place a waypoint inside the if. On the waypoint you can choose variable as the type of waypoint and then select the variable you want to use. 
  • agiakosagiakos Posts: 15 Apprentice
    Hey @matthewd92
    Do you might know how to get the motion to stop properly when the signal is reached but with a register value?
  • matthewd92matthewd92 Founding Pro, Tactile Sensor Beta Testers Posts: 1,267 Handy
    Are you using modbus registers?  If so you would either connect a modbus client to the register and then it just becomes either an input or output just like anything else or you will need to read the register value using script command which is read_XXX_register() depending on the type of register you are using (float, integer, boolean) and the register port address.
Sign In or Register to comment.
Left ArrowBack to discussions page