go away spammer

Author Topic: Connecting two Axons  (Read 2195 times)

0 Members and 1 Guest are viewing this topic.

Offline teoxanTopic starter

  • Full Member
  • ***
  • Posts: 49
  • Helpful? 2
Connecting two Axons
« on: September 22, 2010, 09:15:26 AM »

I'm trying to find a way to connect two Axons II.

I was thinking through I2C, I need one Axon to be a slave and the other a master. Slave Axon will feed data to master Axon who will decide all robot actions.

Any suggestions?

Thanks!

Theo

Offline rbtying

  • Supreme Robot
  • *****
  • Posts: 452
  • Helpful? 31
Re: Connecting two Axons
« Reply #1 on: September 22, 2010, 09:51:30 AM »
I2C would work, definitely, it just needs a little bit of thinking to set up. 

Offline Asellith

  • Contest Winner
  • Supreme Robot
  • ****
  • Posts: 648
  • Helpful? 9
  • "I'm a leaf on the wind. Watch how I soar"
    • CorSec Engineering
Re: Connecting two Axons
« Reply #2 on: September 22, 2010, 09:53:05 AM »
I2C can work and webbotlib supports slave and master I think. I2C has a hardware issue with the ATMEGA series when used in multimaster mode so watch out for that.

To be honest it would be easier to use UART for a point to point setup like your talking about. Unless you want to add more slaves later then UART is a lot easier to code and setup.
Jonathan Bowen
CorSec Engineering
www.corseceng.com

Offline Webbot

  • Expert Roboticist
  • Supreme Robot
  • *****
  • Posts: 2,165
  • Helpful? 111
    • Webbot stuff
Re: Connecting two Axons
« Reply #3 on: September 22, 2010, 10:38:48 AM »
Its also possible to use a single UART to talk to multiple boards.
Lets say you have 4 Axons:-
Axon#1:   Receives from Axon#4, Transmits to Axon#2
Axon#2:   Receives from Axon#1, Transmits to Axon#3
Axon#3:   Receives from Axon#2, Transmits to Axon#4
Axon#4:   Receives from Axon#3, Transmits to Axon#1

So you have a 'ring' of boards on a UART network.

Then you can use a message 'packet' such as:

Byte 0 = Originator Axon ID number
Byte 1 = Destination Axon ID number
Byte 2 = number of message bytes that follow
Byte 3 = the message bytes

When a board receives a whole msg it looks to see if Byte 1 = my ID number. If not then just send the whole message on to the next Axon.
If it is for me: then don't pass the message on. If the message requires a reply then send a new message where Byte 0=me, Byte 1=Byte0 of the original msg, followed by the response.

If an Axon receives a msg where Byte0 = my ID then it means that the message has been passed the whole way around the ring - ie nobody responded (perhaps the Byte1 id is incorrect?!). In this case the msg should be removed otherwise it will keep going round and around forever.

Of course you could change Byte 1 to represent an action that the originator wants to be done. For example:
1 = Set left motor speed to the value in the 1 byte message
2 = Set right motor speed to the value in the 1 byte message
3 = Read sonar and return value
This way each board can decide if it is the one that needs to perform the action, and if not, then pass it to the next board.

EDIT: It also means that each board can be both a 'slave' (processes msgs) AND a 'master' (adds new msgs)


« Last Edit: September 22, 2010, 10:41:23 AM by Webbot »
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 Asellith

  • Contest Winner
  • Supreme Robot
  • ****
  • Posts: 648
  • Helpful? 9
  • "I'm a leaf on the wind. Watch how I soar"
    • CorSec Engineering
Re: Connecting two Axons
« Reply #4 on: September 22, 2010, 01:16:19 PM »
What kind of delay are we talking for a 2 way "conversation"? If 1 and 3 are talking I2C then it loops from 1 to 2 to 3 then 3 responds from 4 to 1. All 4 units are busy converting UART instead of avoiding objects or whatever they are suppose to be doing.

If timing isn't an issue and longer (a few extra ms) latency then I guess it would work.
Jonathan Bowen
CorSec Engineering
www.corseceng.com

Offline garrettg84

  • Robot Overlord
  • ****
  • Posts: 187
  • Helpful? 8
  • Armchair Roboticist Extraordinaire
    • http://www.garrettgalloway.com/
Re: Connecting two Axons
« Reply #5 on: September 25, 2010, 06:35:09 AM »
What kind of delay are we talking for a 2 way "conversation"? If 1 and 3 are talking I2C then it loops from 1 to 2 to 3 then 3 responds from 4 to 1. All 4 units are busy converting UART instead of avoiding objects or whatever they are suppose to be doing.

If timing isn't an issue and longer (a few extra ms) latency then I guess it would work.

Maybe set some kind of switch up so that when one bot in the loop is busy, he jumper's the connection straight through to the next in the loop...
-garrett

Offline Admin

  • Administrator
  • Supreme Robot
  • *****
  • Posts: 11,703
  • Helpful? 173
    • Society of Robots
Re: Connecting two Axons
« Reply #6 on: September 25, 2010, 01:57:01 PM »
I do Axon to Axon communication all the time, and I just use UART for it.

Its really no different than controlling a single Axon using Hyperterminal, at least in terms of code.

 


Get Your Ad Here