Go to Post Remember to have fun! That's what the FIRST experience should be for you- a lot of fun while doing a lot of learning. - smurfgirl [more]
Home
Go Back   Chief Delphi > Other > FIRST Tech Challenge
CD-Media   CD-Spy  
portal register members calendar search Today's Posts Mark Forums Read FAQ rules

 
View Poll Results: What do you think of samantha?
Love it 6 12.00%
Like it 16 32.00%
Neatral 9 18.00%
Dislike 7 14.00%
Hate 12 24.00%
Voters: 50. You may not vote on this poll

 
 
Thread Tools Rating: Thread Rating: 6 votes, 5.00 average. Display Modes
Prev Previous Post   Next Post Next
  #28   Spotlight this post!  
Unread 12-01-2011, 08:05
NalaTI NalaTI is offline
Registered User
AKA: Alan
FTC #2848 (Techno Guards)
Team Role: Mentor
 
Join Date: Dec 2008
Rookie Year: 2005
Location: California
Posts: 106
NalaTI is just really niceNalaTI is just really niceNalaTI is just really niceNalaTI is just really nice
Re: [FTC]: Samantha? Like it or hate it?

Quote:
Originally Posted by Random Dude View Post
It's actually not specifically a samantha issue. The same thing can (and does) happen over bluetooth, and even potentially direct USB tether (if one were to pull the cable out). The joystick.c template fails to get any packets from the controller, and just assumes the values should remain the same. (instead of entering a failsafe mode)
It doesn't need to be in the template. You can write your own and include it in your code. An example that could work is below.

Note that if the Samantha does keep sending the last packet, this won't work. But do we know for sure this is the case?

There's another problem I've seen occasionally that looks like a Samantha issue but isn't. If the I2C bus disconnects for a moment, it doesn't always re-attach correctly and thus the last message sent to the is continuously active. RobotC doesn't seem to have a means to verify and/or reset communication to the controllers programatically. That would be something that would REALLY help the issue.

Part of the complaining about Samantha is probably valid, but often it's the "newest thing" syndrome. When something doesn't work, the automatic blame goes to the newest thing. Even if the real issue has been there all along, or is something else.



Here's an idea for comm loss monitor code:
Code:
#include "JoystickDriver.c"

int nLastMessageCount = -1;
// This variable is used to keep a comparison copy of the message count

int nLastSysTime = 32767;
// this variable is used with the sSysTime system timer variable
// to create a pseudo up time counter.  Because it wraps automatically,
// that timer has an issue with a couple specific times. But since
// precision accuracy isn't required, it will still work for this purpose

bool CommOK()
{

    if (nLastSysTime < nSysTime) nLastSysTime = nSysTime;

    // The previous line handles the timer wraparound issue
    // in this one case, the delay before notification 
    // goes to a max of 3 Seconds if there's no comm.
    // I could have used a timer if we need the accuracy, but
    // there's only 4 of them and this way I don't use one up.

    // the variable ntotalMessageCount is defined and updated in
    // the joystickDriver.c file


    if (nLastMessageCount != ntotalMessageCount) // has there been a new comm?
    {
      nLastMessageCount = ntotalMessageCount; // update the comparison comm ID
      nLastSysTime = nSysTime;                 // update the comparison time

    } else {  // there has not been a new message

      if (nSysTime > nLastSysTime + 1500) return false;  
      // the previous line says that if our pseudo timer gets
      // to a second and a half, we've had no messages, and thus
      // comm is not OK.

    }
    return true; // if we get to here without returning false, comm is OK
}

task main()
{

  while(true)

  {

    while (!CommOK())
    {
      // Handle Comm (joystick message) failures here.
      // might be stuff like "motor[motorA] = 0;"
      wait1Msec(1);
    }
    wait1Msec(1);
  }

}
__________________
Reply With Quote
 


Thread Tools
Display Modes Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
[FTC]: Samantha instructions Sasha FIRST Tech Challenge 12 20-07-2012 19:02
[FTC]: Samantha issues at VCU FRC/FTC workshops - how to fix cybiko123 FIRST Tech Challenge 3 13-12-2010 13:18
[FTC]: Samantha Problems greendog99 FIRST Tech Challenge 2 03-12-2010 22:39
[FTC]: samantha johncap100 FIRST Tech Challenge 4 01-11-2010 21:25
[FTC]: FTC Samantha Unit Setup With WRT610N robotic321 FIRST Tech Challenge 0 21-10-2010 15:23


All times are GMT -5. The time now is 03:58.

The Chief Delphi Forums are sponsored by Innovation First International, Inc.


Powered by vBulletin® Version 3.6.4
Copyright ©2000 - 2017, Jelsoft Enterprises Ltd.
Copyright © Chief Delphi