Go to Post Science and Technology is like the tide in the ocean, it raises all ships together, whether they're an engineering ship or a manual labor ship. - Doc Wu [more]
Home
Go Back   Chief Delphi > Technical > Control System
CD-Media   CD-Spy  
portal register members calendar search Today's Posts Mark Forums Read FAQ rules

 
 
 
Thread Tools Rate Thread Display Modes
Prev Previous Post   Next Post Next
  #6   Spotlight this post!  
Unread 20-02-2007, 06:09
Dave K.'s Avatar
Dave K. Dave K. is offline
Engineer/Mentor
FRC #0930
Team Role: Mentor
 
Join Date: Jan 2007
Rookie Year: 2005
Location: WI
Posts: 91
Dave K. is a splendid one to beholdDave K. is a splendid one to beholdDave K. is a splendid one to beholdDave K. is a splendid one to beholdDave K. is a splendid one to beholdDave K. is a splendid one to beholdDave K. is a splendid one to behold
Re: Radio Packet loss + closed loop control system = lunging robot

Quote:
Originally Posted by Dave K. View Post
Yes, I was suggesting setting one of the relay outputs true which should drive the pin high.

Though not directly documented, this post from IFI's forum says that the relay outputs are VHCT (logic family) output pins in series with 330 ohm resistors. This should safely drive a "Digital I/O" pin, which just has a 1k series resistor and 0.001uF capacitor to ground before it goes into the CPU's port pin.

The relay and PWM outputs are disabled by the master CPU, but the user Digital I/O pins are untouched, so one of those pins, configured as an output, couldn't be used as an indicator of the robot being disabled.

I added the disclaimer in my inital post that I had tried neither approach yet, and won't be able to do so until tomorrow. I'm reasonably certain that the relay outputs are 5V logic levels but would confirm that first.

I suspect that watching the packet number will work, and if so, I will post an example of how to do that.
Ok, I finally had time to work on this code tonight.

Both methods outlined in my first posting do work, however some additional consideration is warranted.

For the hardware method, the IFI forum posting I referred to either contains incorrect information, or outdated information... either way it isn't right.

The 'relay' outputs on the robot controller actually only source power to the outputs via a series resistor, which appears to be closer to 400 ohms than the 330 ohms referenced in the post.

Because the outputs only source, and because the OI inputs only can have a pull up resistor (in the CPU), something must be provided to pull the relay output down to create a logic zero on the digital input.

A 2K load resistor from the relay output to ground results in an ON voltage of around 4.1V. The low resistance was enough to combat the digital input pull up resistor and in my case pulled it down to under 100mV. Both of these voltage levels meet Microchips specifications for logic high and logic low inputs values.

The relay output pins are indeed 5V and can be directly connected to a digital input.



The other method I described about watching the packet_num databyte also works quite well. It is a byte wide value, and will simply count 0 to 255 and then roll over to zero again. Checking it each time a the default user code executes is an easy way to reliably check to see when packets are being lost.

Here is some code I wrote to test both of these methods of detecting packet loss, and how I made the lost packet counter visible on the operator interface.

Code:
  static unsigned int discnt = 0;
  static unsigned int discnt2 = 0;
  static unsigned char last_mode = 0;
  static unsigned char last_packet_num = 0;
  static unsigned char last_in = 0;


	if (rxdata.packet_num != last_packet_num) {
		discnt++;
		if (rc_dig_in10) {
			lost_pkts++;
		}
	}

	if (rc_dig_in10 != last_in) {
		if (!(rc_dig_in10)) {
			discnt2++;
		} else {
			lost_pkts = 0;
		}
	}


	last_in = rc_dig_in10;

	last_packet_num = rxdata.packet_num + 1;

	if (user_display_mode == 0) {
		
	} else {
		User_Mode_byte = discnt;
	}

	printf("discnt: %5d  discnt2: %5d lost: %5d\n\r",discnt, discnt2, lost_pkts);
For those that are interested in adding some additional level of protection against lunging as a result of packet loss, the information above should help you impliment something that prevents this.
__________________
--Dave
 


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
control loop frequency. Rickertsen2 Programming 1 12-01-2006 08:38
1501 Control System Basics and Analysis of a Bipedal Robot Chris_Elston Programming 1 25-12-2005 12:52
PID control loops - closed loop feedback KenWittlief Technical Discussion 56 26-04-2004 21:27
How Can You Make A Closed Loop System???? GRR_340 Pneumatics 6 21-03-2002 12:27


All times are GMT -5. The time now is 07:23.

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