I have a background in vba and alittle C++ but completely new to Karel. I am attempting to do some trig to give a Fanuc robot a PR offset. On a fixture I have 2 known sides of a triangle a,b. Need to solve for c. My code is below, I tried to piece things together from different sources but I am getting the following errors when building the .PC file in ROBOGUIDE.
- GET_REG(30,RFLAG,REGISTER,RVALUE,STATUS) : RETURN value expected in this ROUTINE. Routine: GET_REG
- GET_REG(30,RFLAG,REGISTER,RVALUE,STATUS) : Data type of Id is incompatible with right hand side. Id: A_VAR
- SET_INT_REG(31,target,STATUS) : ROUTINE argument data type does not match the parameter definition.
I would appreciate any help.
Code
PROGRAM Pyth_Thrm
%NOLOCKGROUP
--Declared Variables
VAR
a_var : REAL
b_var : REAL
c_var : REAL
sq_a: REAL
sq_b: REAL
sum_sq: REAL
target: REAL
entry:REAL
STATUS:REAL
register:REAL
r_flag:BOOLEAN
r_value:REAL
BEGIN
a_var = GET_REG(30,RFLAG,REGISTER,RVALUE,STATUS) -- Get Part Radius
b_var = 104 -- Known
sq_a = a_var * a_var -- Square a side
sq_b = b_var * b_var -- Square b side
sum_sq = sq_a + sq_b -- Sum of Squares
target = SQRT( sum_sq) -- Square Root Sum of Squares
target = TRUNC(target) -- Truncate answer
SET_INT_REG(31,target,STATUS) -- Assign Value To Data Register
END Pyth_Thrm
Display More