Compatible with firmware that counts wheel rotation for left and right wheels with wheel encoder.
How to add the Wheel Encoder Counter robot skill
- Load the most recent release of ARC (Get ARC).
- Press the Project tab from the top menu bar in ARC.
- Press Add Robot Skill from the button ribbon bar in ARC.
- Choose the Navigation category tab.
- Press the Wheel Encoder Counter icon to add the robot skill to your project.
Don't have a robot yet?
Follow the Getting Started Guide to build a robot and use the Wheel Encoder Counter robot skill.
How to use the Wheel Encoder Counter robot skill
This skill is compatible with Arduino UNO firmware that counts wheel rotation for left and right wheels.
Firmware
This robot skill requires supporting capability on the EZB with firmware. The firmware is open-source so that you can modify it for different Arduino's and microcontrollers. The Wheel Encoder Arduino UNO firmware can be found here: https://synthiam.com/Docs/Hardware/Arduino-Genuino-UnoMain Window
1. Get Wheel Values Button Manually requests the encoder values for each wheel. Please do not use it when pushing to NMS because this is done automatically with an interval timer.
2. Reset Values Button Resets the encoder values back to zero. Please do not use it when pushing to NMS because it will break the current pose.
3. Get Wheel Values & Reset Button Resets the encoder values back to zero then starts acquiring the encoder values again. Please do not use it when pushing to NMS because this will break the pose.
4. Status Display When the debug checkbox is checked, this will display a text readout of the encoder values.
Configuration
1) Poll Interval How often to poll the wheel encoder values from the Arduino.
- Display debug information This will display the wheel encoder values to the log file for debugging in real-time.
Settings - NMS
Push to NMS Enabling this checkbox will push the data to the NMS as a Level 3 Group 2 sensor. This updates the pose telemetry of the robot's positioning.
Encoder ticks per wheel revolution How many encoder ticks for one revolution of the wheel. This is used for the NMS pose calculation.
Wheel diameter (mm) The diameter of the wheel is in millimeters. This is used for the NMS pose calculation.
Pivot diameter (mm) The distance between centers of wheel treads. This is used for the NMS pose calculation.
NMS
The Navigation Messaging System (NMS) is built into the ARC framework. It allows skills to push data (location & obstacle detection) into the messaging system. Then, mapping/navigation SLAM skills can subscribe to the navigation events. The NMS was designed to provide transparent Navigation to the user in ARC. You do not have to write any complicated code because the robot skills will work for navigation and obstacle avoidance.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.
Video
Resources
The Wheel Encoder Arduino UNO firmware can be found here: synthiam.com/Docs/Hardware/Arduino-Genuino-UnoThere are ControlCommand() to reset the $LeftWheelCount & $RightWheelCount values, or force get the values on demand rather than automatic on a timer. Do not reset or manually poll the wheel count using the NMS because it will affect the current pose data.
You can see how this skill was created by watching the live hack event here: synthiam.com/HackEvent/Dj-s-5th-Live-Hack-Session-17578
Related Hack Events
Related Questions
What Is Really Needed For Indoor Navigation?
Arduino EZB Firmware To ARC Communication
Upgrade to ARC Pro
Subscribe to ARC Pro, and your robot will become a canvas for your imagination, limited only by your creativity.
YES! Very nice.
It was a post several years back about motors and wheel encoders. I believe ToyMaker and Dave were discussing it. Toymaker had motors with 64000 clicks for just one wheel revolution.
How many clicks per/revolution do you think a Arduino can handle? If this makes any sense.
That seems quite high - of 64,000 ticks per rotation. The firmware associated with this plugin counts with an unsigned 16bit integer, so the maximum count is 65535 per wheel. It would be easy to change to 32bit unsigned integer, which the maximum count would be 4,294,967,295 ticks
To see how i made the firmware and plugin, watch this live hack event here: https://synthiam.com/HackEvent/Dj-s-5th-Live-Hack-Session-17578
Unable to find the answer to this, so here it is to you guys. I have no experience encoders.
Motor add: This gear motor is a powerful 12V brushed DC motor with a 131.25:1 metal gearbox and an integrated quadrature encoder that provides a resolution of 64 counts per revolution of the motor shaft, which corresponds to 8400 counts per revolution of the gearbox’s output shaft.
Since the encoder is on the back of the motor shaft does it only read the 64 counts per revolution? How can you tell, with accuracy what the counts per revolution is at the gearbox's output shaft?
Hope this is clear?
Yah - you answered yourself in the question. The shaft on the motor spins 131.25 times per 1 revolution of the output wheel shaft. Therefore if it’s 64 counts in a motor shaft revolution, you multiple 64 by 131.25 to get 8400. So if you used this arduino firmware, every 8400 counts is one wheel rotation.
I understood all that. BUT (lol) The encoder reads the main shaft rotation (at rear) not the output shaft rotation. How does the encoder know where, lets say, count/click 8399 is at?
Does this make sense?
The encoder doesn't - you can't easily use an encoder as a servo, if that's what you're asking. If you're attempting to use a wheel encoded motor as a servo, you'd need to first initialize the position and start counting from there.
Are you asking to use a encoded motor as a servo?
Because an encoded motor is designed for odometry.. just like your car. To count the number of wheel rotations so you can increase the confidence of how far your robot has traveled for navigation purposes.
Understood
You said "To count the number of wheel rotations so you can increase the confidence of how far your robot has traveled for navigation purposes." So as I understand, if it counts the number of clicks, say 32, we know that the motor has turned half way around.
Then why would I care anything about 8400 COUNTS at the OUTPUT shaft?
It seems to me the only important number here is the counts per rotation of the rear shaft.
MMMM I'm starting to even confuse myself here ... lol.
8400 counts is the wheel turning 1 complete rotation. 4200 counts is the wheel turning half a rotation.
If your wheel radius of your wheel is 10cm, then 8400 counts would be 10 cm of travel.
16800 counts would be 20cm of travel
Some questions on this skill. Won't you need an A and B output for when it goes backwards? Won't you need to select the comport for the Arduino to have it get it's data. Maybe it's built into this skill for two encoders (could not find it) but how about when you have many encoders? I hooked up a typical encoder's A to D2 of the Arduino, 5v, gnd, B was not wired into anything and rotated the encoder by hand but did not get any changing values in the variables. Have a feeling that it needs to have the comport selected within the skill itself.
You would need to read the description of this robot skill again. It's an extension of an EZB firmware. It IS built into the firmware. The Movement Panel knows which direction the encoder is going. Although many encoders have two wires, this would benefit from supporting those types as well. You could update it for that.
Have the comport scenario figured out. Is there an update for 2 wire encoders-did not see it. Tried the encoder skill as it is now connecting properly but it gave me this feedback. "the connected device does not support the required capability to count wheel encoding. Using an Uno so would think it would have been fine.
You do not have the correct firmware. Please read the manual and follow the instructions. There’s too much for me to repeat here. Please read the manuals before posting.