
castlephelps

Now that I have part of Wiggins (my robot arm's name) built with multiple motors and multiple sabertooth/kangaroos all of which are being driven by digital ports on EZ-B and speech recognition via bluetooth headset configured on the computer... I am not using a movement control, only things like Horizontal servo which configured will move a kangaroo controlled motor from 0 to 180. The kangaroo is Teach Tuned to drive left and right from 0 to 360 degrees and the feedback is a 10 turn potentiometer on the pinion of the gear motor.
What I want is to tell Wiggins to turn left a certain number of degrees, for example. So the swivel for Wiggins' arm is a single gear motor driven pivot that rotates 360 degrees and is controlled by a Horizontal servo control so that it moves the full 360 degrees using the 0-180 on the control. Is there a control that turns left and right 180 degrees?
What I want is to be able to tell Wiggins to move a discrete variable distance. For example," Wiggins - rotate left 32 degrees". Or "Wiggins - rotate to 090".
One of these is movement from the current position and then left 32 degrees. The other is to rotate to a constant location.
How do I do this?
Seriously I would use larger "chunk" like commands... for instance right 1deg, 5deg, 10deg, 30deg, 60deg, 90deg, etc.... same for the left...
So say you need 96deg left (from centre)... you say "rotate left 90" then in a second voice command say "rotate left 5deg" and lastly in a third command say "rotate left 1 deg"... total 96deg left...
Your script would set the direction and distance that you want to move and perform the action if there is a valid value in $moveingdirection and $movedistance. It could also set a variable of say $moving to indicate that the motor is moving until it reached its location. From there, you would clear the variables and wait for the next command.
It will be a pain to put in all of the entries into the speech recognition control, but these can be entered once and then used for other things also.
Would it be asking too much for some sample EZ-Script to get me started?
Castle
A couple of other things that I would do...
disable speech recognition when your robot is speaking (done through the script)
disable speech recognition when the robot is moving. You may want to incorporate a button that can be pressed as an emergency stop that could be hooked up to a digital port and monitored. When pressed, the digital port would go to high for example, and the movement script would send a stop command to the Kangaroo.
I look forward to the sample script - I'm still struggling with how to get a spoken command to interface with a Horizontal servo control in my ARC project - so something beginner would be appropriate -sorry for the need for all the handholding...
Castle
The project is called For castlephelps
You may want to store the previous position, do some math based on the request, and determine the location the arm needs to be in, then store this value in the previous position variable.
You could also read the pot through analog but I think it is tied to the Kangaroo in your solution, so probably just storing as a variable and using it to calculate what position to tell the motor to go to from the previous value + or - the distance you want to move from the command (determined by left or right) would work fine for you.
In the init script, I would add something like this
Code:
to move the arm to the center as an initialization process.
In the movemotor script you would add something like this under either the left or right condition depending on how the motor works.
under left if statement
Code:
under right if statement
Code:
Ron R
Ron R
Just a thought.
Ron R
This all looks great / I have a lot to learn - for example I don't know how to find the For castlephelps project you posted...I have been heads down foing mechanical and wiring stuff on Wiggins all day. I hope to be working with your code tomorrow - here's a photo of my progress.
Castle
Wow, you really lost me on that one. I looked back through this series of answers to my question and thread #12 lists For castlephelps. There is nothing to click on that I can find anywhere. Can you be a bit more specific about where I would find this?
I could not find a thread titled For castlephelps. Where should I be searching?
Thanks,
Castle
In the same manner, you could also put the words "Hundred", "Twelve", "Thirteen", "Twenty", "Thirty" etc. to be able to say "One Hundred Twenty" "Fifty Seven" etc as the words to be recognized to give it all a more natural sounding tone. With the same pauses between the words.
If neither of those ideas appeal to you, I can at least save you a lot of typing. I have a program I used a while back to extract the entries in the Speech Recognition control and present them in a grid for modifying as desired. Additionally, it can save that same data to a text file, as well as load from a text file. Finally, it can save that data back into an EZB project file. I could whip up a quicky routine to automatically create a text file with all the numbers from 0 to 180 in the proper format for importing into my program, and then into an EZB file so as to show up in the project's Speech Recognition control.
If you post your current project with your current Speech Recognition control, I can download it and add whatever you already have in the control and merge it with the number data. My program can even alphabetize the whole thing (or only a part) if you like. It can then put it into your project file which I can upload for you to download. Let me know. Shouldn't take more than a day or two to do.
I have now arrived at the point where I need to learn how to pull it all together and write the scripts to do what I want.
So right now my next task is to connect speech recognition to a servo control then doing what we have been discussing in this thread will be added and then what you propose would be added. So I have some baby steps to take...
You guys are way beyond me but I will get get there! Now knowing I can do what I want (as illustrated in this topic discussion) is fantastic! Now to pull it together...
Thank you,
Castle
You really need to first play with a simple servo. Make a new project and add the servo (horizontal or vertical). Be sure to go to a tutorial to learn about it. Clicking the gear goes to the setup, the "?" gives information.
Once you get that working and understand, you can mess with below:
Here it a start on speech control.
1 Set up your ezb with one servo connected to D0.
2 Set up speech recognition.
3 click on the gear
4 in the blank space on the bottom left, write move to a
5 in the blank space next to that on the right type servo (D0,90)
enter
6 on the new line left, write move to b
7 on the right type Servo(D0,120)
enter
(I hope I didn't forget anything)( if I did, go to the tutorial to check)
connect the ezb and test and play using verbal commands to move the servo.
You need to use the "?" over the commands you want to play with.
examples.. I get reminded of this often.
By doing this experiment, you can see how this works. YOU MUST consider speed issues because with the massive arm, you will need to control the maximum speed.
Use the tutorials and all the information everyone has given you to go further.
I always test small and on the bench before moving to the actual robot or device.
Ron R
The init script is used to setup the variables that would be used in other sections. I have changed the project to fire the init script when you connect to the EZ-B.
Also, it now centers the arm and tells people to stand clear of the arm before doing so. This is to give you a starting point. The speech recognition control is disabled during this process
To modify its behavior, you would modify the script control called Init by clicking on the gear button on this control.
The next thing to do is to speak to the robot. These actions are handled through the Speech Recognition control. You can see a list of the commands and make modifications to the speech recognition phrases by clicking on the gear in the speech recognition control.
You will see that I have added 4 phrases as examples for you. They are
Wiggins Turn Left
Wiggins Turn Right
Wiggins Won
Wiggins To
The Won and To are the phonetic representations of 1 and 2.
These phrases are what the robot listens to.
The Wiggins Turn Left command looks like this
Code:
This code sets a variable that is used later by a different script.
It then turns off Speech Recognition
It asks a question of how far would you like the arm to move
Then it turns on Speech Recognition.
The robot would then be waiting for the answer to the question that it asked.
Here is the Wiggins Won script
Code:
The first thing it does is makes sure that the first variable i mentioned is set and then sets a different variable for how far the robot needs to move. It then starts the MoveMotor script.
You can modify the commands for the recognition text by clicking the row in the command column to the right of the phrase that you want to modify. A pencil button will show up. Click it to show the entire script for that item.
The script manager is a control that I like to used to keep the number of windows in a projects far fewer. The script manager allows you to have many scripts in a single control. There is one script right now called MoveMotor. You can see what it contains by clicking Edit.
Code:
First it turns off speech recognition.
Then it sees if the arm still thinks it is moving from a previous command.
Then it checks to see if you told it to move left or right
This is where you would add your code to move your servos. Right now, I just have it speaking to you.
Something like
Code:
You may also decide to use the GetServo option which doesn't read from the servo but pulls the information that is stored in an object in the ARC code that tracks what it thinks the servo's location is. Really, this option and that one do the same thing.
Once the motor starts moving, the variable $moving should be set. The script waits 10 seconds (this could be replaced with some math based on how far you told it to move) and then sets the $moving variable back to "" so that the robot knows it isnt moving anymore and is ready for the next command. It then enables speech recognition so you can give it another command.
I found something that I missed that I should have put in there. Between the $moving = "" and the ControlCommand line, I would add this...
Code:
This will clear the variables that are used earlier in this process and to help prevent the robot from running crazy when someone comes in and says Wiggins To without you first telling it to move.
I hope this explanation helps to understand what is happening with the project.
Open ARC
In the area called EZ-Cloud App Store click Open
Setup the selection criteria as shown in this image and then click open on the first item in the list.
Thank you very much!
Castle
I have had success getting the sabertooth/kangaroo working with servo Controls to drive the large motors to behave as servos successfully with both potentiometer and encoder feedback so I know that mechanically and manually (just sliding a Horizontal servo control left and right makes the arm swing. So the code examples you have provided will go a long way to automating this and using speech to move Wiggins!
Thank you again - I look forward to getting Wiggins to come to life with you help! I guess the best way to correspond is thru this thread?
Castle
A test unit at home will be nice to prove out your designs. Have fun.
Ron R
Castle
Are you taking the pictures with an iPhone? Everyone I know who uses one has this problem. The Metadata embedded in the photos clearly screws up the orientation info. (My wife's Mac also messes up pictures from my Android but my PC's don't).
Alan
I feel kind of embarrassed that my photos aren't coming out straight...
Castle
EDIT As to the photos, you could flip them before sending them so they will come out right on this end.
Ron R
This is great information! I will definitely reconstruct the model with your ideas as I test out code when the EZ-B arrives hopefully next week. Sorry for the noise but I am uploading one of my photos of Wiggins that I rotated. I'm curious to see if it comes out correctly. It is a photo taken with my iPhone 6+ and I have rotated it 90 degrees to the right (clockwise). Let's see if it comes out right side up. Again, sorry for the bandwidth.
Castle
Again, sorry for the bandwidth.
Castle
Here is a script example I have to open the hand on my Roli. It is triggered as long as I am holding down a key on my joystick or the O key on my keyboard. If the of the servo goes above 90, it does nothing.
Code:
Alan