Welcome to Synthiam!

The easiest way to program the most powerful robots. Use technologies by leading industry experts. ARC is a free-to-use robot programming software that makes servo automation, computer vision, autonomous navigation, and artificial intelligence easy.

Get Started
Asked — Edited
Resolved Resolved by DJ Sures!

Error On Line 25: Missing String Quotes

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)


ARC Pro

Upgrade to ARC Pro

Become a Synthiam ARC Pro subscriber to unleash the power of easy and powerful robot programming

#1  
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?
#2  
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*
#35  
@DJ.... Ok that makes sense... It's strange because bump returns are a single byte while voltage and milliamp capacity are 2 byte return (high and low byte). So what's strange is that Voltage returns ok, but milliamp reads fail... They should be basically identical in what type of data they return, though... Weird
PRO
Synthiam
#36  
It's most likely that the milliamp read is generally a larger number - or who knows.

David, i made an escape "hack" on the UART, i2c and com reads in this update for you: http://www.ez-robot.com/Community/Forum/Thread?threadId=9933

Because the device is returning strange data, it "may" be visible in the ReadUart() string and introduce parsing struggles. Try it
#37  
Many thanks for taking the time to work on this with me. I'm not adverse to struggle and am enjoying this learning experance. Until I found EZ Robot 5 yrs ago I had never written a script and had no idea on how to get a servo to move or even a DC motor to move in reverse.

@DJ, telling me how binary vrs ASCii works helps me to understand a little better what is happening. I really didn't know that the binary reads are cut up into an array and the reaon sometime the ASCii Uart commands work is because they share some of the same readable characters.

What I'm trying to do with this script is to simply read a position of a carrage running on a rail as it moves and also when it finishes it's move. I have a Kangaroo X2 commanding position control and getting feedback info from an encoder attached to a motor shaft. I have this script looping, reading the position and trun it into a variable. There is a second script watching that variable and when the variable reports that the carrage has reached a certain position a second motor is safe to move and the first looping script will halt.

In real life, one motor (the one being commanded by the Kangaroo with feedback from the encoder) is moving my B9 arm out of the body of the robot on a carrage attached to a rail. Once the arm is compleatly out of the robot only then is it safe for the arm servos and DC motor to start moving it around. I need to know from the Kangaroo what position the rail systmem is in and the carrage is clear of the robot's body so it's safe to move the arm.

The Kangaroo will return the position in the following way:

Code:


1,pXXXX

The 1 is the channel the motor is running on.
The "," is just a comma.
the "P" is telling if the move is underway or completed. Uppercase for move complete and lowercase of it's seill underway.
XXXX is the actual position. On my system min position is -8 and max position is 160000. These are lines of the encoder.


Thanks to your help so far I'm able to understand that I need to use binary commands and am able to get one character. I was getting the "P" to find out if the move has been completed or is still underway. I'd really like to find a way to find out the actual position read. These are the string of numbers after the "P". in my system they could anything from -8 to 160000.

I hope that's understadable. Thanks again for the assist. I'll get that Sabertooth and Kangaroo shipedout to you in a day or so.
PRO
Synthiam
#38  
Did you try the release mentioned in my previous post?
#39  
Oh ,sorry I didn't mention that. Thanks also for doing this extra work. I'll give it a try tonight after work. I assume it should be used with the ASCII Uart commands?
PRO
Synthiam
#40  
Correct - with your previous script
#41  
I upgraded ARC with your new version. I can't tell for sure if the changes you made worked.

When I first ran the script I had trouble getting the thing to loop when called from another script and I would still get the error first mentioned if the script ran to fast. Then I changed the timing of the loop and limited how many times it ran. After a few tries I was able to get it to loop without an error. In the script there are several calls on the uart port. I'm wondering if reading the Uart port to fast or calling the looping script before it has completed running is causing the error?
PRO
Synthiam
#42  
You can't read the uart from multiple threads (i.e. different scripts) at the same time. Think about it... It's called SERIAL for a reason:D
#43  
Actually I was reading the variable with one thread that was changing in the looping script. That should work, shouldn't it?
PRO
Synthiam
#44  
Not if the variable is changed during the other script thread.

Can you not do everything in one script?
#45  
This is interesting. So, if I have a script looping and applying a different value to the same variable each time it loops, when will the value actually change globally so other scripts can see the changes? I'm also asking how long it take to have a variable value change globally once it's stated?

I can have most everything done in one script. At least the one process of moving the carriage out of the robot body and reading it's position. However once the carriage is safely out of the torso the arm animation will have to be handled by the Auto Position control. It needs to know the arm is out of the robot as soon as possible so the animation can start quickly. ;)
#46  
Yes, other scripts will see the variable change. What DJ was saying is you can't have two scripts reading the UART. But one can read it and populatr variables, and others can act when that variable changes.

Alan
#47  
OK, Everything seems to be running smoothly now. I've combined the scripts and it's running without errors. Again, I'm not sure what really did the trick, DJ's filter, working out the timing so the Uart was not being called by different scripts at the same time or combining everything in one script. Most likely, it was all of the above. Many thanks again for helping me work through this.

Here's a video of the final result:

#48  
Love seeing it all come together.

Alan
PRO
Synthiam
#50  
Bet that feels great! You did it!
#51  
Great to see him come alive, even if it's so you kill him.... LOL

Your dream has come true !

Have fun,

Ron
#52  
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 ARC. Thanks for considering doing this. :)
#54  
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. ;)