I am currently working on a school project using RobotC and Vex. The premise of the project is that we are building a robot to search through a destroyed building.

I was hoping to write a code section that would enable the robot to detect if signal was lost to the controller and then backtrack till it regains signal.

I would do this by keeping logs of motor output (power,duration) and checking time since the last radio signal was received. I think that I would need 2 short int. variables for each entry and the log would just roll over.

Does anyone know how much RAM the Vex controller has that I could access for this purpose?

Last edited by pingviini on Wed May 09, 2007 5:08 pm, edited 1 time in total.

Tue May 08, 2007 7:49 pm

vnguyen

Site Admin

Joined: Wed Jan 24, 2007 10:44 amPosts: 442Location: Pittsburgh, PA

Here is a link to a good page about the VEX controller. It lists all of the specs of the controller:

Use a array to hold the most recent motor positions and time. Then use an index into the array so that it can behave like a "circular buffer". Say for example, if the array has 50 entries, then it would be indexed by 0 to 49. Every time you write a new entry to the array, you increment an index value to store the item you want. If the new index value is 50 (or higher) then it has "wrapped around" and you set the index to 0.

VU has accurate posted the amount of memory available. This is not all available to user programs. Some of it is used by internal variables, stacks and buffers. The amount of memory available to user programs is found from the following entries in the file "limitDefinitionsViaDefines.h" as

From above, there is room for 100 user defined variables (each variable is 16 bits).You probably want to store the power setttings for two motors. You could define two arrays for this. Or you could pack both motor settings in a single 16-bit word since the value for each motor only ranges from -128 to +127. Here pseudo code to do this

After thinking about this for some time, I like the suggestions everybody has made.

To preface: I think that the controls to the robot will consist of the x_axis right stick and y_axis left stick. I want to limit the driver to either turning or going forward, but not both at the same time.

That way each data point would be one byte:

- first bit would indicate x-axis movement or y-axis movement
- next three bits would be encoded as { axis-movement/16 + 8 } || -127 < axis-movement < 127 ||
- the remaining bits would be the number of 250Msec ticks that the above three bits remained the same.

I would store these bytes by using an array of char's (I think the standard is >= 8 bits).

I would compress the value of axis-movement by a factor of 16.
I am going to write a quick version of this that would just control the robot directly to see how my driver reacts to loosing that much responsiveness, but I think it will be necessary to have the same input regardless if it is live datat or just being fed off the stored points.

I want to fiddle around with how often I do a data tick, but I think 250Msecs is a good start.

At the rate of 2 data points per word and with 100 words, I would get 200 data points or 50 seconds worth of data, which I think is about ideal.

Do you think that I am compressing the data too much?

Wed May 09, 2007 9:49 pm

mtl6

Rookie

Joined: Fri Nov 21, 2008 12:05 amPosts: 4

Re: On board RAM

Simple (perhaps very dumb) question: How does one declare an array in RobotC? What is the syntax?

Who is online

Users browsing this forum: No registered users and 2 guests

You cannot post new topics in this forumYou cannot reply to topics in this forumYou cannot edit your posts in this forumYou cannot delete your posts in this forumYou cannot post attachments in this forum