element14 Community
element14 Community
    Register Log In
  • Site
  • Search
  • Log In Register
  • Community Hub
    Community Hub
    • What's New on element14
    • Feedback and Support
    • Benefits of Membership
    • Personal Blogs
    • Members Area
    • Achievement Levels
  • Learn
    Learn
    • Ask an Expert
    • eBooks
    • element14 presents
    • Learning Center
    • Tech Spotlight
    • STEM Academy
    • Webinars, Training and Events
    • Learning Groups
  • Technologies
    Technologies
    • 3D Printing
    • FPGA
    • Industrial Automation
    • Internet of Things
    • Power & Energy
    • Sensors
    • Technology Groups
  • Challenges & Projects
    Challenges & Projects
    • Design Challenges
    • element14 presents Projects
    • Project14
    • Arduino Projects
    • Raspberry Pi Projects
    • Project Groups
  • Products
    Products
    • Arduino
    • Avnet & Tria Boards Community
    • Dev Tools
    • Manufacturers
    • Multicomp Pro
    • Product Groups
    • Raspberry Pi
    • RoadTests & Reviews
  • About Us
    About the element14 Community
  • Store
    Store
    • Visit Your Store
    • Choose another store...
      • Europe
      •  Austria (German)
      •  Belgium (Dutch, French)
      •  Bulgaria (Bulgarian)
      •  Czech Republic (Czech)
      •  Denmark (Danish)
      •  Estonia (Estonian)
      •  Finland (Finnish)
      •  France (French)
      •  Germany (German)
      •  Hungary (Hungarian)
      •  Ireland
      •  Israel
      •  Italy (Italian)
      •  Latvia (Latvian)
      •  
      •  Lithuania (Lithuanian)
      •  Netherlands (Dutch)
      •  Norway (Norwegian)
      •  Poland (Polish)
      •  Portugal (Portuguese)
      •  Romania (Romanian)
      •  Russia (Russian)
      •  Slovakia (Slovak)
      •  Slovenia (Slovenian)
      •  Spain (Spanish)
      •  Sweden (Swedish)
      •  Switzerland(German, French)
      •  Turkey (Turkish)
      •  United Kingdom
      • Asia Pacific
      •  Australia
      •  China
      •  Hong Kong
      •  India
      •  Japan
      •  Korea (Korean)
      •  Malaysia
      •  New Zealand
      •  Philippines
      •  Singapore
      •  Taiwan
      •  Thailand (Thai)
      •  Vietnam
      • Americas
      •  Brazil (Portuguese)
      •  Canada
      •  Mexico (Spanish)
      •  United States
      Can't find the country/region you're looking for? Visit our export site or find a local distributor.
  • Translate
  • Profile
  • Settings
EZ-EV Challenge
  • Challenges & Projects
  • Design Challenges
  • EZ-EV Challenge
  • More
  • Cancel
EZ-EV Challenge
Forum DockBot - Part 6 - The Mostly Open Closed Loop Control
  • News
  • Projects
  • Forum
  • DC
  • Leaderboard
  • Files
  • Members
  • More
  • Cancel
  • New
Join EZ-EV Challenge to participate - click to join for free!
Actions
  • Share
  • More
  • Cancel
Forum Thread Details
  • Replies 0 replies
  • Subscribers 58 subscribers
  • Views 34 views
  • Users 0 members are here
  • design challenge
  • EZ-EV
  • Arduino Q
Related

DockBot - Part 6 - The Mostly Open Closed Loop Control

arvindsa
arvindsa 18 hours ago

I am building a robotic system that identifies the charging port on an EV and automatically moves a charger arm to plug the charger in.

Past Forum Posts:

  • DockBot - Part 1 - The Concept
  • DockBot - Part 2 - Positioning with Aruco Markers
  • DockBot - Part 3 - New Plan, New Hardware for Better Sensing
  • DockBot - Part 4 - Getting the Arduino Q to move the tank motors
  • DockBot - Part 5 - The Mechanical Hand

