Asked
Resolved Resolved by Athena AI!

Wheel Encoder Skill

Hi Athena,

I am experiencing difficulty loading the necessary library onto my Arduino Uno to ensure compatibility with the Wheel Encoder Counter Skill in Synthiam ARC. I have successfully loaded the "Servo.h" library, but I am unable to find the "SendOnlySoftwareSerial.h" library. Could you please guide me on where to locate the "SendOnlySoftwareSerial.h" library? This appears to be the issue preventing me from utilizing the Wheel Encoder Counter Skill effectively.

Thank you,
Jack


Related Hardware Roli Rover
Related Control Wheel Encoder Counter

ARC Pro

Upgrade to ARC Pro

Experience the transformation – subscribe to Synthiam ARC Pro and watch your robot evolve into a marvel of innovation and intelligence.

PRO
Canada
#1  

Hello Jack,

To use the Wheel Encoder Counter Skill with your Arduino Uno, you need to ensure that all necessary libraries are correctly installed. The SendOnlySoftwareSerial.h library is not a standard library included with the Arduino IDE, so you'll need to download and install it manually.

Here's how you can do that:

  1. Download the Library:

    • You can find the SendOnlySoftwareSerial library on GitHub or other Arduino library repositories. Here's a direct link to the GitHub repository: SendOnlySoftwareSerial GitHub.
  2. Install the Library:

    • Once you've downloaded the library, open the Arduino IDE.
    • Go to Sketch > Include Library > Add .ZIP Library....
    • Select the downloaded ZIP file of the SendOnlySoftwareSerial library.
    • The library should now be installed and ready to use.
  3. Include the Library in Your Sketch:

    • In your Arduino sketch, make sure to include the library at the top of your code:
      #include <SendOnlySoftwareSerial.h>
      
  4. Upload the Firmware:

    • Ensure that your Arduino Uno is connected to your computer.
    • Select the correct board and port from the Tools menu.
    • Upload the sketch to your Arduino Uno.

Once the library is installed and the firmware is uploaded, you should be able to use the Wheel Encoder Counter Skill in Synthiam ARC effectively. If you encounter any further issues, feel free to ask for more assistance.

For more detailed instructions on setting up the Wheel Encoder Counter Skill, you can refer to the Wheel Encoder Counter Skill documentation.

Let me know if you need any more help!

Best, Athena


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.
#2  

Hi Athena, I followed your provided link to GitHub.  I pressed the Green "CODE" button and found only the "AltSoftSerial-master" zipfile.   I didnot find the SendOnlySoftwareSerial.h file.  I have loaded the "AltSoftSerial-master" zipfile into the library for the Arduino Sketch.  When compiling the sketch an error is noted advising me that the "SendOnlySoftwareSerial.h file is still missing.   Where can I find the "SendOnlySoftwareSerial.h file? Thank you for your continued support. Jack

#3  

Hi Athena, I found the "SendOnlySoftwareSerial.h" Zip by googling it.  It is now loaded onto the UNO.   I am having trouble getting the Wheel Encoder Counter to work on ARC.  I followed the following steps:

"How to Use Wheel Encoder Counter Download the Arduino firmware onto a UNO (or edit for your Arduino version). The Wheel Encoder Arduino UNO firmware can be found here: https://synthiam.com/Docs/Hardware/Arduino-Genuino-Uno

Connect your wheel encoders to port D2 (left wheel) and D3 (right wheel) on the UNO.

Add the Wheel Encoder Counter Skill (Project -> Add Skill -> Navigation -> Wheel Encoder Counter). Two script variables will now be created that hold the wheel encoder values for each wheel, respectively ($LeftWheelCount & $RightWheelCount). Or, you can enable the NMS checkbox in the configuration settings to push the pose to NMS as a Level 3 Group 1 sensor.

Connect the UNO to ARC."

I have accomplished all the above tasks except the last one.  How do I "Connect the UNO to ARC"? Thanks Jack

#4  

Hi Athena, I am stuck connecting my UNO to ARC.  I have followed the steps in using the Connection Skill and cannot activate COM3 (arduino UNO).

Can you please help Connect the UNO to ARC?  The ARC manual examples appear different and I wonder if I am following the proper procedure.   Thanks Jack

#5   — Edited

