Go to Post Robotic Football now thats something I would build 6 weeks for. - Nikkocharger [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 04-10-2010, 22:48
flameout flameout is offline
AKA Ryan Van Why
FRC #0957 (SWARM)
Team Role: Alumni
 
Join Date: Sep 2009
Rookie Year: 2009
Location: Oregon
Posts: 168
flameout is a name known to allflameout is a name known to allflameout is a name known to allflameout is a name known to allflameout is a name known to allflameout is a name known to all
Several questions (language comparison)

Our team (well, I, as our only veteran programmer) is trying to decide on the language to program the robot in next year. While thinking this over, I have come up with several questions.

Please correct me if I'm wrong in these questions.

In the C++ WPILib, is there a way to set thread priorities? I believe it can be done in both LabVIEW and Java.

What about UDP communication? I know LabVIEW contains primitives, but is this doable in Java and C++?

Is there some sort of event handling available? Could I, for example, run a section of code whenever a new image is available from the camera, or run a section of code when a digital input changes without polling?

I'll post more questions when I can think of them.

Thank you for any help.
  #2   Spotlight this post!  
Unread 04-10-2010, 23:07
AustinSchuh AustinSchuh is offline
Registered User
FRC #0971 (Spartan Robotics) #254 (The Cheesy Poofs)
Team Role: Engineer
 
Join Date: Feb 2005
Rookie Year: 1999
Location: Los Altos, CA
Posts: 803
AustinSchuh has a reputation beyond reputeAustinSchuh has a reputation beyond reputeAustinSchuh has a reputation beyond reputeAustinSchuh has a reputation beyond reputeAustinSchuh has a reputation beyond reputeAustinSchuh has a reputation beyond reputeAustinSchuh has a reputation beyond reputeAustinSchuh has a reputation beyond reputeAustinSchuh has a reputation beyond reputeAustinSchuh has a reputation beyond reputeAustinSchuh has a reputation beyond repute
Re: Several questions (language comparison)

I can help answer one or two of your questions, and hopefully someone else can step in to fill in any gaps in my answers and answer the other questions.

Quote:
Originally Posted by flameout View Post
In the C++ WPILib, is there a way to set thread priorities? I believe it can be done in both LabVIEW and Java.
There is a way. At the very least, you can call the vxWorks calls and set the priority. I don't know the exact commands off hand though.

Quote:
Originally Posted by flameout View Post
What about UDP communication? I know LabVIEW contains primitives, but is this doable in Java and C++?
It's very doable in C++. We've done it... If I remember right, we used standard UNIX sockets, and it just worked.
  #3   Spotlight this post!  
Unread 04-10-2010, 23:14
flameout flameout is offline
AKA Ryan Van Why
FRC #0957 (SWARM)
Team Role: Alumni
 
Join Date: Sep 2009
Rookie Year: 2009
Location: Oregon
Posts: 168
flameout is a name known to allflameout is a name known to allflameout is a name known to allflameout is a name known to allflameout is a name known to allflameout is a name known to all
Re: Several questions (language comparison)

I'll look up VxWorks calls. Any additional help on this would be appreciated.

Any clue if all of the standard library is available? I don't have the software environment set up (I'm on Linux here) so I can't test anything.

Thank you for your help.
  #4   Spotlight this post!  
Unread 04-10-2010, 23:30
Radical Pi Radical Pi is offline
Putting the Jumper in the Bumper
AKA: Ian Thompson
FRC #0639 (Code Red Robotics)
Team Role: Programmer
 
Join Date: Jan 2010
Rookie Year: 2010
Location: New York
Posts: 655
Radical Pi has a spectacular aura aboutRadical Pi has a spectacular aura aboutRadical Pi has a spectacular aura about
Re: Several questions (language comparison)

Quote:
Originally Posted by flameout View Post
In the C++ WPILib, is there a way to set thread priorities? I believe it can be done in both LabVIEW and Java.
Use the class Task. In the constructor: Task("myTask", function, priority), where function is a pointer to the thread's main and priority is thread priority (100 is default). Call Start with any arguments to the main function to start the task.

Quote:
Originally Posted by flameout View Post
What about UDP communication? I know LabVIEW contains primitives, but is this doable in Java and C++?
vxWorks implements the socket system in C++. You can see how it's used in the CANJaguar SpeedControl example or in Vision/PCVideoServer.cpp (the former copy-pasted the latter)

Quote:
Originally Posted by flameout View Post
Is there some sort of event handling available? Could I, for example, run a section of code whenever a new image is available from the camera, or run a section of code when a digital input changes without polling?
I don't have the exact code in front of me, but I can push you in the right direction on how to do this. Team 639 used a rotating kicker and had a IR sensor that pulsed a Digital Line whenever the kicker reached a certain angle.
Any class that inherits from InterruptableSensorBase (That means DigitalInput, but not AnalogChannel) can interrupt the code. I think the code was somewhere along the lines of this:

