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.
karel jointpos data type
-
nerd484 -
February 5, 2018 at 6:43 PM -
Thread is Resolved
-
-
PROGRAM move_to_GP2
%LOCKGROUP = 2VAR
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 -
FOR i = 1 TO 9 DO
jp_new[i] = 0.0
ENDFORHi lexx905,
if the new value is different for each element then how the value will; be inserted to array?
-
Hello.
I don't understand your question. This piece of code simply initializes the array with zero values ...