Inverted Pendulum icon Inverted Pendulum Balancing controller for Sainsmart v3 (and compatible) robots: PID tuning, real‑time telemetry, angle offset, movement and calibration via ARC. Try it →
Japan
Asked — Edited

Setting Variables Through The Network

Hi Guys,

We are trying to set variables through the network (Telnet) on ARC, but we could not find a way to change the variables values.

Is there a way to alter variables or pass parameters to custom made scripts through the network?

Thanks Guys :D


ARC Pro

Upgrade to ARC Pro

Stay at the forefront of robot programming innovation with ARC Pro, ensuring your robot is always equipped with the latest advancements.

Author Avatar
PRO
USA
#1  

ARC is a Raw TCP Server and will accept and run valid EZ-Script sentences:

First activate the server:

User-inserted image

Then i used a windows 10 telnet client:


telnet localhost 6666

User-inserted image

As you can see (ARC window):

I managed to change/create variables and i executed MyScript1

Author Avatar
PRO
USA
#2  

BUT

From ARC:

User-inserted image

Note: bear in mind although ARC accepts Telnet clients is not a Telnet Server

Telnet is an old and well documented protocol: https://en.wikipedia.org/wiki/Telnet

and supports 7 bit clients, so when you make a connection both parties can negotiate the data transfer mode, the server can send you a data byte to negotiate or a client can actively start negotiating.

ARC is not a Telnet Server so will not start the negotiation neither will accept a client negotiation.

So if you use a full Telnet client like putty:

User-inserted image

and then you start sending EZ-Script statements:

User-inserted image

you will notice the first statement fails!

The reason is Putty (Telnet Client) engaged the Telnet Protocol negotiating by sending a control byte to the ARC Tcp Server.

ARC server waits for the End-Of-Line sequence to execute the EZ-Script statement.

So the first statement has unexpected data (telnet client control byte) and ARC will report an error.

You have few choices:

  1. send some end-of-line sequences e.g. enter (CR/LF) characters before starting the EZ-Script statements. After the first statement all the other statements were successfully executed.

  2. Use a passive negotiator Telnet Client e.g. Windows 10 Telnet. The client does not start telnet negotiating but will negotiate if the server starts the negotiation process.

  3. use a RAW tcp client application or RAW mode (putty) when connecting to the ARC TCP Server.

Author Avatar
PRO
USA
#4  

Nothing beats a shell command:)

Create a command file e.g. morning.txt


ControlCommand("Connection", Connect0)
Sleep(2000)
SayEZBWait("Hey! Sleepy heads time to wake up !")
ControlCommand("Auto Position", AutoPositionAction, "Morning Dance")

and if you have putty with plink installed.


"C:\Program Files (x86)\PuTTY\plink" -batch -raw localhost -P 6666 < c:\scripts\morning.txt

Note:

  1. because each statement is individually executed you can't use EZ-Script code structures e.g. If, Repeats, Goto etc.
  2. As you can guess you will need to trigger another script to do the disconnect.