Code:
DigitalInput *sensor;

void InterruptFunction() {
//do stuff here
}

Init() {
//blah
sensor = new DigitalInput(1);
sensor->RequestInterrupts( (tInterruptHandler)InterruptFunction);
sensor->EnableInterrupts();
//blah
}
I'm unsure of the line with the RequestInterrupts function, other than that I'm sure of everything.

No idea if an equivalent exists in Java
__________________

"To have no errors would be life without meaning. No strugle, no joy"
"A network is only as strong as it's weakest linksys"
  #5   Spotlight this post!  
Unread 05-10-2010, 08:48
flameout flameout is offline
AKA Ryan Van Why
FRC #0957 (SWARM)
Team Role: Alumni
 
Join Date: Sep 2009
Rookie Year: 2009
Location: Oregon
Posts: 168
flameout is a name known to allflameout is a name known to allflameout is a name known to allflameout is a name known to allflameout is a name known to allflameout is a name known to all
Re: Several questions (language comparison)

Okay, so I think I'm starting to get a better idea of this.

I guess I'll have to install WindRiver to look at more documentation -- I cannot find those interrupt functions in the WPILib user's guide, and they do not have the same names as the VxWorks ones.

Thank you for the help.
  #6   Spotlight this post!  
Unread 05-10-2010, 17:56
Radical Pi Radical Pi is offline
Putting the Jumper in the Bumper
AKA: Ian Thompson
FRC #0639 (Code Red Robotics)
Team Role: Programmer
 
Join Date: Jan 2010
Rookie Year: 2010
Location: New York
Posts: 655
Radical Pi has a spectacular aura aboutRadical Pi has a spectacular aura aboutRadical Pi has a spectacular aura about
Re: Several questions (language comparison)

The interrupt functions aren't in the documentation. We had to figure out how to use them ourselves
__________________

"To have no errors would be life without meaning. No strugle, no joy"
"A network is only as strong as it's weakest linksys"
  #7   Spotlight this post!  
Unread 05-10-2010, 18:09
flameout flameout is offline
AKA Ryan Van Why
FRC #0957 (SWARM)
Team Role: Alumni
 
Join Date: Sep 2009
Rookie Year: 2009
Location: Oregon
Posts: 168
flameout is a name known to allflameout is a name known to allflameout is a name known to allflameout is a name known to allflameout is a name known to allflameout is a name known to all
Re: Several questions (language comparison)

For now, we only have one computer usable (i.e. a laptop other than the Classmate) for programming the robot, but it is running Linux.

Therefore, I'll probably (I'm still very undecided about all this) suggest Java. I'm willing to use my laptop as the team's programming laptop, if I can get NetBeans installed.

I'll start working on it soon.

Thank you.
  #8   Spotlight this post!  
Unread 05-10-2010, 21:53
Ether's Avatar
Ether Ether is offline
systems engineer (retired)
no team
 
Join Date: Nov 2009
Rookie Year: 1969
Location: US
Posts: 8,101
Ether has a reputation beyond reputeEther has a reputation beyond reputeEther has a reputation beyond reputeEther has a reputation beyond reputeEther has a reputation beyond reputeEther has a reputation beyond reputeEther has a reputation beyond reputeEther has a reputation beyond reputeEther has a reputation beyond reputeEther has a reputation beyond reputeEther has a reputation beyond repute
Re: Several questions (language comparison)

Quote:
Originally Posted by Radical Pi View Post
Team 639 used a rotating kicker and had a IR sensor that pulsed a Digital Line whenever the kicker reached a certain angle.
Why did you need an ISR to handle this? Was 20ms not fast enough?



  #9   Spotlight this post!  
Unread 05-10-2010, 22:46
Radical Pi Radical Pi is offline
Putting the Jumper in the Bumper
AKA: Ian Thompson
FRC #0639 (Code Red Robotics)
Team Role: Programmer
 
Join Date: Jan 2010
Rookie Year: 2010
Location: New York
Posts: 655
Radical Pi has a spectacular aura aboutRadical Pi has a spectacular aura aboutRadical Pi has a spectacular aura about
Re: Several questions (language comparison)

Quote:
Originally Posted by Ether View Post
Why did you need an ISR to handle this? Was 20ms not fast enough?
Our kicker rotated and launched outward when the kick button was pressed. The rotations were at an extremely high speed. To prevent the kicker from coming out at an unpredictable and generally unfavorable angle, we used the sensor as an interrupt to make sure the kicker could come out at a predictable angle. As the speed of the rotator increased, the range of angles for a good kick decreased, so the room for error in the timing of the code wouldn't allow for timing of the kick to occur in the main loop. The interrupt checks a flag for whether to kick, and also will delay the kick as needed to compensate for the speed of the kicker (without the extra timing code, the kicker only works around 75% power)
__________________

