Skip to content
This repository has been archived by the owner on Oct 27, 2020. It is now read-only.

No Type HiTechnicNxtGyroSensor for HardwareMap #68

Closed
aeleos opened this issue Nov 6, 2015 · 6 comments
Closed

No Type HiTechnicNxtGyroSensor for HardwareMap #68

aeleos opened this issue Nov 6, 2015 · 6 comments

Comments

@aeleos
Copy link

aeleos commented Nov 6, 2015

There is no type HiTechnicNxtGyroSensor for HardwareMap. Using gyroSensor instead when the object is created like HiTechnicNxtGyroSensor GyroSens returns the error
Error:(81, 43) error: incompatible types required: HiTechnicNxtGyroSensor found: GyroSensor
and using the type HiTechnicNxtGyroSensor returns the error
Error:(81, 28) error: cannot find symbol variable HiTechnicNxtGyroSensor

I am fairly sure I explored all the possibilities and its actually a bug, but I am not sure as I can't see the source code for the hardwaremap function.

@calebsander
Copy link

You need to cast the object if you want it as a HiTechnicNxtGyroSensor, although there is no reason to since that class doesn't have any methods other than those in GyroSensor.

@aeleos
Copy link
Author

aeleos commented Nov 7, 2015

Unless I am understanding it wrong what you should be doing is something like
HiTechnicNxtGyroSensor gyro;
gyro = hardwareMap.HiTechnicNxtGyroSensor.get("gyro_1");
which returns the error Error:(81, 28) error: cannot find symbol variable HiTechnicNxtGyroSensor

@calebsander
Copy link

Really what you should be doing is GyroSensor sensor = this.hardwareMap.gyroSensor.get("sensorName");

@aeleos
Copy link
Author

aeleos commented Nov 7, 2015

And so that will work even if I am using the NXT Gyro Sensor?

@calebsander
Copy link

You will get an instance of GyroSensor. If your configuration file specifies that the name you provided is for a HiTechnic gyro, then that object will be of type HiTechnicNxtGyroSensor, even though it is being stored in a variable of type GyroSensor. When you call getRotation() on it, it will return the result of calling getRotation() on any object of type HiTechnicNxtGyroSensor.

@calebsander
Copy link

Can this be closed?

sahithi-thumuluri pushed a commit to 6150FTC/Main-19-20-FTC6150 that referenced this issue Apr 4, 2019
sahithi-thumuluri added a commit to 6150FTC/Main-19-20-FTC6150 that referenced this issue Apr 4, 2019
sahithi-thumuluri pushed a commit to 6150FTC/Main-19-20-FTC6150 that referenced this issue Apr 4, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants