Programming Help?

We are programming with RobotC 4.x

I would like to record and use information on the Cortex. This would be anywhere between 3 or 4 sets of data all the way up to several hundred. The purpose of this would be to store vector and orientation records, so the robot knows where it is in the field. It would also need to access and use all of this information.

I am still very new to programming and do not yet know all the terms and basic ways of doing things. I have no clue how to do this and am excitedly awaiting your responses! Thanks in advance for the help!

One thing you can do is have all the data values print to the debug stream of RobotC, and then you can copy and paste those values into your code. I don’t know how to store the values automatically. I think Mr. Pearman would be a better source on this.

You might have a look at this:

I was the one who started that thread.

What I am asking is: is there a way to store information that can be accessed by the program? For instance, could it see sensor values or motor power at different times depending on what happens, and then access those ON ITS OWN later during the same autonomous period or programming skills run?

You might look at using arrays in RobotC. I think you can store data in arrays so long as you don’t turn off the Cortex. But if you cycle power, etc. you would lose that data, so it’s only good for a single, uninterrupted powered period of time.

I’m away from my usual link files, but if you google RobotC arrays and so forth, that might get you started.

Yes, but you need to be a bit more specific with the question for anyone to give you an example.

I want to treat all autonomous movement as vectors, record it, and then be able to recreate and manipulate those numbers for autonomous movement and navigation around the field.

I know how I want to do pretty much all of this except for the recording and access of the recorded vector information. That’s where I’m getting stuck.

Thanks for everyones time and effort so far!

Is it your intention to store this vector information between power cycles? In other words, are you recording the data, then using that data without ever turning off the Cortex? Or is it your intention to store the same data over a span of days or weeks, despite the fact you will be turning your Cortex on and off throughout all that time???

To store a sequence of numbers, use an array.

To store a sequence of related numbers, ie. several numbers that need to be used together, first use a structure and then use a list or array of those structures.

You can see a very old example of using structures here.

That was an old “rerun” program written in ROBOTC V2.xx before we had pointers available as far as I remember.

Saving information on the cortex between power cycles is possible using the same memory as the program is stored in, however, there are several issues to be considered when doing this. I released code to access the ROBOTC file system last year.

One of the programming challenge entries was a “rerun” program, I’m not ready to discuss that code yet (I need to fully understand it myself). That will be available in the near (2-4 weeks) future.

For a clever autonomous framework that sort of does what you want, see Joseph’s winning entry for the programming challenge. (link to the github repo in the programming challenge thread).