Shop OBEX P1 Docs P2 Docs Learn Events
RFC: Stingray/MRS1 Standard 0.01 Configuration Protocol — Parallax Forums

RFC: Stingray/MRS1 Standard 0.01 Configuration Protocol

rpdbrpdb Posts: 101
edited 2010-02-14 15:10 in Robotics
Purpose: To set a standard wiring protocol to enhance the exchange of StingRay code.

0: Left Ping
1: Center Ping
2: Right Ping
3:Wheel_Encoder_Left_A······
4:Wheel_Encoder_Left_B
5:Wheel_Encoder_Right_A
6:Wheel_Encoder_Right_B
7:Wheel_Encoder_Circuit_Enable
8:LCD
9:MemKey
10:
11:
12:
13:
14:
15:
16:
17:
18:
19:
20:
21:
22:
23:
24:Left Motor +
25:Left Motor -
26:Right Motor +
27:Right Motor -
28:
29:
30:PST
31:PST



Just an attempt to throw something out for all to think about, I would appreciate any input.

rpdb
·

Comments

  • Roy ElthamRoy Eltham Posts: 3,000
    edited 2010-02-07 02:26
    The wheel encoders should be wired as 1A, 1B, 2B, 2A. That way the grey code goess in the same direction for both wheels. Also, several of us have those on pins 8-11 and we don't really have a circuit enable with the ones we have.

    Packing everything together like that seems less desirable to me. For example, I want to have 1-2 more pings on the back of my Stingray and I'd rather they were in pins 3 and 4. So that's part of why I put the encoders on 8-11, to leave room for more ping sensors and possibly ir sensors or just bumper switches in the first bank of 8 pins.

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    Check out the Propeller Wiki·and contribute if you can.
  • SRLMSRLM Posts: 5,045
    edited 2010-02-07 03:41
    28 & 29 are EEPROM.

    Also, why do you need an encoder enable? If you're going to dedicate the pins to the encoders can't you just ignore the data if you don't want it?

    Finally, I don't think there can be much standardization on pin usage. What about wireless, bumpers, HID, ADCs, infrared (line sensors), camera, servos, gps, and other sensors? There are a plethora of choices that a user might choose from. What might be better is a clearly defined constants section (for demo code) or functions that take pin numbers (for objects).

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    Powered by enthusiasm
  • DufferDuffer Posts: 374
    edited 2010-02-07 04:31
    I think it's almost impossible to set a "standard" for pin usage of·the StingRay·or any other platform. If I remember correctly, that was tried several times for the Prop Proto board and·other dev platforms.

    I think a more usefull "standard" might be developed along the lines of what SRLM just suggested by using a standard set of named constants to be used in demo code and then leave it to each user to assign pin numbers that he/she thinks are appropriate. This·was done to some degree in the "Pings on a Stingray" code for the motor·pin pairs:·LEFT_MOTOR = 24 and RIGHT_MOTOR = 26. The same could ge done for one or more PING sensors, i.e. PING1_SIG = 0, PING2_SIG = 1, PING3_SIG = 2, etc. Using constant names from that list in demo code would greatly improve the readability and consistancy of shared code.

    Having said all that, I still think that the most important part of writing code that you intend to share is documentation and comments. For example, if you're using 10 PING sensors on your bot, the code·docs section should make it clear how the PINGs are referenced, i.e. "PING0_SIG is on pin zero and the PING sensors are numbered counter-clockwise relative to the front of the robot".

    I would also like to second Roy's suggestion for the order of attaching quadrature encoder inputs. That arrangement greatly simplifies coding in closed loop systems (and the encoders that I use don't have an enable circuit).

    Duffer

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    Any technology, sufficiently developed, is indistinguishable from magic.· A.C. Clark(RIP)
  • rpdbrpdb Posts: 101
    edited 2010-02-07 09:29
    I just noticed that many times there is no schematic and that the documentation is kind of weak, so just an idea. What do yous folks think?

    How about including a description for documentation something like this:



    ''StartStop Template.spin
    {{ These are the I/O assignments I used in this code:
    0: Left Ping
    1: Center Ping
    2: Right Ping
    3: Wheel_Encoder_Left_A       
    4: Wheel_Encoder_Left_B
    5: Wheel_Encoder_Right_B
    6: Wheel_Encoder_Right_A
    7: Wheel_Encoder_Circuit_Enable
    8: LCD
    9: MemKey
    10:
    11:
    12:
    13:
    14:
    15:
    16:Back_up_Alarm
    17:
    18:
    19:Flux_Capacitor_enable
    20:
    21:
    22:
    23:
    24: Left Motor +
    25: Left Motor -
    26: Right Motor +
    27: Right Motor -
    28: EEPROM
    29: EEPROM
    30: PST
    31: PST
    }}
    
    VAR
    
      long  cog                                  ' Cog flag/id
      long  stack[noparse][[/noparse]50]                            ' Declare stack space
    
    PUB Start(param) : okay
    {{Explain what process gets launched into a new cog.
      Parameters:
        param1 - If there is one or more parameter, explain what each one
                 represents. 
      Returns  : True (non-zero) if cog started, or False (0) if no cog is
                 available.}}
      stop
      okay := cog := cognew(CogMethod(param), @stack) + 1
    
    PUB Stop
    {{Indicate what process gets stopped; frees a cog.}}
    
      if cog
        cogstop(cog~ - 1)
    
    PUB CogMethod(param)
    
       Save this file under a new name
       Replace this method with yours
       Then, update method call in Start method
    
    
    
    


    Just another thought thrown out for discussion...

    Post Edited (rpdb) : 2/7/2010 9:43:17 AM GMT
  • WhitWhit Posts: 4,191
    edited 2010-02-07 13:28
    rpdp,

    I like the declaration idea or "description for documentation" as you call it. Let me know if you get pin 19 functioning correctly...Somethng really has to be done about my friend Marty's kids.

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    Whit+


    "We keep moving forward, opening new doors, and doing new things, because we're curious and curiosity keeps leading us down new paths." - Walt Disney
  • BocephusBocephus Posts: 58
    edited 2010-02-07 18:59
    For my own clarification, are the labels for left and right in the attached pic the same as y'all identify them?
    700 x 570 - 150K
  • DufferDuffer Posts: 374
    edited 2010-02-07 19:51
    Yes, that's correct. Left and right are based on·facing in the direction of forward travel. As a further clarification, according to the assembly instructions, the right motor is connected to the "Motor B" socket on the MSR1 board using the Blue/White·cable and the left motor is connected to the "Motor A" socket using the Green/White cable.

    Duffer

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    Any technology, sufficiently developed, is indistinguishable from magic.· A.C. Clark(RIP)
  • BocephusBocephus Posts: 58
    edited 2010-02-07 20:01
    Thanks Duffer. Then I propose what I stated in the other thread. Since p0 is the rightmost pin, it seems logical that p0 should be for the right ping.

    p0 = right_ping
    p1 = center_ping
    p2 = left_ping
  • WhitWhit Posts: 4,191
    edited 2010-02-08 00:54
    Bocephus said...
    Thanks Duffer. Then I propose what I stated in the other thread. Since p0 is the rightmost pin, it seems logical that p0 should be for the right ping.

    p0 = right_ping
    p1 = center_ping
    p2 = left_ping
    This is the way it was shown in the comments on the PingsOnStingray comments, except that the left Ping was shown on pin 3. The the Instructions for Pings on a Stingray, which says, "Left Ping to I/O pin 0, Center Ping to I/O pin 1, and Right Ping to I/O pin 2.

    I think what Bocephus shows is more logical, it will just depend on how the code is written. That is why I like the suggestion of the documentation up front in the code.


    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    Whit+


    "We keep moving forward, opening new doors, and doing new things, because we're curious and curiosity keeps leading us down new paths." - Walt Disney

    Post Edited (Whit) : 2/8/2010 5:12:10 PM GMT
  • SRLMSRLM Posts: 5,045
    edited 2010-02-08 16:15
    You should use starboard and port instead of left/right...

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    Powered by enthusiasm
  • Roy ElthamRoy Eltham Posts: 3,000
    edited 2010-02-08 17:34
    SRLM,
    This isn't a boat. :P

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    Check out the Propeller Wiki·and contribute if you can.
  • Phil Pilgrim (PhiPi)Phil Pilgrim (PhiPi) Posts: 23,514
    edited 2010-02-08 18:55
    I don't see any need for a wiring standard. The exchange of code is adequately facilitated by naming the port pins and using the names in the program, viz:

    CON 
    
      LFT_PING = 0
      CTR_PING = 1
      RGT_PING = 2
      ...
    
    
    


    To use this code with other wiring arrangements, all that have to change are the constants. A well-written program will not rely upon any assumptions about pin assignments.

    -Phil
  • BocephusBocephus Posts: 58
    edited 2010-02-08 19:11
    Phil you are right but I guess the confusion may have come from this code in the demo.

    'Read sensors
    Left := Distance[noparse][[/noparse] 1 ] * RISK_FACTOR <# Distance[noparse][[/noparse] 2 ] * RISK_FACTOR

    They use pin numbers instead of variables like Distance[noparse][[/noparse] center_ping ].
  • rpdbrpdb Posts: 101
    edited 2010-02-11 03:27
    SRLM, thats "Stjornbordt an de Poort"[noparse]:)[/noparse]

    But, I guess that why I wanted to open this thread, just to throw ideas out to see what the community thinks and to see if there is a "boat" that all could agree to be "on-board" to facilitate less confusion, or if it is .

    I like what Phil said about "A well-written program will not rely upon any assumptions about pin assignments". "LFT_PING = 0" makes perfect sense and makes the code that is then so self-documenting ie distance[noparse][[/noparse]LFT_PING] as opposed to distance[noparse][[/noparse]1], which requires checking the declarations again. Long descriptive var names instead of x=, just make reading the code almost intuitive.

    Many members of these forums are new to this stuff, myself included, so the documentation is key to helping each other out and encouraging sharing of code samples.

    Andy Lindsay gave me the start/stop template during an educators class for propellers and said it was the Parallax recommended method for an object declaration to control its own cogs methods. I added the I/O assignments for this forum to incite discussion.

    How about,
    CON
    LFT_PING := 0
    CTR_PING := 1
    RGT_PING := 2
    { := 3
    := 4
    }
    FLUX_CAP := 5
    Other_Stuff :=6 ..30
    ........ :=31
    'End CON

    Just another idea. That way I would know what other sensors I/O you have used on your bot that I dont have on mine and what to comment out.

    Not a law or rule, but an agreed method of documentation then? A protocol of documentation.

    There, did I beat that dead horse dead yet?????

    Post Edited (rpdb) : 2/11/2010 3:32:08 AM GMT

  • CannibalRoboticsCannibalRobotics Posts: 535
    edited 2010-02-12 00:35
    Phil,
    you read my mind - the reason for the starboard and port designation is that no matter what way you are facing in the boat, the sides are still the same. It's used for aircraft too. But isn't a Stingray an animal submarine, a type of organic boat?
    I digress...
    For number designations I have some comments:
    0) I agree that it's hard to come up with conventions for a device designed as a prototyping tool.
    1) This one has been bothering me for a while. We all use the term 'pin' which is wrong. "Port" assignments and "pin" numbers do NOT line up, and they are different across the packages. On a 40 pin DIP port 15 is pin 20 and on a Q44, port 15 is pin 16. I think the term port should be more widely used and placed in the code. The CON statement "rx_pin = 1" has two possible meanings Port 4 or Port 0. The term 'pin' should be limited to circuit discussions.
    2) No matter what the assignment convention, ports should all be called out in the CON section of the top object so if a port assignment changes, it only needs adjustment in one place.

    my $0.02

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    Signature space for rent!
    Send $1 to CannibalRobotics.com.
  • WhitWhit Posts: 4,191
    edited 2010-02-12 15:15
    SRLM said...
    You should use starboard and port instead of left/right...

    Is there some simple way to remember which is which, for us landlubbers?

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    Whit+


    "We keep moving forward, opening new doors, and doing new things, because we're curious and curiosity keeps leading us down new paths." - Walt Disney
  • John AbshierJohn Abshier Posts: 1,116
    edited 2010-02-12 15:35
    Port has 4 letters. Left has 4 letters so port=left. Port wine is red. Starboard is green.

    John Abshier
  • Chris SavageChris Savage Parallax Engineering Posts: 14,406
    edited 2010-02-12 16:32
    I guess I'm coming into this late...I must have missed th thread. Perhaps some weren't aware but we have been replying in a few threads regarding some of these concerns and are within days of actually taking time out to make adjustments where needed to correct issues reported by customers since the release of the Stingray. That said, there are a few things I wanted to reply to.

    Regarding the PING))) demo...that demo was written by an engineer as an example for the UPEW and was never released to the public. Changes were made to hardware later and that code was not updated, however some customers requested it and got the original, unedited copy floating around. It was never intended to be that way so it wasn't typical of our release code.

    Regarding pin assignments...the wheel encoders will most likely connect to the pins immediately below the ones driving the H-Bridge. This has always been my intention and if there is no other reason not to this will remain. We have bigger plans...we have only to implement them all.

    Thanks for your feedback. Best regards,

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    Chris Savage

    Parallax Engineering
    ·
  • WhitWhit Posts: 4,191
    edited 2010-02-12 18:49
    John Abshier said...
    Port has 4 letters. Left has 4 letters so port=left. Port wine is red. Starboard is green.
    John, Now I will never forget it! Sorry, but my mind needs these sorts for devices...

    Who says you can't teach an old dog new tricks!

    I see red and green LEDs in my Stingray's future.

    @Chris - I can't wait to see what is coming!

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    Whit+


    "We keep moving forward, opening new doors, and doing new things, because we're curious and curiosity keeps leading us down new paths." - Walt Disney

    Post Edited (Whit) : 2/12/2010 6:57:40 PM GMT
  • DufferDuffer Posts: 374
    edited 2010-02-12 21:07
    Then there's "Red, Right, Returning" Handy if you ever decide to set up a pathway or channel to a beacon for your BOT.
    Duffer

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    Any technology, sufficiently developed, is indistinguishable from magic.· A.C. Clark(RIP)
  • Phil Pilgrim (PhiPi)Phil Pilgrim (PhiPi) Posts: 23,514
    edited 2010-02-12 22:18
    CannibalRobotics said...
    the reason for the starboard and port designation is that no matter what way you are facing in the boat, the sides are still the same.
    ... unless it's a double-ended ferry, then port and starboard (along with the nav lights) change, depending on which direction it's going.

    -Phil
  • John AbshierJohn Abshier Posts: 1,116
    edited 2010-02-12 22:19
    Red, right, returning is not a world wide convention. In Fiji and Australia it was green on right on return. You would think that this would be a world wide standard, but it is not.

    John Abshier
  • rpdbrpdb Posts: 101
    edited 2010-02-13 05:32
    Who left the Halibut on the poop-deck anyway?

    Three cheers for a stingray forum mateys..HAZAAH...HAZAAH...HAZAAH!!!!!
  • CannibalRoboticsCannibalRobotics Posts: 535
    edited 2010-02-14 15:10
    OK, I think my teenager must be influencing this - every time a convention is stated, there is always someone in the back of the room that stands up and says 'not necessarily' and begins the discussion of practices of the tribesman in Borneo.

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    Signature space for rent!
    Send $1 to CannibalRobotics.com.
Sign In or Register to comment.