Johnny 5 Autonomous

Hi,

Is there a tutorial for the johnny 5 to move autonomously? I only see one for it to move with the use of the playstation controller. Please let me know.

Thanks

Hi here is a picture of how i have the Bot Board II set up. I uploaded the program a4wd1tst2.bas and ran it. It says for this program the “A” button is left channel throttle, “C” button is right channel throttle, and “B” is a speed and direction reset.

I have the Sabertooth Switch 1 flipped to “Off”.

When i load the program by pressing teh button “A” it just moves forward and no matter what i press afterwards it doesn’t do anything it keeps going in the same direction at the same speed. Please let me know why this is and how i can change that.

Also is there a tutorial on how to write programs in that language? or how do i make it move forward for a certain distance and return.

What are the other switches set to?

When you say “it just moves forward” do you mean both tracks or just one?
Is it going fast or slow?
Have you tried reprogramming your robot?
Do the other test programs work ok?
When you turn your robot on, are you able to press a different button? When you press buttons B or C, does the robot beep? does the button’s LED come on?
We need more info! :open_mouth:

Yes both tracks move forward. It is going fast. I haven’t done any other tests on it just that one i was just going by the tutorial. When i turn on the robot I press “A” then it starts moving forward…"B or “C” don’t do anything it just keeps goin forward at the same speed. To stop it i have to turn it off.

Switch 1 is set to Off
Switch 2 is set to Off
Switch 3 is set to On
Switch 4 is set to On
Switch 5 is set to Off
Switch 6 is set to Off

There is no beeping noise. At least I don’t hear one. The buttons LEDs do come on.

Let’s do a quick test here, if all goes well, we can find out if the problem is with the Sabertooth or the Bot Board II.

Remove the Sabertooth CH1 and CH2 from the Bot Board II, and replace them with a couple servos. Run the program and tell us what happens. Be sure to set the Bot Board II’s jumpers to VS, not 5V for that IO group.

If the program is working correctly, the servos should be centered when powered up. Then one should move slightly in one direction when you keep pressing A, and the other will move when you press C. Pressing B should center them.

Also, could you take a few more pictures so we can see more of your wiring?

Hi

I removed the Sabertooth CH1 and CH2 from the Bot Board II and replaced them with 2 servos. I set the Bot Board II’s jumper to VS instead of 5V. I then ran the program and it says Atom must be connected for Auto detection. Not sure what is wrong here. The servos however, do center after I click ‘program’.

That error message means that either the Bot Board is not connected to the computer, or there is an error connecting. You were able to program the Atom before now, so what has changed?

Are you sure that the servos center because you press ‘Program’? Do the servos move if you power up the Bot Board without being connected to the PC? It seems a little unlikely for the servos to move from a command from the PC, if it is unable to program the Bot Board.

The only thing that has changed is me setting the Bot Board II’s jumper to VS instead of 5V. Maybe the servos centered when i powered the Bot Board but alittle delayed because as soon as i powered it I clicked program so maybe that’s what happened. I attached the serial cable to the Bot Board.
When i remove CH1 and Ch2 from the board and replace it with 2 servos does the sabertooth just stay unattached? is taht all i have to do remove that and change the jumpers to VS instead of 5V?

What we are trying to get you to do is run the same rover program with the servos instead of the sabertooth. So when you press the buttons the servos should move from centered slightly each time the buttons are pressed. But we are getting ahead of ourselves a little bit. Can you program the Atom or not.

Are you sure the batteries are fully charged.

Which IDE are you using?

Have you modified the program at all? If so please post it here.

and AGAIN can you provide some more images of the boards and wiring?

At some point we need to be able to tell you to do something and ask you to report the results. Until we get to that point we are just spinning our wheels here.

Finally got it to work…thanks alot…

I am going to try and do some other programs on it don’t have much experience in this language…is there a manual or link that I can learn how to proggram the Johnny 5 or some other examples programs?

Not really. However if you post your program here we will do our best to help you if/when you have questions.

Hello!

Below is the program i have now which goes in one direction for s certain amount of time then goes in the reverse direction. I couldn’t get it to just stop and that be the end of it. But what I am trying to do now is to go forward and turn around and come back.

