Go to Post It's hilarious to watch this conversation about a box which probably has a 95% chance of being robot batteries turn into all kinds of bowling ball conspiracies. - artdutra04 [more]
Home
Go Back   Chief Delphi > Technical > Programming > Java
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 13-03-2011, 22:26
purduephotog purduephotog is offline
Active Defense Design Engineer
AKA: Jason
FRC #3015
Team Role: Leadership
 
Join Date: Jan 2007
Rookie Year: 2004
Location: Rochester, NY
Posts: 162
purduephotog is a jewel in the roughpurduephotog is a jewel in the roughpurduephotog is a jewel in the roughpurduephotog is a jewel in the rough
Send a message via AIM to purduephotog
Re: Java Threads

We ran a neat little experiment (at least to me) to understand how the underlying threads were being executed.

Set the motor speed to one value- and then immediately set it to another value.

What we ended up with is a 'pulse' - sometimes it would hold continuous values... othertimes it would slow/speed up.

I had hoped it would help drive some points in with the programmers.
__________________
http://purduephotog.deviantart.com
Portrait Photography: "I used to say Immortalized in Silver, but now I say Captured and Squeezed by Electrons".
Reply With Quote
  #2   Spotlight this post!  
Unread 13-03-2011, 22:43
Ether's Avatar
Ether Ether is offline
systems engineer (retired)
no team
 
Join Date: Nov 2009
Rookie Year: 1969
Location: US
Posts: 8,043
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: Java Threads

Quote:
Originally Posted by purduephotog View Post
We ran a neat little experiment (at least to me) to understand how the underlying threads were being executed.

Set the motor speed to one value- and then immediately set it to another value.

What we ended up with is a 'pulse' - sometimes it would hold continuous values... othertimes it would slow/speed up.

I had hoped it would help drive some points in with the programmers.
How did this help you understand how threads are being executed? What points were you hoping to drive home?


Reply With Quote
  #3   Spotlight this post!  
Unread 14-03-2011, 11:54
purduephotog purduephotog is offline
Active Defense Design Engineer
AKA: Jason
FRC #3015
Team Role: Leadership
 
Join Date: Jan 2007
Rookie Year: 2004
Location: Rochester, NY
Posts: 162
purduephotog is a jewel in the roughpurduephotog is a jewel in the roughpurduephotog is a jewel in the roughpurduephotog is a jewel in the rough
Send a message via AIM to purduephotog
Re: Java Threads

Quote:
Originally Posted by Ether View Post
How did this help you understand how threads are being executed? What points were you hoping to drive home?

Calls were being done asynchronously. That meant they were not executing in a linear fashion and you could not guarantee which would execute first.

If they executed linearly and in order, you'd have either no pulse (since the first set would be overridden when the code exited the loop) or a constant pulse rate since both calls were made in sequence, one after another, with no delays other than what the scheduler created.

Which mean the scheduler was pausing the robot.main classes and running things in the background- interrupt, so to speak, the main thread transparently. The students didn't (and still don't, I think) understand the implications of this. They think it just runs and runs and runs... they never see the pauses because they aren't presented to them.

One of the biggest issues I've had in trying to teach (and even some adults) is that just because you put two lines next to each other in the code- when dealing with hardware- you never know for certain (unless you're VERY careful) that they will execute properly. So it is always best to design with that thought in mind....
__________________
http://purduephotog.deviantart.com
Portrait Photography: "I used to say Immortalized in Silver, but now I say Captured and Squeezed by Electrons".
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 11:12.

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