Question
Asked December 27 2016

Community Question

I'm getting an error message in one of my scripts that is giving me some trouble. It's a random error meaning that it will happen every few times the command is run. It's set in a loop so it will repeat. Sometimes it will even cause the connection between the EZB and computer to cut off. Here'e the error:

Code:


Error on line 25: Missing String Quotes or Invalid Expression at index 14: "


and

Code:


Error on line 25: Missing String Quotes or Invalid Expression at index 15: "



Here's the script to happens in. Seems to center around the print commands. Once I removed the print command at line 25 and the error skipped to the next one. I've also expanded the sleep() commands thinking it was running too fast but it does not help. Thanks for looking :

Code:


# This Script will return the actual position number of the left catrrage
# #from the Kangaroo withough the 1,p in the begining.
# #Returning feedback with the 1,p causes problems.
# #Do Not Delete. Other scripts depend on this script!

# -------------------------------------
# Get Roo position

uartWrite(2, 2, "2, Getp", 0x0d)

:waitForData
Sleep(30)

$y_lft = UartAvailable(2, 2)
Sleep(30)
print("Bytes in buffer:" + $y_lft)

if ($y_lft < 6)
# Go back and wait for data again because we did not receive the least number of expected bytes.
goto(waitForData)
endif
Sleep(30)
$Get_Lft_Carrage_P = UARTRead(2, 2, $y_lft)
Sleep(30)
print("Received: " + $Get_Lft_Carrage_P)

Sleep( 50 )

# -------------------------------
# Find out and print if the P is upper or lower case.
# Upper case means motor has finished move ans stoped.
# Lower Case means that motor is still moving.

$P_lft_or_p_lft = GetCharAt($Get_Lft_Carrage_P, 2) #Assign a variable to either a capitol P or Small case p returned by Kangaroo.

Print("P_lft_or_p_lft:" + $P_lft_or_p_lft)

# -----------------------------
# Defeat the P_lft_or_p_lft

if ($P_lft_or_p_lft = "p")
Goto(Lower_p_Split)
ELSEif ($P_lft_or_p_lft = "P")
Goto(Upper_P_Split)
endif

Sleep( 50 )

:Lower_p_Split

$Lft_Carrage_Position = Split($Get_Lft_Carrage_P, "p",1) #1,pXXXX is returned. Get everything after the Lower case p (P is case senceitive).
Sleep(30)
print("Received:" + $Lft_Carrage_Position)
Halt()

:Upper_P_Split
$Lft_Carrage_Position = Split($Get_Lft_Carrage_P, "P",1) #1,pXXXX is returned. Get everything after the Upper case P (P is case senceitive).
Sleep(30)
print("Received:" + $Lft_Carrage_Position)

December 27 2016
In addition I noticed that this error also seems to happen when there are over 9 or more bytes in the uart buffer. This call for information usually only returns 8 bytes but sometimes as the loop runs, more bytes then expected are reported in there. My loops keeps running until there are more then 6 bytes found in the buffer. Do you think this could be part of the cause?
December 27 2016
Here's what the debug window shows when I get disconnected from the conputer after the above error message:

Code:


Error on line 25: Missing String Quotes or Invalid Expression at index 15: "
Error on line 25: Missing String Quotes or Invalid Expression at index 15: "
Error on line 25: Missing String Quotes or Invalid Expression at index 14: "
Error on line 25: Missing String Quotes or Invalid Expression at index 15: "
Error on line 25: Missing String Quotes or Invalid Expression at index 15: "
Error on line 25: Missing String Quotes or Invalid Expression at index 15: "
Error on line 25: Missing String Quotes or Invalid Expression at index 15: "
Error on line 25: Missing String Quotes or Invalid Expression at index 15: "
Error on line 25: Missing String Quotes or Invalid Expression at index 15: "
Error on line 25: Missing String Quotes or Invalid Expression at index 15: "
Error on line 25: Missing String Quotes or Invalid Expression at index 15: "
Comm Err: System.IO.IOException: Unable to read data from the transport connection: A connection attempt failed because the connected party did not properly respond after a period of time, or established connection failed because connected host has failed to respond. ---> System.Net.Sockets.SocketException: A connection attempt failed because the connected party did not properly respond after a period of time, or established connection failed because connected host has failed to respond
at System.Net.Sockets.Socket.Receive(Byte[] buffer, Int32 offset, Int32 size, SocketFlags socketFlags)
at System.Net.Sockets.NetworkStream.Read(Byte[] buffer, Int32 offset, Int32 size)
--- End of inner exception stack trace ---
at System.Net.Sockets.NetworkStream.Read(Byte[] buffer, Int32 offset, Int32 size)
at EZ_B.EZB.Sqf7viyWfV(Int32 , Byte[] cmdData)
BbytesToExpect: 16

