karel jointpos data type

  • how do i access the individual joint angles for a jointpos data type in karel? I know for an xyzwpr datat type i can do xyzwpr.x to access the the x component but i can find a way to do the same for jointpos. thanks for the help.

  • Place your Ad here!
  • PROGRAM move_to_GP2
    %LOCKGROUP = 2


    VAR
    ang_axis_1:JOINTPOS1 IN GROUP[2]
    joint_pos:JOINTPOS IN GROUP[2]
    jp_old, jp_new : ARRAY [9] OF REAL
    increment, degress, i, entry, spd, count, status :INTEGER

    BEGIN

    GET_REG(1,FALSE,increment,0.0,STATUS)
    GET_REG(2,FALSE,count,0.0,STATUS)
    GET_REG(3,FALSE,spd,0.0,STATUS)

    joint_pos = CURJPOS(0,0,2)


    CNV_JPOS_REL(joint_pos, jp_old, status)


    FOR i = 1 TO 9 DO
    jp_new[i] = 0.0
    ENDFOR

    --Save current angle axis 1 GP2
    jp_new[1] = jp_old[1]
    WRITE (jp_new[1] , CR)


    FOR i=0 TO count DO
    jp_new[1] = jp_new[1] + increment
    --WRITE (jp_new[1] , CR)
    CNV_REL_JPOS (jp_new, joint_pos, status)
    WITH $GROUP[2].$SPEED=spd,$GROUP[2].$MOTYPE=JOINT,$GROUP[2].$TERMTYPE=NODECEL MOVE TO joint_pos
    ENDFOR
    END move_to_GP2

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

Advertising from our partners