function argument is not a is not a constant expression
kschmid
✭
This must be a pretty trivial error, can I pass arguments as constant?
Or do I even have to? radius should be a copy here ?
CONST num circum := l_PI * 2. * radius;
ENDPROC
gets me
System1/RAPID/T_ROB1/Module1(317,41): Data declaration error(20): Expression radius is not a constant expression. 5/08/2019 3:57:31 PM General
Also getting similar result with FUNC.
num radius is not a copy?
it works with everything in 1 line but that's silly
PROC get_pitch(num turnSpacing, num radius, INOUT num slope_angle)
slope_angle := toDegree(ATan(turnSpacing / l_PI * 2. * radius));
ENDPROC
Post edited by kschmid on
0
Comments
-
It needs a constant, because you declare and initialize the value at the same line.
</code>CONST num circum := l_PI * 2. * radius;<br> ^ ^<br> | |<br></pre><br></div><div>You can fix this by doing this for example:</div><div><br></div><div><pre class="CodeBlock"><code>PROC get_pitch(num turnSpacing, num radius, INOUT num slope_angle)<br> VAR num circum := l_PI;<br> circum := l_PI * 2. * radius;<br>ENDPROC
or<code>VAR num circum;<br>
PROC get_pitch(num turnSpacing, num radius, INOUT num slope_angle)
circum := l_PI * 2. * radius;
ENDPROC
2 -
let me try, i think CONST didnt do it.Ah, right i need to declare separately. First time i meet a language with that requirement but thanks for your help0
-
Hi Eric, Thanks for your answer, which also solved my problem.
I am wondering, why seperate the declaration and assignment expression could solve the problem. Is there anything to do the way Robotstudo allocates it's memory?
Appreciated!0
Categories
- All Categories
- 5.5K RobotStudio
- 395 UpFeed
- 18 Tutorials
- 13 RobotApps
- 297 PowerPacs
- 405 RobotStudio S4
- 1.8K Developer Tools
- 249 ScreenMaker
- 2.7K Robot Controller
- 310 IRC5
- 59 OmniCore
- 7 RCS (Realistic Controller Simulation)
- 785 RAPID Programming
- AppStudio
- 3 RobotStudio AR Viewer
- 18 Wizard Easy Programming
- 105 Collaborative Robots
- 4 Job listings