"To have no errors would be life without meaning. No strugle, no joy"
"A network is only as strong as it's weakest linksys"
  #10   Spotlight this post!  
Unread 05-10-2010, 23:07
Ether's Avatar
Ether Ether is offline
systems engineer (retired)
no team
 
Join Date: Nov 2009
Rookie Year: 1969
Location: US
Posts: 8,101
Ether has a reputation beyond reputeEther has a reputation beyond reputeEther has a reputation beyond reputeEther has a reputation beyond reputeEther has a reputation beyond reputeEther has a reputation beyond reputeEther has a reputation beyond reputeEther has a reputation beyond reputeEther has a reputation beyond reputeEther has a reputation beyond reputeEther has a reputation beyond repute
Re: Several questions (language comparison)

Quote:
Originally Posted by Radical Pi View Post
The interrupt checks a flag for whether to kick, and also will delay the kick as needed to compensate for the speed of the kicker (without the extra timing code, the kicker only works around 75% power)
What is the worst-case execution time of the ISR from the time it receives control until it returns? Do you enable interrupts in the ISR, or leave them disabled?



  #11   Spotlight this post!  
Unread 05-10-2010, 23:20
Radical Pi Radical Pi is offline
Putting the Jumper in the Bumper
AKA: Ian Thompson
FRC #0639 (Code Red Robotics)
Team Role: Programmer
 
Join Date: Jan 2010
Rookie Year: 2010
Location: New York
Posts: 655
Radical Pi has a spectacular aura aboutRadical Pi has a spectacular aura aboutRadical Pi has a spectacular aura about
Re: Several questions (language comparison)

Quote:
Originally Posted by Ether View Post
What is the worst-case execution time of the ISR from the time it receives control until it returns? Do you enable interrupts in the ISR, or leave them disabled?
I'm not sure of the exact number as I didn't write the timing code for it, but I think the time to run it is almost nothing. The only slow operation is the wait to delay the kick, but that would be a very small wait.

The interrupt is setup through WPILib, so I have no idea if interrupts during interrupts are enabled (never seen any problems though).
__________________

"To have no errors would be life without meaning. No strugle, no joy"
"A network is only as strong as it's weakest linksys"
  #12   Spotlight this post!  
Unread 06-10-2010, 00:20
Ether's Avatar
Ether Ether is offline
systems engineer (retired)
no team
 
Join Date: Nov 2009
Rookie Year: 1969
Location: US
Posts: 8,101
Ether has a reputation beyond reputeEther has a reputation beyond reputeEther has a reputation beyond reputeEther has a reputation beyond reputeEther has a reputation beyond reputeEther has a reputation beyond reputeEther has a reputation beyond reputeEther has a reputation beyond reputeEther has a reputation beyond reputeEther has a reputation beyond reputeEther has a reputation beyond repute
Re: Several questions (language comparison)

Quote:
Originally Posted by Radical Pi View Post
I'm not sure of the exact number as I didn't write the timing code for it, but I think the time to run it is almost nothing. The only slow operation is the wait to delay the kick, but that would be a very small wait.
When you say "very small" do you mean, say, a few microseconds?

Or are you talking milliseconds?



  #13   Spotlight this post!  
Unread 08-10-2010, 12:18
Radical Pi Radical Pi is offline
Putting the Jumper in the Bumper
AKA: Ian Thompson
FRC #0639 (Code Red Robotics)
Team Role: Programmer
 
Join Date: Jan 2010
Rookie Year: 2010
Location: New York
Posts: 655
Radical Pi has a spectacular aura aboutRadical Pi has a spectacular aura aboutRadical Pi has a spectacular aura about
Re: Several questions (language comparison)

Quote:
Originally Posted by Ether View Post
When you say "very small" do you mean, say, a few microseconds?

Or are you talking milliseconds?
I think it's in the single digit milliseconds, but again I'm making a guess from the speed of our kicker
__________________

"To have no errors would be life without meaning. No strugle, no joy"
"A network is only as strong as it's weakest linksys"
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
Several questions... elbuo NI LabVIEW 0 16-02-2010 02:14
joystick comparison within percentage IceStorm NI LabVIEW 4 20-03-2009 00:19
Aluminum sprockets for drive train - several questions M. Mellott Technical Discussion 16 16-12-2008 15:53
Several questions Amittt 3D Animation and Competition 8 02-02-2006 18:21
Comparison Paper ? Steve W General Forum 13 09-11-2004 16:37


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

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