Disconnected
Error on line 9: Not connected
Error on line 9: Not connected
Error on line 9: Not connected
Error on line 9: Not connected
Error on line 9: Not connected
Error on line 9: Not connected
Error on line 9: Not connected
Error on line 9: Not connected
Error on line 9: Not connected
Error on line 9: Not connected
Error on line 9: Not connected
Error on line 9: Not connected
Error on line 9: Not connected
Error on line 9: Not connected
Error on line 9: Not connected
Error on line 9: Not connected
Error on line 9: Not connected
Error on line 9: Not connected
Error on line 9: Not connected
Error on line 9: Not connected
Error on line 9: Not connected
Error on line 9: Not connected
Error on line 9: Not connected
Error on line 9: Not connected
Error on line 9: Not connected
Error on line 9: Not connected
Error on line 9: Not connected
Error on line 9: Not connected
Error on line 9: Not connected
Error on line 9: Not connected
Error on line 9: Not connected
Error on line 9: Not connected
Error on line 9: Not connected
Error on line 9: Not connected
Error on line 9: Not connected
Error on line 9: Not connected
Error on line 9: Not connected
Error on line 9: Not connected
Error on line 9: Not connected
Error on line 9: Not connected
Error on line 9: Not connected
Error on line 9: Not connected
Error on line 9: Not connected
Error on line 9: Not connected
Error on line 9: Not connected
Error on line 9: Not connected
Error on line 9: Not connected
Error on line 9: Not connected
Error on line 9: Not connected
Error on line 9: Not connected
Comm Err: System.IO.IOException: Unable to read data from the transport connection: A connection attempt failed because the connected party did not properly respond after a period of time, or established connection failed because connected host has failed to respond. ---> System.Net.Sockets.SocketException: A connection attempt failed because the connected party did not properly respond after a period of time, or established connection failed because connected host has failed to respond
at System.Net.Sockets.Socket.Receive(Byte[] buffer, Int32 offset, Int32 size, SocketFlags socketFlags)
at System.Net.Sockets.NetworkStream.Read(Byte[] buffer, Int32 offset, Int32 size)
--- End of inner exception stack trace ---
at System.Net.Sockets.NetworkStream.Read(Byte[] buffer, Int32 offset, Int32 size)
at EZ_B.EZB.Sqf7viyWfV(Int32 , Byte[] cmdData)
BbytesToExpect: 2
?
Received: 0 0
Disconnected
Error on line 3: Not connected to EZ_B 0
Error on line 4: Not connected to EZ_B 0
Disconnected
Disconnected



*tired*

DJ Sures
Synthiam
January 4 2017
Bet that feels great! You did it!
January 5 2017
Great to see him come alive, even if it's so you kill him.... LOL

Your dream has come true !

Have fun,

Ron
January 6 2017
Yes, It's great to see it working and it does feel great!. However, I fully understand I didn't do it alone. Thanks for the guiding hand and assist!

@Andy, you're correct. My dream is coming true. I'm surprised you remember me saying that. Thanks.

@DJ, Next Wednesday FedEx should deliver to your office the Sabertooth/Kangaroo I shipped to you. Hopefully it won't get caught up in customs. I'm sure a plugin that will make it simple to send commands and receive feedback from the Kangaroo will be a huge help and make using this cool little pair of control boards much easier to use with EZ Builder. Thanks for considering doing this. :)
DJ Sures
Synthiam
January 11 2017
Got your kangaroo!
January 11 2017
Excellent. I was hoping there wouldn't be any issues getting through customs. The paperwork sucks and I wasn't sure if I had everything right. Thanks again for offering to do this. It's not a priority for me right now that you helped me get my script worked out. Feel free not to put it on top of your pile. However I'm looking forward to seeing what you come up with. ;)