go_away

Author Topic: Motor Commands??  (Read 1087 times)

0 Members and 1 Guest are viewing this topic.

Offline benjammin105Topic starter

  • Jr. Member
  • **
  • Posts: 37
  • Helpful? 0
Motor Commands??
« on: February 09, 2010, 11:40:04 PM »
I just got my new axon in and my first robot is coming together and nicely so far. I just ordered the sabertooth 2X5 motor controller and it should be in next week. I'm still a rookie at all of this and was wondering how I would go about giving this motor driver commands in the C language. I mean I wanna make it drive for certain distances and turn and that kind of stuff. I'm reading thru the tutorial information and didn't see anything explaining this kind of thing. Thanks!

Offline Admin

  • Administrator
  • Supreme Robot
  • *****
  • Posts: 11,663
  • Helpful? 169
    • Society of Robots
Re: Motor Commands??
« Reply #1 on: February 10, 2010, 12:12:37 AM »
If you are using WebbotLib, just look up the sabertooth commands in the manual.

For the older Axon code, do this:
http://www.societyofrobots.com/axon/axon_function_list.shtml#misc

then delay for a bit:
http://www.societyofrobots.com/axon/axon_function_list.shtml#timers

then do a different motor command.

Offline benjammin105Topic starter

  • Jr. Member
  • **
  • Posts: 37
  • Helpful? 0
Re: Motor Commands??
« Reply #2 on: February 11, 2010, 06:17:13 PM »
I wasn't using that library but I am now! I downloaded the manual and printed it and put it in a binder. This will get me thru most of my questions.Thanks!

Offline benjammin105Topic starter

  • Jr. Member
  • **
  • Posts: 37
  • Helpful? 0
Re: Motor Commands??
« Reply #3 on: February 11, 2010, 08:29:02 PM »
Another quick question...I'm looking for a way to make my robot drive for a specific amount of time before stopping and doing other actions. Would I be able to do this by using the act_setspeed command and then using delays until it has traveled the distance I need? I'm also wondering if the delays would make it stop as opposed to driving for the selected time.

Offline Webbot

  • Expert Roboticist
  • Supreme Robot
  • *****
  • Posts: 2,152
  • Helpful? 110
Re: Motor Commands??
« Reply #4 on: February 11, 2010, 08:56:33 PM »
The motors continue to work in the background. So 'yes' you could use a delay and make WebbotLib work.

However: for program design this isn't good design.

For example: what would happen if the robot hit something during that time. Perhaps it would reverse for a few seconds. Ok - but what if it hit something whilst reversing?

You really need to think about a state machine. Sounds complex - but need not be.

Webbot Home: http://webbot.org.uk/
WebbotLib online docs: http://webbot.org.uk/WebbotLibDocs
If your in the neighbourhood: http://www.hovinghamspa.co.uk

Offline Admin

  • Administrator
  • Supreme Robot
  • *****
  • Posts: 11,663
  • Helpful? 169
    • Society of Robots
Re: Motor Commands??
« Reply #5 on: February 11, 2010, 10:20:13 PM »
If you consider yourself a beginner, just work with a delay for now until you get the hang of things and the basics working.

A more fancy way to do it would be:

while(nothing_in_the_way)
   {drive_forward()}
rotate_90_degrees();//if something in the way, it turns

 


Get Your Ad Here

data_list