|
|
|
![]() |
|
|||||||
|
||||||||
![]() |
| Thread Tools | Rate Thread | Display Modes |
|
#1
|
|||
|
|||
|
More Analog Inputs
Hi, so our team has decided to use your typical MaxBotics analog rangefinders (ultrasonic sensors), plugged into the code as general analog inputs. Now, this part works just fine, but there is one major issue: whenever the robot is supplying power to the motors, the sensor malfunctions.
The robot drive is constructed on ports 0-3, but those are outputs to the motor. On the rio itself, none of the analog input ports are in use (except for the ultrasonic sensor on port 0). For whatever reason, when power is outputted to the motor on ouput 0, our sensor on input 0 starts acting up (it reads a consistent value no matter what power the motor is on). There are two parts to my inquiry. Firstly, when we plug in encoders (essentially analog sensors) into the analog inputs, they don't have any issues with reading incorrectly when the motors are running. This only happens with the ultrasonic sensor. Frankly, we have no idea why. If anyone can offer any insight/fixes, please let us know; I've been working on this for days. Secondly, if it is impossible to prevent the ports getting some weird form of interference from the drive, how can I get the rio to read from a different port? I understand that there are references; I don't understand what they're saying, and a lot of them have conflicting instructions. In terms of that latter one, I'd like to know if you use a breakout board, how do ports work? Do I just put in port 5 in the code? Or do I have to specify in the constructor that it's reading from port 5 on the breakout board? I've seen that you can read analog sensors from a Talon SRX, then get that signal to a CAN bus, then get the CAN bus to go to the rio. In this case, do i instantiate an analog input, or a CAN object? If it is the former, what do I put for the port, since port 0 on a CAN bus would be different from port 0 on the analog ports? If it is the latter, then how do I get the analog value from it? Please send any help that you can. Thank you. |
|
#2
|
|||||
|
|||||
|
Re: More Analog Inputs
Start by measuring (with a voltmeter) the ultrasonic sensor output under the problem conditions (also still connected to the rio). Is it really the sensor, or the Rio's analog input?
|
|
#3
|
||||
|
||||
|
Re: More Analog Inputs
Talon SRX has many sensor inputs that you can have the Talon react to directly, and/or process yourself in your robot application(fetch over CAN Bus). This includes the 3.3V analog input, a few digital inputs (limit switch for example), quadrature, pulse width, direct-communication with a Pigeon IMU.
5V signals should use an adapter board to translate to a Talon-compliant 3.3V signal, such as... http://www.ctr-electronics.com/adapt...out-board.html Most of this is explained in the Talon SRX Software Reference Manual, but basically use the web-based config (Section 2 in software reference manual) to set the device ID of the Talon, then specify the same ID when you construct the CANTalon object in java. http://www.ctr-electronics.com/talon...ical_resources Some useful sections... 2.4. Self Test - poll the sensor values on a given talon. This works even if there is no code in the RIO. 16.9. Why are there multiple ways to get the same sensor data? GetEncoder() versus GetSensor()? 16.11. Why are there two feedback “analog” device types: Analog Encoder and Analog Potentiometer? 16.18. How do I get the raw ADC value (or voltage) on the Analog Input pin 16.21. Analog Position seems to be stuck around ~100 units? |
![]() |
| Thread Tools | |
| Display Modes | Rate This Thread |
|
|