Go to Post So, in the good old FIRST spirit, let's all start brainstorming and sharing ideas, ok? :D - LauraN [more]
Home
Go Back   Chief Delphi > Technical > Programming > C/C++
CD-Media   CD-Spy  
portal register members calendar search Today's Posts Mark Forums Read FAQ rules

 
Reply
 
Thread Tools Rate Thread Display Modes
  #1   Spotlight this post!  
Unread 11-03-2011, 19:01
willson.thomas willson.thomas is offline
Registered User
FRC #1595
 
Join Date: Feb 2008
Location: Spokane, WA
Posts: 50
willson.thomas is just really nicewillson.thomas is just really nicewillson.thomas is just really nicewillson.thomas is just really nicewillson.thomas is just really nice
Question Task FUNCPTR Issue

I am having trouble defining a task. The code and compiler errors are below. If anyone knows what I'm doing wrong, help would be greatly appreciated!

Error:
Code:
C:/windriver/workspace/2011CompetitionCode/Arm.cpp:132: error: argument of type `int (LogomotionArm::)(LogomotionArm::ArmInitArgs*)' does not match `int (*)(...)'
Function Definition:
Code:
int InitialiseArm(ArmInitArgs *argsPTR)
	{
		while (argsPTR->armJagTask->GetForwardLimitOK())
		{
			argsPTR->armJagTask->Set(1);
			Wait(0.01);
		}
		argsPTR->armJagTask->Set(0);
		argsPTR->armPositionTask->Reset();
		argsPTR->isInitialisingTask=false;
		argsPTR->isInitialisedTask=true;
		return (int)0;
	}
Task Initialisation:
Code:
Task armInit("ArmInit",(FUNCPTR)(InitialiseArm));
		armInit.Start((INT32)(&initArgs));
Thanks!
__________________
Team Leader
Team 1595
Reply With Quote
  #2   Spotlight this post!  
Unread 11-03-2011, 19:42
demosthenes2k8's Avatar
demosthenes2k8 demosthenes2k8 is online now
Graduated but not gone
AKA: Matt Soucy
FRC #0166 (Chop Shop 166)
Team Role: Mentor
 
Join Date: Jan 2009
Rookie Year: 2007
Location: Merrimack, NH
Posts: 589
demosthenes2k8 is a splendid one to beholddemosthenes2k8 is a splendid one to beholddemosthenes2k8 is a splendid one to beholddemosthenes2k8 is a splendid one to beholddemosthenes2k8 is a splendid one to beholddemosthenes2k8 is a splendid one to beholddemosthenes2k8 is a splendid one to beholddemosthenes2k8 is a splendid one to behold
Send a message via AIM to demosthenes2k8 Send a message via Yahoo to demosthenes2k8
Re: Task FUNCPTR Issue

Team 166's Framework166 deals with this. We don't actually use the WPilib tasks, but we DO typecast our tasks into FUNCPTRs.

The main code we use is
Code:
static int MainJacket(void *this_p, int a0, int a1, int a2, int a3, int a4, int a5, int a6, int a7, int a8);
Although I can't find the actual definition of FUNCPTR, from our code it's safe to assume that your task needs to take the same inputs as the MainJacket function snippet...or at least the same types. (There are almost certainly better names for the ints)

EDIT: This old thread mentions that the task has to have int arguments...

EDIT2: I just found it:
Code:
typedef int 		(*FUNCPTR) (...);     /* ptr to function returning int */
This basically means nothing that we don't already have by now, but it's a function that takes an int and, I believe, all int arguments.
__________________


GSR Dean's List Finalist 2011

Last edited by demosthenes2k8 : 11-03-2011 at 19:53.
Reply With Quote
Reply


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


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

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