Go to Post Inaccurate data is not data. It's guessing. - George1902 [more]
Home
Go Back   Chief Delphi > Technical > Programming
CD-Media   CD-Spy  
portal register members calendar search Today's Posts Mark Forums Read FAQ rules

 
Closed Thread
 
Thread Tools Rate Thread Display Modes
  #1   Spotlight this post!  
Unread 30-06-2009, 22:50
daltore's Avatar
daltore daltore is offline
Electronics/programming/design
AKA: Aaron Osmer
FRC #3529 (ausTIN CANs)
Team Role: Mentor
 
Join Date: Dec 2007
Rookie Year: 2007
Location: San Antonio, TX
Posts: 272
daltore has a spectacular aura aboutdaltore has a spectacular aura aboutdaltore has a spectacular aura about
Send a message via AIM to daltore Send a message via MSN to daltore Send a message via Yahoo to daltore
What are RobotC tasks?

I've been glancing through the RobotC Includes, and I can't find any typedefs for "task". Is a task a modification in the compiler that handles it by default, or is it defined somewhere?

Also, does anyone know if it's possible to use functions in RobotC that return data (instead of just a void or a task, which are the only ones they have listed under C Constructs).

Thanks for any information you can offer, I'm trying to learn this well enough to teach confidently to a class full of kids in a couple of weeks, and it's slight dissimilarities to C are getting to me...

Aaron
  #2   Spotlight this post!  
Unread 30-06-2009, 23:13
ttldomination's Avatar
ttldomination ttldomination is offline
Sunny
no team
Team Role: Mentor
 
Join Date: Mar 2007
Rookie Year: 2007
Location: Roanoke, TX
Posts: 2,066
ttldomination has a reputation beyond reputettldomination has a reputation beyond reputettldomination has a reputation beyond reputettldomination has a reputation beyond reputettldomination has a reputation beyond reputettldomination has a reputation beyond reputettldomination has a reputation beyond reputettldomination has a reputation beyond reputettldomination has a reputation beyond reputettldomination has a reputation beyond reputettldomination has a reputation beyond repute
Re: What are RobotC tasks?

Dear Aaron,

I'm not sure exactly how much Java you know, but RobotC resembles Java on a great scale.

I'm not entirely sure of the tasks issue you're having as I have not worked with tasks myself.

And you definitely can create a function to return data. Generally, I used return data functions to do conversion for FTC joystick controls, but the way to do it is

int functioname (int a)

where the first 'int' is the type of data you are returning.
the 'functioname' is the name of the funciton
and the second 'int' is the type of data you are inputting.
and the 'a' is the name of the data you're inputting (for the particular function)

To return the value, in the function block, just type 'return b'

Where b is some value whose type matches the output type you set the function to.

Hope that helps. PM me for more.
__________________
1261: 2007-2012
1648: 2013-2014
5283: 2015
  #3   Spotlight this post!  
Unread 01-07-2009, 08:25
daltore's Avatar
daltore daltore is offline
Electronics/programming/design
AKA: Aaron Osmer
FRC #3529 (ausTIN CANs)
Team Role: Mentor
 
Join Date: Dec 2007
Rookie Year: 2007
Location: San Antonio, TX
Posts: 272
daltore has a spectacular aura aboutdaltore has a spectacular aura aboutdaltore has a spectacular aura about
Send a message via AIM to daltore Send a message via MSN to daltore Send a message via Yahoo to daltore
Re: What are RobotC tasks?

Yeah, that's the standard C way of returning values, just didn't know if it worked or not (haven't had time to reload the firmware on my VEX robot and do debugging yet). Thanks for letting me know!

After doing a little bit of research, it looks like they have extensively modified the compiler to slim it down. For one thing, there's no pointers, which is a standard C concept available in all real C compilers. This leads me to believe that they have built "task" into the compiler itself and not declared it anywhere. Oh well, I was just wondering if I could find its declaration to figure out its properties a little better (i.e. why you have to use StartTask() and StopTask() instead of just calling it like a function).

After modifying and compiling a fairly complex program I wrote in WPILib and then in Default code onto RobotC, it looks like most of the standards work except for pointers. It gave me a warning about embedding a command inside an if statement ( if( (wheel[0] = forward+...)>127) ), so I'll have to make sure that it works.

And something that's rarely done in C, but does have to happen occasionally is that multiple C files are included into the project via #include "..." (instead of just headers). You just have to include the other C files into the main project file. Is this just a limitation of the trial version, or something inherent to RobotC as a whole? Just curious, I like to know as much about a programming language/environment as I can before I start teaching it to other people.

Thanks for the information!
Aaron
  #4   Spotlight this post!  
Unread 01-07-2009, 08:53
Greg McKaskle Greg McKaskle is offline
Registered User
FRC #2468 (Team NI & Appreciate)
 
Join Date: Apr 2008
Rookie Year: 2008
Location: Austin, TX
Posts: 4,751
Greg McKaskle has a reputation beyond reputeGreg McKaskle has a reputation beyond reputeGreg McKaskle has a reputation beyond reputeGreg McKaskle has a reputation beyond reputeGreg McKaskle has a reputation beyond reputeGreg McKaskle has a reputation beyond reputeGreg McKaskle has a reputation beyond reputeGreg McKaskle has a reputation beyond reputeGreg McKaskle has a reputation beyond reputeGreg McKaskle has a reputation beyond reputeGreg McKaskle has a reputation beyond repute
Re: What are RobotC tasks?

I'm not a RobotC expert, but I believe tasks are for asynchronous activities, for multitasking. If you call a function, the current one doesn't proceed until the called one returns. If you start a task, then the current function and the new task will multitask in parallel. C doesn't have this as a language notion. It is added with libraries and is often performed with fork() or a similar function which will have #includes defining it. If the file compiles with StartTask() in it, then it is inherent in the language or the default compile includes are broad enough to include the file that defines it. I suspect it is inherent.

The warning about the assignment is probably just making sure that you meant to use = versus ==. This is a common mistake and is hard to see when simply looking at code. So I think the compiler supports the code as written, but wants to warn you that you have an assignment embedded in an expression.

Greg McKaskle
  #5   Spotlight this post!  
Unread 01-07-2009, 08:59
daltore's Avatar
daltore daltore is offline
Electronics/programming/design
AKA: Aaron Osmer
FRC #3529 (ausTIN CANs)
Team Role: Mentor
 
Join Date: Dec 2007
Rookie Year: 2007
Location: San Antonio, TX
Posts: 272
daltore has a spectacular aura aboutdaltore has a spectacular aura aboutdaltore has a spectacular aura about
Send a message via AIM to daltore Send a message via MSN to daltore Send a message via Yahoo to daltore
Re: What are RobotC tasks?

Wow, thank you, that was very helpful!
Closed Thread


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
Periodic Tasks Luke Pike NI LabVIEW 1 04-02-2009 01:14
RobotC tasks ratcateme Programming 1 07-11-2008 00:58
ROBOTC - Controller ShawnHanna Programming 1 30-01-2008 20:20
First logo and tasks Denman Rumor Mill 21 19-04-2005 11:32


All times are GMT -5. The time now is 01:13.

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