Beginner, error checking

  • Hi ;)

    I have question about error checking. How do you do it?

    I program in KIDE and sometimes i don't know if I wrote the program correctly.
    For example:
    I don't know how to change x parameter in position.
    DX(position) = variable

    Can i use it?

    How can i check if this is correct?
    Is there any debugger?

    Sorry, if I made mistakers in English:|

    Thanks ^^

  • AD
  • Hello,

    I dont know If there is any debugger tool for the AS language. It should be better If KIDE would have in the future a syntax check.

    You wrote correctly.

    Variable = DX(position)

    Usually i wrote the program in notepad++ having a plugin for the AS function and If there are any mistakes while loading the user has 2 options: delete that line or comment that line.

  • Thanks, i will check a plugin.

    I'm trying to change x possition robot from the HMI panel. So i need to write variable to possition.

    "Variable = DX(position)" it writes to a variable, I want the opposite.

    if i can't use : DX(position) = variable

    Maybe it is correctly:

    Decompose .point_temp[0] =pointx

    POINT .pointx= TRANS(variable, point_temp[1], point_temp[2], point_temp[3], point_temp[4] point_temp[5])

  • Welcome to the forum...……….:beerchug:

    The DX command can be used to return the 'x' component of a transform location.

    DY and DZ commands respectfully return the 'y' and 'z' components in the same way eg:

    x_value = DX(location).

    y_value = DY(location).

    z_value = DZ(location).

    This command ONLY obtains what is currently stored as the stipulated component and defines the value to the variable you stipulate.

    This value is stored as a decimal real number and carries no unit/magnitude.

    You can also use the DECOMPOSE command to create an array of ALL components associated with a transform or a precision point.

    (Usually this is better, as you then have all the data associated with the given location).

    DECOMPOSE tmp[0] = location

    DECOMPOSE tmp[0] = #location

    Once you have obtained the information, then adjustments to the values, or complete rewriting of the values can be achieved.

    In order to change ANY location or component of a location, you need to use a variation of the POINT command.

    So what you have written with the DECOMPOSE instruction is close to being correct, but syntactically needs refining.

    From what you have mentioned, you are just trying to replace the existing 'x' component of the target location with the value entered from the HMI.

    x.val.hmi = 500

    POINT .tmp_location = target_location

    DECOMPOSE .tmp[0] = .tmp_location

    POINT .tmp_location = TRANS(x.val.hmi,.tmp[1],.tmp[2],.tmp[3],.tmp[4],.tmp[5])

    POINT target_location = .tmp_location

    The above example is just showing you how to use the local variable as a workflow example.

    You could just have:

    x.val.hmi = 500

    DECOMPOSE .tmp[0] = target_location

    POINT target_location = TRANS(x.val.hmi,.tmp[1],.tmp[2],.tmp[3],.tmp[4],.tmp[5])

    When using local variables, you need to declare them first either by using a global variable, or a constant and then refer to them within the instruction.

    What you wrote would have created 'undefined variable' errors.

  • Everything working, thank you for help.

    I checked in terminal " point DX( location )" and there the program change possition. But I would like to issue a move to this possition on teach pendant before starting the program. Command "lmove possition" does't work, apears error " " Cannot ude thos command/instruction in current mode" I changed the mode to every way, and I still can't use this command. How can I move to this possition without writnig a program?

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account
Sign up for a new account in our community. It's easy!
Register a new account
Sign in
Already have an account? Sign in here.
Sign in Now