Award
Congratulations DJ Sures, for answering the question and has received an EZ-Credit award! Share what you have learned and create a tutorial to help others by clicking here.

Iotiny And Movement Script Controls

Assistance Requested

Help JustinRatliff with their question and receive $10 of EZ-Credit to get more robots and parts from our store. The following information was provided about their previous efforts searching tutorials for a resolution.

Product: (click to view product details)

EZ-Builder Control: (click to view manual page)

JustinRatliff claims to have checked these sources:
 
#1

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:

Code:


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?

I have found a few conversations, tutorials and activities that may help with your question. Take a look at these links. I've sorted them by what I believe to be most relevant but that is not always the case as I'm still learning.


Also, consider reviewing the Learn section for informative lessons and activities. Check it out!


#2

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

Code:


Forward(150,3500) #255 is full speed


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

#3

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

#4

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

Code:


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

#5

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?