go_away

Author Topic: Steering robot with computer, need some tips and tricks  (Read 2704 times)

0 Members and 1 Guest are viewing this topic.

Offline TomasTopic starter

  • Full Member
  • ***
  • Posts: 111
  • Helpful? 0
Steering robot with computer, need some tips and tricks
« on: March 19, 2009, 11:06:43 AM »
Hi. Im currently working on my robot, and Im thinking about having it remote controlled with my computer. I've gotten the bluetooth functioning and so on, and I am now working on the remote control software. Now I have a little problem. The robot is a hobby grade rc car, which I removed the rc part and just controlled it with the axon.

Now I want to steer the car like one does in for example computer games.

Im looking to steering the car with the letters W A S D, you know the setup. Typical gaming.

The thing is that I want to, for now, use hyperterminal to steer it. I want it center steering and reduce engine power to 0% when no controls are clicked, and center steering when neither a nor d is pressed. Now here's the problem, I want the person controlling the car to be able to press both forward and steering to one side simultaniously. I've managed to get the car going forward, backward and turning, and centering\stopping when no buttons are pushed, but I havent got turning and forward\backward at the same time. I am only able to do one at a time. Now thats pretty useless...

I think Im using the wrong concept here, anyone got a good example on how this can be done? Source code, pseudocode, anything? :)

Thanks

(Will post my source code if necassary, but I really think my angle of approach is way off..)

Offline paulstreats

  • Supreme Robot
  • *****
  • Posts: 1,381
  • Helpful? 21
Re: Steering robot with computer, need some tips and tricks
« Reply #1 on: March 19, 2009, 11:31:57 AM »
the trouble is you can only send 1 char at a time.

a couple of solution:

1)use "Q" for forward/left - use "E" for forward and right

2)use "W" and "S" for forwards/backwards. pressing W will make the robot keep moving forwards until you recieve another command. in this case you will need to use "Q" To stop the robot completely. when "A" or "D" is pressed, 1 servo slows down and the other speeds up to make it turn. press W again to carry on forwards.(maybe make it default to either the forward/backward command if a direction isnt pressed anymore)

There are a few different solutions to the problem, just find one that works the way you want it to.

Offline superchiku

  • Supreme Robot
  • *****
  • Posts: 953
  • Helpful? 5
  • cooll
Re: Steering robot with computer, need some tips and tricks
« Reply #2 on: March 19, 2009, 12:10:38 PM »
aas paulstreet said....if u want to make the bot go only lft or only right then simple keep f and g fr that...f means only left g means only right...ie(rotating)
JAYDEEP ...

IT AND ROBOTICS ENGINEER

"IN THE END IT DOESNT EVEN MATTER"

Offline offy

  • Supreme Robot
  • *****
  • Posts: 340
  • Helpful? 1
Re: Steering robot with computer, need some tips and tricks
« Reply #3 on: March 19, 2009, 05:51:55 PM »
First you need to make the strearing wheel go into ascii characters.

once you have that, you set up the pedal.
if(pedal < 100) PWM lower than if pedal is over 100 make the PWM higher. I don't know how the pedal will send out numbers of speed, but you will have to do some research on that.

Some sample code to use keys to move a robot is below (NOT MY CODE)
Code: [Select]
Defines:
// *************** Bluetooth Lights ****************
#define blue_on PORT_ON(PORTC,0)
#define yellow_on PORT_ON(PORTC,1)
#define red_on PORT_ON(PORTC,2)
#define white_on PORT_ON(PORTC,3)
void all_off(void)
{
PORT_OFF(PORTC,0);
PORT_OFF(PORTC,1);
PORT_OFF(PORTC,2);
PORT_OFF(PORTC,3);
} // end routine
// *************END BLUETOOTH Setup******************


Code (example show is for blue only , just change the letter and color for the others):

char cByte = uart0GetByte(); // get byte from UART0 on the axon
if (cByte == 'b') // if character received is b then
{
all_off(); // turn all LEDs off
blue_on; // turn only blue LED on
}

