'Command' is not a valid named constant

4 years 4 weeks ago #29534661 by DrZer
Hello,

We are using Controller Motor FBL2360 and we are trying to work with ROS package which should work with this controller.
The problem (image attached) comes out when we try to export the .hex file from the mbs compiler of Roborun+; the variables are the same described in the user manual, here is the script:
SCRIPT_VER=28
MAX_CHANNELS=1
Dim last_mode[2] as Integer

' Mode values are:
'  -1 stopped
'  0 speed mode
'  1 position mode
' These correspond to the constants in roboteq_msgs/Command. The motor begins in stopped
' mode, the setup for which is run when last_mode[0] != VAR[1].
last_mode[0] = -127
setcommand(_VAR, 1, -1)

' Motor controller configuration. Much of this is particular to Grizzly
' and can be generalized/parameterized as the need arises. Page numbers
' are a reference to this document:
' www.roboteq.com/index.php/docman/motor-controllers-documents-and-files/documentation/user-manual/7-nextgen-controllers-user-manual/file

setconfig(_ECHOF, 1) ' Serial echo off (p195)
setconfig(_RWD, 110) ' Watchdog timeout, milliseconds (p195)
setconfig(_AMOD, 1, 1) ' Analog input 1 absolute mode
setconfig(_AMOD, 2, 1) ' Analog input 2 absolute mode

' Undervoltage/overvoltage limits (p214)
setconfig(_OVL, 700)
setconfig(_UVL, 280)

for ch = 1 andwhile ch <= MAX_CHANNELS evaluate ch++
	' Encoder, speed config (p208, p221)
	setconfig(_EMOD, ch, 50)
	setconfig(_EPPR, ch, 1024)
	setconfig(_MXRPM, ch, 3500)
	setconfig(_CLERD, ch, 0)

	' Current limit (p216)
	setconfig(_ALIM, ch, 1500)
	setconfig(_ATGA, ch, 2000)
	setconfig(_ATGD, ch, 50)
	setconfig(_ATRIG, ch, 0)

	' Max acceleration/deceleration (p219)
	setconfig(_MAC, ch, 20000)
	setconfig(_MDEC, ch, 20000)
next

top:
	for ch = 1 andwhile ch <= MAX_CHANNELS evaluate ch++
		if last_mode[ch - 1] <> getvalue(_VAR, ch) then
			last_mode[ch - 1] = getvalue(_VAR, ch)

			' Motor to be stopped (high-Z).
			if getvalue(_VAR, ch) = -1 then
				setconfig(_MMOD, ch, 1)
				setconfig(_KP, ch, 0)
				setconfig(_KI, ch, 0)
				setconfig(_KD, ch, 0)
				setconfig(_ICAP, ch, 0)
				setcommand(_G, ch, 0)
			end if

			' Motor in velocity-control mode.
			if getvalue(_VAR, ch) = 0 then
				setconfig(_MMOD, ch, 1)
				setconfig(_KP, ch, 20)
				setconfig(_KI, ch, 40)
				setconfig(_KD, ch, 10)
				setconfig(_ICAP, ch, 100)
			end if

			' Motor in position-control mode.
			if getvalue(_VAR, ch) = 1 then
				setconfig(_MMOD, ch, 3)
				setconfig(_KP, ch, 2)
				setconfig(_KI, ch, 0)
				setconfig(_KD, ch, 0)
				setconfig(_ICAP, ch, 0)
			end if
		end if
		
		' Send feedback for this channel at 25Hz.
		GoSub PrintFeedback
	next

	' Send status messages for the controller at 5Hz.
	c++
	if c = 5 then
		GoSub PrintStatus
		c = 0
	end if

	wait(19)
	goto top

PrintFeedback:
	print("&f:", ch)
	print(":", getvalue(_MOTAMPS, ch))
	print(":", getvalue(_MOTCMD, ch))
	print(":", getvalue(_MOTPWR, ch))
	print(":", getvalue(_ABSPEED, ch))
	print(":", getvalue(_ABCNTR, ch))
	print(":", getvalue(_VOLTS, 2))
	print(":", getvalue(_BATAMPS, ch))
	print(":", getvalue(_ANAIN, ch))
	print(":", getvalue(_TEMP, ch+1))
	print("\r")
	Return
	
PrintStatus:
	print("&s:", SCRIPT_VER)
	print(":", getvalue(_FLTFLAG))
	print(":", getvalue(_STFLAG))
	print(":", getvalue(_VOLTS, 1))
	print(":", getvalue(_VOLTS, 3))
	print(":", getvalue(_TEMP, 1))
	print("\r")
	Return

We tried to compile it both plugged and unplugged and these warns are still there. Also working offline with different controllers just to test.
How can we solve this?
Thank you for the attention,

DZ

Please Log in or Create an account to join the conversation.

4 years 4 weeks ago #29534662 by blake
Hi doesn't look like there's an image attached. Can you attach an image of the error the compiler throws or email it to This email address is being protected from spambots. You need JavaScript enabled to view it.

Please Log in or Create an account to join the conversation.

4 years 4 weeks ago #29534663 by DrZer
Here the links to the screenshots:
First shows '_ECHOF' as warning second, just screenshotted, shows it working

ibb.co/zfxWYW5
ibb.co/Pm7Dz7Y
(we couldn't load the attachment)

Please Log in or Create an account to join the conversation.

4 years 4 weeks ago #29534664 by blake
Please power cycle the controller then try to recompile the script. It should give same errors. Immediately go to the "Console" tab and click the Save Log button in the bottom right corner. Please send that file along with your script file to This email address is being protected from spambots. You need JavaScript enabled to view it.

Please Log in or Create an account to join the conversation.

Time to create page: 0.061 seconds