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 CochranRobotics!

Converting A String To Integer In Ez Scripting

I am using the plug in for the XV-11 Lidar. The output of the plug in an array in which each value is a string that represents the distance at the angle and the signal strength. To use this for control of the robot, I need numbers at these angles. The format is shown in the attached example. How do I parse and convert this in EZ Scripting into an integer?

In C there is the string.split command


and then the string to integer convert.

Is there a way to do this in the EZ scripting?

User-inserted image


Upgrade to ARC Pro

Synthiam ARC Pro is a cool new tool that will help unleash your creativity with programming robots in just seconds!

I could have it register as something like 4000 if there is no returned value. Let me think on that a bit.

I pushed a version that sets the variable to something outside of the range of the LIDAR if the LIDAR doesn't return a value(5000) for that angle. Also, it runs a bit faster now and starts the LIDAR automatically when the com port is activated or when the plugin loads.

This should prevent the first cycle of data from being off as by the time you start the LIDAR, the first set of data has already tried to be passed from the Get Surreal to the computer, but the port isn't open until you click the Start LIDAR button.
Ok. Thanks. That should show at least a virtual wall or boundary if the Lidar does not see an object at that angle.
@David, I just got home, been a long day. I will try it in a few. Thanks
@David, I am win7 loaded new project install Lidar plugin and set to com2 4096 and it is working. Thanks,

Question, I need help watching the variables. At the top it has type, size, and value.

I have many 500s and 600 orate for value, nothing In type. How do I see angles?

Thank you for fixing
Right after typing my last post my Lidar stop turning and my pic said device not connected, going to down load the getsurreal drive, and try again
The angle is the item of the array.

$LIDARDistance[0] would be for the value for angle 0
$LIDARDistance[1] would be for the value for angle at 1 degree

The distances you are seeing would be something at about 19 1/2 inches from the LIDAR.

The distance value / 25.4 should give you the inches at that angel.
yea, it sounds like it is an issue with the com port. I bet if you install the Teensy Serial Driver you would be okay. You might need to uninstall the existing Teensy driver before installing it again.
It could also be the cable I suppose. I use a 1.5 foot cable. It is pretty heavy grade for a usb cable. I have run it before with a much longer (10 foot) cable without any problem though. This was from a powered usb hub.
Uninstalled com2 drive, download your for the Lidar sub serial driver, opened ARC changed to c8 saved and it locked up.

Rebooted pic still locking up, ugh! Am I the only one running win7?

Any suggestions thanks
Ok no luck. Getting real frustrated now calling it a night I got a headache and I'm tired look into it tomorrow thanks David
One more quick thing David I'm not mad at you I'm just frustrated because it's been running for a long time with the version 2-18 date I believe it was. *confused*
Not a problem. I am going to send you a version that will tell us exactly what it is doing when it locks up. I will make it tomorrow and send it your way. I'll call you to walk you through getting it in place to run.
Not being able to duplicate the issue makes it really tough to figure out what is going on. Get some rest. I had one of those days yesterday.
@David, I believe my Lidar control is the issue, not sure. Normally when I start my pc the Lidar starts turning, now it does not. Have you had to replace you USB controller on your Lidar. I ask be cause list night when I swapped sub cables I noticed it was pretty hot.

Anyway I welcome your invitation to have a look if you can tonight.

Note to self, never work on my robot when you have hard day at work. Lol:D

Thanks David for all your hard work for this community.
An interesting note...
Last night I let the lidar plugin run while my computer went to sleep. This morning I did have a locked up ARC. I suspect that if the com port has an issue it is locking up ARC.

I will look at catching that and making it report an error.

The replacement of the controller was due to me flashing it with some dev code that I really didnt want to loose. It is interesting that yours was hot. I haven't experienced that. Can you make sure that the part that is between the lidar connections and the teeny board isnt making contact with the teensy board? This is a voltage regulator with a heat sync. I want to make sure that it isnt shorting out something.

Also, the teensy board can be removed. Under it there is a diode and a pull up resistor. Make sure that those are soldered well. You can do this from the bottom of the board without removing the teensy device.

You should also make sure that there isnt any solder bridges on the teensy or on the connectors on the bottom of the board. I did verify a few weeks back that these are hand made. It is possible that there could be a solder bridge between a couple of the ports.
Hey David. I ordered another controller version 1.2 just in case so you might wait until I get in to see if it's working or not thanks
Okay. I should still be checking for com port issues anyway. I will put this off until the weekend probably though.