From Narobo.com (http://narobo.com/projects/electronics/bluetooth_lights/bluetooth_lights.html)

For more help I am doing this same project, well close to it.

http://www.societyofrobots.com/robotforum/index.php?topic=7387.0

Offline madchimp

  • Robot Overlord
  • ****
  • Posts: 158
  • Helpful? 2
Re: Steering robot with computer, need some tips and tricks
« Reply #4 on: March 19, 2009, 08:02:36 PM »
I don't know how you would do it with a normal keyboard but some game pads like the belkin nostromo allow you to program what happens when you push a key perhaps you could program it so when you press a key it sends w then when you release the key it could send either another w or some other key to tell it to stop moving forward.

Offline TomasTopic starter

  • Full Member
  • ***
  • Posts: 111
  • Helpful? 0
Re: Steering robot with computer, need some tips and tricks
« Reply #5 on: March 20, 2009, 03:58:50 PM »
So there isnt really any easy solution to my problem here. I'll try some of your workarounds, thanks :)

Offline Resilient

  • Full Member
  • ***
  • Posts: 111
  • Helpful? 4
Re: Steering robot with computer, need some tips and tricks
« Reply #6 on: March 20, 2009, 04:12:44 PM »
you could cook something up using wxpython or pygame pretty quickly.

Offline zozie

  • Jr. Member
  • **
  • Posts: 11
  • Helpful? 0
Re: Steering robot with computer, need some tips and tricks
« Reply #7 on: March 21, 2009, 04:51:32 PM »
IF you can give us some more details on your setup, meaning servo controller and compiler you're using I'm sure we'll be able to help you out.

Offline TomasTopic starter

  • Full Member
  • ***
  • Posts: 111
  • Helpful? 0
Re: Steering robot with computer, need some tips and tricks
« Reply #8 on: March 22, 2009, 01:26:59 PM »
I've started now just making a simple visual basic 2008 express edition application. Easy to create gui and easy to send data over bluetooth(I hope, I havent tested the function yet but I will tomorrow).

But does anyone know how I can get keyboard input from two keys at the same time in this programming language? Im, for now, just creating a simple windows application, but I've only managed it to get one keyboard input, and I've tested mostly everything google would throw at me.

This is basically what I want to do for now; if I press W and A at the same time, the variable "Input" will change to WA. Anyone know how to do this?

Thanks

Offline offy

  • Supreme Robot
  • *****
  • Posts: 340
  • Helpful? 1
Re: Steering robot with computer, need some tips and tricks
« Reply #9 on: March 23, 2009, 05:11:46 PM »
Does it have to be in VB? I know how to do this in Perl I think.

Offline paulstreats

  • Supreme Robot
  • *****
  • Posts: 1,381
  • Helpful? 21
Re: Steering robot with computer, need some tips and tricks
« Reply #10 on: March 23, 2009, 06:02:35 PM »
can you access the serial port with Perl?

 Ive used it for database traversal and manipulation but i didnt think its powers extended so far. Nor did I think you could key capture with it.

Maybe I should look into Perl a bit more rather than just use what I need (I really like the scalar variable system in Perl it takes the difficulty out of basic type management)

Offline offy

  • Supreme Robot
  • *****
  • Posts: 340
  • Helpful? 1
Re: Steering robot with computer, need some tips and tricks
« Reply #11 on: March 27, 2009, 06:55:07 PM »
Perl can capture keys, and I am 90% sure it can connect to a serial port.

Offline GearMotion

  • Supreme Robot
  • *****
  • Posts: 489
  • Helpful? 24
  • Two decades+ of Embedded Design
Re: Steering robot with computer, need some tips and tricks
« Reply #12 on: March 28, 2009, 04:16:42 PM »
Perl can capture keys, and I am 90% sure it can connect to a serial port.


Here is an example of Perl and Arduino:

http://www.windmeadow.com/node/38

Offline TomasTopic starter

  • Full Member
  • ***
  • Posts: 111
  • Helpful? 0
Re: Steering robot with computer, need some tips and tricks
« Reply #13 on: March 29, 2009, 02:42:09 PM »
Thanks for the help guys, but I've figured out most of it in visual basic. I'll probably post all my source code for my project here later when its all finished.

 


Get Your Ad Here

data_list