Go to Post A VERY credible statement ... coming from a 400-pound Pooh Bear - Rich Kressly [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 07-02-2012, 13:47
2526 2526 is offline
Crimson Robotics
FRC #2526 (Crimson Robotics)
Team Role: Teacher
 
Join Date: Feb 2008
Rookie Year: 2007
Location: Maple Grove Senior High
Posts: 10
2526 is an unknown quantity at this point
one sensor multiple subsystems

What is the best way to use a gyro or rangefinder sensor in multiple subsystems? For example we have a gyro from KOP and have subsystems for chassis and cannon turret how do we get the data for both subsystems? I have a couple ideas but was wondering how others did it.
Reply With Quote
  #2   Spotlight this post!  
Unread 07-02-2012, 14:31
jwakeman jwakeman is offline
Registered User
FRC #0063 (Red Barons)
Team Role: Mentor
 
Join Date: Jan 2011
Rookie Year: 2010
Location: 16510
Posts: 182
jwakeman is just really nicejwakeman is just really nicejwakeman is just really nicejwakeman is just really nicejwakeman is just really nice
Re: one sensor multiple subsystems

Also wasn't sure on the best way to structure this. Here is what we are doing:

- we have a drive subsystem and turret subystem (and others)
- gyro is part of our drive (chassis) subsystem
- we have a Command call SetTurretAngle
- SetTurretAngle requires the turret subystem
- SetTurretAngle does NOT require the drive subystem. I don't want it to prevent commands that require the drive subsystem from running. We are accessing the gyro thru the drive subsytem but we are not actuating anything within the drive so I feel that it is safe. I don't think there are multi-threading issues because I think the scheduler is a single thread.

This is what the implementation of the SetTurretAngle Command looks like:
Code:
void SetTurretAngleCommand::Execute() {
	turretSubsystem->SetTurretAngle(-1.0 * driveSubsystem->GetHeading());
}

In a similar vein. I wasn't sure where to put my Compressor object. I considered making a pneumatics subystem. The solenoid valves that actually actuate things will be part of their respective subsytem though. I decided the pneumatics are like the battery, just a source of energy that all the subystems could use. Ended up making the compressor a member CommandBase and will allocate the Solenoids to their respective subsystems.
Reply With Quote
  #3   Spotlight this post!  
Unread 11-02-2012, 14:46
sarangmittal's Avatar
sarangmittal sarangmittal is offline
Registered User
FRC #1683 (Techno Titans)
Team Role: Programmer
 
Join Date: Feb 2011
Rookie Year: 2011
Location: Atlanta GA
Posts: 20
sarangmittal is an unknown quantity at this point
Re: one sensor multiple subsystems

Our team just created a gyro subsystem and then called it in the classes we needed.
Reply With Quote
  #4   Spotlight this post!  
Unread 11-02-2012, 20:15
LukeS LukeS is offline
4272 mentor, 1024 alumnus
AKA: Luke Shumaker
FRC #4272
Team Role: Mentor
 
Join Date: Mar 2009
Rookie Year: 2009
Location: Indianapolis, IN
Posts: 60
LukeS is an unknown quantity at this point
Re: one sensor multiple subsystems

If the sensor isn't truly part of a subsystem, I don't make it part of one. I just declare it as public static final in CommandBase and access it from there.

Most of my raw hardware things are declared this way in CommandBase; It seemed more elegant to me to give CAN/DIO/AIO IDs or SpeedController objects to subsystems' constructors. This way CommandBase basically acts like RobotMap (I deleted RobotMap).

Last edited by LukeS : 11-02-2012 at 20:16. Reason: clarify
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:25.

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