Problem with SET_POS_REG using Karel.

  • Gents, I have a problem with using SET_POS_REG instruction in Karel.

    I want to set the value to PR fot example the following data:


    posn.X = 0

    posn.Y = 0

    posn.Z = value

    posn.W = 0

    posn.P = 0

    posn.R = 0

    SET_POS_REG(reg, posn, status)


    The instruction itself make a good job, but when I want to use this position as offset to points in a program, I got a problem with config field in the PR.

    Before running my Karel prog, the PR config field was NUT 000, after using SET_POS_REG from Karel prog, I got "FUT 127-1-1".

    My "value" is around -200.

    The effect is, when using is as the offset data, I got the alarm INTP-311 Uninitialized data, which stops my robot.


    Do you have any ideas how to solve that issue?

  • AD
  • From the manual, CONFIG types are a structure that contain:

    CFG_TURN_NO1

    CFG_TURN_NO2

    CFG_TURN_NO3

    CFG_FLIP

    CFG_UP

    CFG_FRONT


    The TURNs are integers, and the rest are booleans.


    So, it looks like accessing the config elements would be

    Code
    PositionVariable.config_data.CFG_TURN_01 = 0
    PositionVariable.config_data.CFG_FRONT = TRUE

    and so on.

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