I wanted to have a proper closed loop control of my motors using an magenetic encoder TLE5012 which i have in surplus but I did not get the ordered diametrical magnets in time. So i had to do yet another work around. Use the Aruco marker as a sensor, move the robot incrementally, correct the motors. and repeat till the target. Sounds Simple. But Nooope.

Motor Calibration. Take 1

The idea was simple, run one motor at a known PWM speed for a small time, see how much the robot turns, through aruco marker, then incrementally increase and see the difference. Then the opposite direction. Left one worked out fine, but right one never turned on. It seems that while the left one started at PWM 84/255 duty, the right one started only at 184/255. This caused the right motor to never start in the calibration algorithm I made. Also, i noticed a fundamental flaw, the smaller bursts meant the tracks were slipping on my floor, and there was not enough time for it to stabilize the slipping. So this idea had to be junked

You don't have permission to edit metadata of this video.
Edit media
x
image
Upload Preview
image

Motor calibration, take 2

I decided to just junk auto calibration, and went the cannibal way. I decided to use constant motor speeds one set speed for each of forward, reverse, rotate left and rotate right. I kept tracking the motion and manually adjusted the speed 

You don't have permission to edit metadata of this video.
Edit media
x
image
Upload Preview
image

If you noticed, there was a slight flutter in the marker due to the ceiling fan's air current. This did create some issues. So i decided to make it more robust by creating a cube out of cardboard.

image

The tank now wears a small cube with a marker on each face - back, top, left, right - instead of the single (actually two) rear marker from before. The point is that whichever face happens to be pointed at the camera, something is always trackable, even when it rotates, not just when the tank is driving directly away from it. Now, I never managed to get multi point tracking working, you will see that i had to resort to some hand adjustment of the robot, but with time I can get it fixed.

Actually approaching a target: three wrong designs first

The Radxa's camera is fixed - mounted separately. It is not mounted on the robot. I wrote something that would spin the tank until the target marker was centered in the camera frame, the way you'd steer if the camera were on the robot's. Since the camera doesn't move when the robot spins, and the target doesn't move either, the target's position in the frame  - never changes no matter what the robot does. The script just spun in place for forty steps, learning nothing. The fix: infer heading from how the robot's own marker position shifts in the frame, sampled before and after a small forward nudge. That nudge does double duty - it's both the heading measurement and real progress toward the goal, so nothing is wasted purely on sensing.

heading = (rx1 - rx0, rz1 - rz0)   # where the robot's own marker moved
bearing = (goal_x - rx1, goal_z - rz1)   # where the goal is from here
angle = signed_angle_deg(*heading, *bearing) * turn_sign

Second wrong design: I started the approaching using raw pixel calulation. But I moved from raw pixel positions to real millimeters via cv2.solvePnP, which has a sign convention of its own - --turn-sign that worked for the pixel-only version was backwards for the mm version, and this caused the robot to move away from the target by making an u Turn.

Third: close to the target's marker isn't the same as "in front of it." solvePnP gives you the marker's own facing direction, not just its position - I'd been computing distance to a point, not distance to a pose. Fixed by projecting a goal point along the target's own facing normal, sampled once at startup since the target is static, rather than the marker's raw position.

You don't have permission to edit metadata of this video.
Edit media
x
image
Upload Preview
image

Final Notes

Once these were fixed, the robot became tamed, There were many fine tuning steps in between but they are not very educative. Now to the final step of Getting the Charging Handle to a car and also before that Improve the accuracy.

  • Sign in to reply
  • Cancel
element14 Community

element14 is the first online community specifically for engineers. Connect with your peers and get expert answers to your questions.

  • Members
  • Learn
  • Technologies
  • Challenges & Projects
  • Products
  • Store
  • About Us
  • Feedback & Support
  • FAQs
  • Terms of Use
  • Privacy Policy
  • Legal and Copyright Notices
  • Sitemap
  • Cookies

An Avnet Company © 2026 Premier Farnell Limited. All Rights Reserved.

Premier Farnell Ltd, registered in England and Wales (no 00876412), registered office: Farnell House, Forge Lane, Leeds LS12 2NE.

Follow element14

  • X
  • Facebook
  • linkedin
  • YouTube