/** * hitechnic-gyro.h provides an API for the HiTechnic Gyroscopic Sensor. This program * demonstrates how to use that API. * * Changelog: * - 0.1: Initial release * * Credits: * - Big thanks to HiTechnic for providing me with the hardware necessary to write and test this. * * License: You may use this code as you wish, provided you give credit where it's due. * * THIS CODE WILL ONLY WORK WITH ROBOTC VERSION 3.54 AND HIGHER. * Xander Soldaat (xander_at_botbench.com) * 06 April 2012 * version 0.1 */

#include "drivers/hitechnic-gyro.h"

task main (){ float rotSpeed = 0; float heading = 0;

// Calibrate the gyro, make sure you hold the sensor still HTGYROstartCal(HTGYRO);

// Calculate the new heading by adding the amount of degrees // we've turned in the last 20ms // If our current rate of rotation is 100 degrees/second, // then we will have turned 100 * (20/1000) = 2 degrees since // the last time we measured. heading += rotSpeed * 0.02;

I copied the program to a blank one and called t Gyro 1. When I compiled the orginal program, there were no errors. Then, when I compiled Gyro 1 it had errors:**Severe*:Couldn't open '#include' file 'new folder/hitechnic-gyro.h'**Error**:Undefined procedure 'HTGYROstartCal'.**Error**:Too many parameters specified. Call to 'HTGYROstartCal'. Parameter: 'N/A' is 'HTGYRO' of type 'tSensors'.**Error**:Undefined procedure 'HTGYROreadRot'.**Error**:Too many parameters specified. Call to 'HTGYROreadRot'. Parameter: 'N/A' is 'HTGYRO' of type 'tSensors'.

I don't know why that happened. hitechnic-gyro-test2 is not in the same folder as drivers/hitechnic-gyro.h and neither is gyro 1. Someone please explain this.Thanks

Mon Jan 14, 2013 3:01 pm

Coder A

Moderator

Joined: Thu Jan 03, 2013 5:10 pmPosts: 207Location: The plateau north of the Ohio River Valley, also known as Cave Country.

Re: Program copying

Errors 2-5 are caused by the computer's not understanding of the incude file location. I got the dexter industries IMU and experienced similar problems. I fixed it by taking off the "drivers/" part of the file name. Hopefully this helps!.

Coder A

_________________I'm not a robot! I'm british! ~ quote from an asparagusI am not a robot! I am a unicorn! ~ quote from a robot

Mon Jan 14, 2013 3:29 pm

firecannons198

Rookie

Joined: Mon Jan 14, 2013 2:50 pmPosts: 12

Re: Program copying

Thanks but it didn't make it work. The errors are:**Severe*:Couldn't open '#include' file 'hitechnic-gyro.h'**Error**:Undefined procedure 'HTGYROstartCal'.**Error**:Too many parameters specified. Call to 'HTGYROstartCal'. Parameter: 'N/A' is 'HTGYRO' of type 'tSensors'.**Error**:Undefined procedure 'HTGYROreadRot'.**Error**:Too many parameters specified. Call to 'HTGYROreadRot'. Parameter: 'N/A' is 'HTGYRO' of type 'tSensors'.So not that much of a difference. Just to restate the problem, the same program is in sample program hitechnic-gyro-test2 as in Gyro 1 and Gyro 1 has errors. The program reads the degrees the gyro sensor is turning and then displays it on the NXT screen.

Mon Jan 14, 2013 8:20 pm

MHTS

Guru

Joined: Sun Nov 15, 2009 5:46 amPosts: 1523

Re: Program copying

Since you are running Xander's test program, you must have downloaded Xander's driver suite (which includes the test programs). In the same folder where the test programs are, there should be a "drivers" sub-folder. Make sure it's there. Inside that "drivers" sub-folder, you should be able to find the hitechnic-gyro.h file. If you can't find that sub-folder, that will be the problem.

Mon Jan 14, 2013 10:34 pm

MikeJMcFarlane

Rookie

Joined: Thu Sep 13, 2012 9:43 amPosts: 47

Re: Program copying

firecannons198 wrote:

Thanks but it didn't make it work. The errors are:**Severe*:Couldn't open '#include' file 'hitechnic-gyro.h'**Error**:Undefined procedure 'HTGYROstartCal'.**Error**:Too many parameters specified. Call to 'HTGYROstartCal'. Parameter: 'N/A' is 'HTGYRO' of type 'tSensors'.**Error**:Undefined procedure 'HTGYROreadRot'.**Error**:Too many parameters specified. Call to 'HTGYROreadRot'. Parameter: 'N/A' is 'HTGYRO' of type 'tSensors'.So not that much of a difference. Just to restate the problem, the same program is in sample program hitechnic-gyro-test2 as in Gyro 1 and Gyro 1 has errors. The program reads the degrees the gyro sensor is turning and then displays it on the NXT screen.

Did you install the Driver Suite as per Xander's instructions at http://botbench.com/blog/robotc-driver-suite/?(You will need to ensure the include file locations are setup in View>Preferences>Detailed preferences>Compiler>Include directories, which is slightly different to Xanders tutorial but reflects changes to the newer version of RobotC)

Tue Jan 15, 2013 3:06 am

firecannons198

Rookie

Joined: Mon Jan 14, 2013 2:50 pmPosts: 12

Re: Program copying

There was a drivers folder. I copied and pasted Gyro 1.c into the 3rd party sensors, which is the folder where hitechnic-gyro-test2.c was and tried to compile. There were errors. I also compied and pasted Gyro 1.c into the drivers folder and got the same result. I also copied and pasted the program from the hitechnic-gyro-test2.c into Gyro 1.c just to make sure. I looked at the link and it was kind of comfusing. I think we're making progress though.

I compiled the Gyro 1 program with the same code as hitechnic-gyro-test2 and it compiled. I downloaded it and it did the same ting as hitechnic-gyro-test2! Thanks Xander! Anyway, now I'm trying to calibrate the gyro. Is the best way to change to offset changing all the 620s in the driver?

Well, in the program, it runs HTGYROstartCal. WIth HTGYROstartCal and the program clip in my last post, I acheived more accuracy with the Gyro than ever before. Still, I would like to make it more accurate. Would repeating HTGYROstartCal or the other calibrating program make the gyro more accurate?

Who is online

Users browsing this forum: No registered users and 2 guests

You cannot post new topics in this forumYou cannot reply to topics in this forumYou cannot edit your posts in this forumYou cannot delete your posts in this forumYou cannot post attachments in this forum