Can someone help?

Thanks!

'Connections
'Pin 16 Jumper to battery (VS)
'Pin 0 Left Sabertooth channel.
'Pin 1 Right Sabertooth channel.
'Pin 9 Speaker.

left_speed var word
right_speed var word

minspeed con 1750
maxspeed con 1250

left_speed = 900
right_speed = 900

low p0
low p1

sound 9, [100\880, 100\988, 100\1046, 100\1175]

main

; Numbers lower than 1500 result in forward direction.
; Numbers higher than 1500 result in reverse direction.

left_speed = (left_speed + 10) min maxspeed ;accelerates the motors
right_speed = (right_speed + 10) min maxspeed

; Send out the servo pulses

pulsout 0,(left_speed*2)   ; Left Sabertooth channel.
pulsout 1,(right_speed*2)  ; Right Sabertooth channel.
pause 500
serout 15, i38400, "#0 P1500 #1 P1500"]
serout 15, i38400, "#0 P2000 #1 P2000 T2000"]
pause 500
serout 15, i38400, "#0 P1500 #1 P1500 T2000"]
pause 500

if left_speed > 1500 then xxx

goto main

xxx:
left_speed = 1501
right_speed = 1501
END

I don’t have the 'bot board, but I’ll just make a couple observations as I’m popping through. Mod Staff: If this is utterly wrong, feel free to nuke my post and I’ll shut-up. I’ve not touched the 'bot board. Just looks pretty trivial from a 30,000ft view…

“Turning around” is pretty difficult when you don’t have any way of measuring either track rotation or compass bearing. It’s just hit and miss.

You want to rotate one track in one direction and the other in the opposite direction.

#0 P 1600 #1 P 1400 will cause the robot to turn in one direction - #0 P 1400 #1 P 1600 will cause it to turn in the other. Any number > 1500 will cause the motor (and subsequently the tracks) to move forward - any number < 1500 will cause the tracks to turn backward.

;—snip!----

; Dead Stop
serout 15, i38400, “#0 P1500 #1 P1500”]

;Move forward - the T2000 means that it will take us 2 seconds or 2000ms to go from our minimum speed of 1500uS to our maximum speed of 2000uS pulse-width.
serout 15, i38400, “#0 P2000 #1 P2000 T2000”]
pause 500

; Turn similar speed, probably to the left, and pretty quick at that…
serout 15, i38400, “#0 P1100 #1 P2000 T2000”]
pause 500

; Come to a complete stop, just to demonstrate that we can do it.
serout 15, i38400, “#0 P1500 #1 P1500”]
pause 1000
; 1000ms, I believe, aka 1sec

;Drive foward following the turn
serout 15, i38400, “#0 P2000 #1 P2000 T2000”]
pause 500

; Come to a complete stop again.
serout 15, i38400, “#0 P1500 #1 P1500”]
;— End Snip

thank you! i’ll try it out and let you know how it works out for me.

The Sabertooth does not have a really accurate clock so 1500uS may not be stopped exactly. It may be 1540 or 1485, etc. Find what works by trial and error. Once it’s found it should be pretty reliable.

That’s a good point, Jim. I use the R/C 10’s and they always want a little “trim” whether from an R/C receiver or from a servo controller.

How do i use this prog in C++ ?

The SSC-32 just uses simple text strings for control. All you need to do is open a serial port, set the port parameters (baud-rate, start/stop bits, word length), and then just send the SSC-32 commands to the serial port. You really don’t even need to do any error checking for most things. Just occasionally send the same command repeatedly until it’s time do do something different - rinse/lather/repeat. My body-worn arm controller (driven from a wireless arduino/xbee) just blasts the SSC-32 at 9600 baud pretty much continuously. Eventually the command will get through regardless of how “dirty” the “wire” is. :wink:

Anywho - point is - open a serial port, send the data, send the data, send the data, eventually close the serial port. That’s all there is to working with the SSC-32 for servo control. You can, of course, read data back from it, analog inputs, query servo position, etc. But for the sake of getting something going, just send it the data.

**