PDA

View Full Version : Foam Dart Turret PC Control



MadBot
06-08-2017, 02:16 PM
Anyone has some sample how to pull the trigger on the foam dart kit via USB?

There's plenty of Arbotix demo code to control servos and send packets, but I'm not seeing much on the Geekduino/arduino kit.

Basically I want to pull http://learn.robotgeek.com/getting-started/29-desktop-roboturret/159-robotgeek-foam-dart-gun-getting-started-guide.html#wireAuto from PC, w/o a push button

It'll be mounted on this http://www.trossenrobotics.com/roboturret-w-vision-tracking

I'm interested in any some sample that shows:


How to craft the com packet to send via USB, what's the protocol info?
How to listen for this on the Arduino board and run the routine.
How to listen for debug code on the PC side
How to find the correct port connected to the bot?


Also it seems like the kit is using proprietary software, which's why I'm having difficulties checking out source code. I wished there's a git repo showing:

How to cycle through targets?
How to dynamically train new target recognition?
How to crop the target as jpg/bmp for additional processing?


I'd be happy to know if the above is even doable.


Thanks in advance

jwatte
06-08-2017, 02:31 PM
Do you know how to use Serial.available() and Serial.read() to check for data from the host computer?
What language are you using on the host computer? Do you know how to open and talk to a serial port on the host computer?
Once you know these two things, it should be simple to wire those two bits together with the code to actually actuate the trigger when the right command is received from the host serial port.

MadBot
06-08-2017, 02:43 PM
Prefer C# but will do Java, python as a last resort.

I never communicated directly on serial port yet, but don't think it'll be a problem. What message should I send? Where's the spec for the protocol to talk to the board? It sounds easy, I just hadn't done it, so need hand holding. This is also not HTTP, with 10 Zillion different examples how to send one on the net..

Would like to know how to specify the id to move and the angle. Or is this a case of make one up?

Thanks for the quick response.

jwatte
06-08-2017, 07:17 PM
What message should I send? Where's the spec for the protocol to talk to the board?

I don't know if the board has a built-in protocol. It looks to me like an Arduino compatible board, where you run your own sketch. Thus, the Serial object will receive whatever bytes you send from your computer.

Thus, you would change the code in the sketch that says "if the button is held down, then trigger the trigger" to instead say something like:


if (Serial.available() && (Serial.read() == 'x')) {
trigger the trigger
}


Your PC would then send the character "x" to trigger.

MadBot
06-15-2017, 06:18 PM
I think I got you. Was hoping I can somehow keep to higher level programming model. Thanks for the help!