Hi Athena, I have discovered the following code that allows ARC to read an Arduino input via UART(0).   It follows and is written in EZ-Script.  Could you please help by rewriting this in JavaScript?

EZB Code

 :loop
 Send a request for data to the arduino
 uartwrite(0, 0, "a")
 wait a bit for the data to be transmitted
 sleep(50)
 $dataAvail = UartAvailable(0, 0)
 IF ($dataAvail != 2)
 print("The arduino didn't send us anything. Exiting")
 halt()
 ELSE
 UartReadBinary(0, 0, 2, $encoders)
 print("Encoder A: " + $encoders[0]) print("Encoder B: " + $encoders[1])
 ENDIF
 sleep(100)
 goto(loop) 

Thanks. Jack

PRO
Canada
#6  

Hello Jack,

Let's convert the provided EZ-Script code into JavaScript for use in ARC. Here's how you can achieve the same functionality using JavaScript:

// Initialize UART on port 0 with a baud rate of 9600
UART.initHardwareUart(0, 9600);

function loop() {
    // Send a request for data to the Arduino
    UART.hardwareUartWriteString(0, "a");

    // Wait a bit for the data to be transmitted
    sleep(50);

    // Check if data is available
    var dataAvail = UART.hardwareUartAvailable(0);

    if (dataAvail != 2) {
        print("The Arduino didn't send us anything. Exiting");
        return; // Exit the loop
    } else {
        // Read 2 bytes of data from the UART
        var encoders = UART.hardwareUartRead(0, 2);

        // Print the encoder values
        print("Encoder A: " + encoders[0]);
        print("Encoder B: " + encoders[1]);
    }

    // Wait before the next loop iteration
    sleep(100);

    // Call the loop function again
    loop();
}

// Start the loop
loop();

Explanation:

  • UART Initialization: The UART.initHardwareUart(0, 9600); initializes the UART on port 0 with a baud rate of 9600.
  • Data Request: The UART.hardwareUartWriteString(0, "a"); sends a request to the Arduino.
  • Data Availability Check: The UART.hardwareUartAvailable(0); checks if data is available.
  • Data Reading: The UART.hardwareUartRead(0, 2); reads 2 bytes of data from the UART.
  • Loop: The loop() function is called recursively to continuously check for data.

This JavaScript code should work similarly to the EZ-Script you provided. Let me know if you need further assistance or if there's anything else you'd like to explore!

Best, Athena


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.
#7  

Hi Athena, Thank you for responding.  The JavaScript code you provided does not read the sample Arduino code it is supposed to read as per the example in the Online Manual.  It responds only as" "The Arduino didn't send us anything. Exiting".   I have verified the wiring as per the Online Manual.  My encoders are outputting correctly as verified from another Arduino sketch. From the Online Manual, I have pasted the following:

Use Arduino for Wheel Encoder Counter Have your Arduino count motor encoder rotations. Connect the Arduino to your EZ-B UART #0 port to send the encoder counts. Last Updated: 5/26/2016

 // just reading the encoder, nothing else.
 int encoderValue_A = 0; int encoderValue_B = 0;
 void setup() {
 Serial.begin(9600);
 pinMode(2, INPUT); pinMode(3, INPUT);
 attachInterrupt(digitalPinToInterrupt(2), countA, FALLING);
 attachInterrupt(digitalPinToInterrupt(3), countB, FALLING); }
 void loop() {
 // if there is data to read, read it if (Serial.available() > 0) {
 // read the incoming data from the ezb
 int incomingByte = Serial.read();
 // command 'a' means transmit the current values and reset the counters
 if (incomingByte == 'a') {
 // send the values
 Serial.write(encoderValue_A);
 Serial.write(encoderValue_B);
 // reset the values
 encoderValue_A = 0;
 encoderValue_B = 0;
 }
 }
 void countA() {
 encoderValue_A++;
 }
 void countB() {
 encoderValue_B++;
 } 



The JavaScript you provided above seems to be an accurate interpretation of the EZ script in the Online Manual. Is it possible that the provided Example of Arduino code in the Online manual is outdated and will not run due to it's last Rev in 2016?  I am simply trying to replicate the example for Arduino to EZB4 communication over UART by following the Example in the Online Manual.

Could you please provide an Example that will run? Sincerely, Jack