Go to Post You earn what you work for. - Akash Rastogi [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

 
 
 
Thread Tools Rate Thread Display Modes
Prev Previous Post   Next Post Next
  #1   Spotlight this post!  
Unread 24-03-2015, 13:16
DeeWBee DeeWBee is offline
Registered User
FRC #3630
 
Join Date: Feb 2011
Location: Breck
Posts: 3
DeeWBee is an unknown quantity at this point
Updating Speed Using Ultrasonic Sensors

I am trying to create code that will slow down the robot as it gets closer to an object.

So far I have been able to write code that will stop the robot using an "if" statement with the conditional being the range as measured by sonar.


Code:
if(sonar.getRangeInches() < 40) {
             motor.stop();
However, when I modify the code such that I want to change the speed on approach, I get "robotDrive...output not updated enough". Any ideas? I've gotten the code to run by disabling the motor safety, but the sensitivity doesn't change at all.


Code:
if(sonar.getRangeInches() < 40) {
            driveTrain.setSensitivity(0.5)
          elseif(sonar.....<30){
            driveTrain.setSensitivty(0.25)......
Reply With Quote
 


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 10:48.

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