Asked
Resolved Resolved by DJ Sures!

Javascript Command Servo.Releaseall(2); Also Shuts Down Uart 1 And 2

I would like to confirm if this is proper behavior or a bug.

After many hours of testing I have come to believe that the following Javascript command to release all servos on EZB board #2 also shuts down Uart 1 and 2.

Servo.releaseAll(2);

The fact that my Kangaroo motor controllers attached to Uart 1 and 2 on my #2 EZB will not respond after running  certain scripts has been driving me crazy. It took me a lot of troubleshooting hours of trying almost every combination of tricks I could think of then having to restart the robot each time until I finally stumbled across that removing the above command keeps the mentioned Uarts alive.

If this is normal behavior? I would understand it being so as these Uarts are connected through the same digital pins that servos can use. If so, perhaps a mention in the manual or the API help section would be helpful and save someone a lot of time.  Maybe I just missed it if it is.

At the very least this journey in troubleshooting these scripts for the reason my Uarts would stop to respond has really aided me in learning Javascript! LOL.;)

Thanks in advance!



Related Hardware (view all EZB hardware)
EZ-B V4 by EZ-Robot
EZ-B v4/2 robot controller: dual Cortex ARM, Wi-Fi, audio/video, 24 servo/digital ports, I2C/UART, camera and Synthiam ARC control for custom robots
Wi-Fi / USB
Servos 24
Camera
Audio
UART 3
I2C
ADC 8
Digital 24

Related Robot Skills (view all robot skills)
EZB Connection by Synthiam
Connects EZ-B I/O controllers to ARC via COM or IP (5 connections). Supports init scripts, battery monitoring, TCP/EZ-Script server and serial/I2C.
EZB Connections by Synthiam
Add and manage up to 255 EZ-B I/O controller connections in ARC, select COM/IP ports or device addresses to connect or remove devices.
Sabertooth Kangaroo by Dimension Engineering
Movement panel enabling Kangaroo & Sabertooth encoder-based speed/velocity control, UART/PC serial options, tuning and encoder setup.

ARC Pro

Upgrade to ARC Pro

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

Author Avatar
PRO
Canada
#9  

Indeed, you're on the right track with your thinking, Dave. If you want to release a specific subset of servo ports without affecting others (such as UART ports), you can indeed write a JavaScript snippet to selectively release only the servos you're interested in. This approach allows you to avoid the unintended side effects of using Servo.releaseAll() which, as you've discovered, can impact other functionalities tied to the digital pins.

Here's an example of how you might write such a script in JavaScript to release a specific set of servo ports:

// Define an array of servo ports you want to release
var servoPortsToRelease = [0, 1, 5, 7]; // Example ports

// Loop through the array and release each specified servo
servoPortsToRelease.forEach(function(port) {
    Servo.release(port, 2); // Assuming you're targeting EZ-B index #2
});

In this script, servoPortsToRelease is an array containing the ports of the servos you wish to release. The forEach loop iterates over this array, and for each port number in the array, it calls Servo.release(port, 2); to release that specific servo on EZ-B board #2.

This method gives you fine-grained control over which servos are released, allowing you to preserve the state of your UARTs or any other functionalities you don't want to be affected.

Remember, the second parameter in Servo.release(port, 2); specifies the EZ-B board index, so adjust it according to which board you're working with.


I am a customer support GPT-powered AI and still learning. If you have doubts about my response, please use the support documentation to verify my answer.