Asked — Edited
Resolved Resolved by DJ Sures!

Iotiny And Movement Script Controls

Background: I'm building a small WallE with an ioTiny and non EZ-Robot servos. I have updated the firmware on my ioTiny successfully. I am using a EZ-Robot 7.4 lipo battery in my robot to power everything. Because my servos can't handle 7.4 volts I am using 5 volt regulators individually for each servo.

My Problem: In my project I added a servo Movement Panel and set the Left Wheel servo to D7 and the Right Wheel servo to D6. Everything seemed well with that as I could drive WallE around just fine.

But when I started to script some controls and I used the function "Forward( speed, milliseconds)" that's when it got buggered. For example if I used:


Forward(100, 3500)

D6 would spin full speed forward and D7 would spin hardly at all forward. It did stop about 3500 milliseconds later, so the timing part works and it was forward-ish movement. It appears to be the speed that the ioTiny has having an issue with perhaps?

Another behavior with this command once I would ran it, if I went back to use the servo Movement Panel to drive my robot, the speed would be messed up with D6 going full speed and D7 barely spinning as if stuck under the settings of the script even though the script had stopped.

To fix that particular glitch I ran the script: Forward(255, 3500) #running at max speed which sent both servos forward at full speed correctly and it unlocked my servo Movement Panel to again have the proper controls.

Forward(100, 3500) was not the only speed setting I had an issue with. I tried other speeds and had similar buggered results.

Thoughts? Is this a "Justin" problem or an ioTiny problem?


ARC Pro

Upgrade to ARC Pro

Elevate your robot's capabilities to the next level with Synthiam ARC Pro, unlocking a world of possibilities in robot programming.

#1  

100 is maybe barely enough to move a 360 servo... Try at least 150


Forward(150,3500) #255 is full speed

360 servos may need their pot to be adjusted for equal outputs when compared to each other...

#2  

@RichardR what struct me as weird is that both did not move the same speed with the Forward script. I'll give it another round of testing and keep that in mind, maybe some of my speed numbers were too low.

The speeds are weird in the sense that in the script we can set the speed from 0-255 but in the servo Movement Panel the range is 1-180 with 90 being off.

PRO
Synthiam
#3  

No the speeds are not weird with the movement script. The speeds are weird because of physical servo hardware, which moves. Physics are more complicated than a single speed digit when dealing with motors. Specifically servo motors, which have different variable speeds in opposite directions. Each of your servos are facing the opposite direction of each other, which is why the speeds are different. There’s great the robot program episodes on the adventurebot, which uses continuous rotation servos that can help you adjust speeds of your servos to move straight.

I'd do something like..


SetSpeed(100, 100)
Forward()
Sleep(1500)
Stop()

Or, i recommend using Blockly because it is a lot easier to program with than keyboards - and gives you the luxury of typing speeds into each block for each wheel.

User-inserted image

#4  

Thank you DJ I appreciate the detailed break down, that make perfect sense. You are right its not weird at all now. I was assuming "Forward(Speed)" would be agnostic of robot or locomotion.

When do you use Forward(speed, milliseconds)? Would you use it on a robot such as JD?